Commit 9b1c066
committed
core-macros: fix defer unused variable for Clang 14 with Ubuntu 22.04.
Seen with Ubuntu 22.04 and Clang 14.0.0-1ubuntu1.1, it produces a
warning about the unused variable produced by the defer macro:
```
| tests/zchk.c:1101:13: error: unused variable '__defer__1103' [-Werror,-Wunused-variable,Unused Entity Issue]
| defer({
| ^
| ./lib-common/core/macros.h:875:29: note: expanded from macro 'defer'
| _defer_with_name(_code, PFX_LINE(__defer__))
| ^
| ./lib-common/core/macros.h:668:24: note: expanded from macro 'PFX_LINE'
| #define PFX_LINE(pfx) _PFX_LINE_SFX(pfx, __LINE__, )
| ^
| ./lib-common/core/macros.h:665:41: note: expanded from macro '_PFX_LINE_SFX'
| #define _PFX_LINE_SFX(pfx, line, sfx) __PFX_LINE_SFX(pfx, line, sfx)
| ^
| ./lib-common/core/macros.h:664:41: note: expanded from macro '__PFX_LINE_SFX'
| #define __PFX_LINE_SFX(pfx, line, sfx) pfx##line##sfx
| ^
| <scratch space>:166:1: note: expanded from here
| __defer__1103
```
Add `__attr_unused__` to avoid this warning.
Also add it for GCC to avoid any further compat issues.
It is just ignored for newer compilers anyway.
Change-Id: Ibf310812172d833d20190577793fe7df06f962bf
Priv-Id: fdcb58e1e7f2d63d2c80467fb3d2b18808400a571 parent c76d1cf commit 9b1c066
1 file changed
Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
868 | 868 | | |
869 | 869 | | |
870 | 870 | | |
871 | | - | |
| 871 | + | |
872 | 872 | | |
873 | 873 | | |
874 | 874 | | |
| |||
881 | 881 | | |
882 | 882 | | |
883 | 883 | | |
884 | | - | |
885 | | - | |
886 | | - | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
887 | 887 | | |
888 | 888 | | |
889 | 889 | | |
| |||
0 commit comments