Revert "kbuild: avoid static_assert for genksyms"
PATCH 1/1 Revert "kbuild: avoid static_assert for genksyms"
This reverts commit 14dc3983b5dff513a90bd5a8cc90acaf7867c3d0.
Macro Elver had sent a fix proper fix earlier, and also pointed out corner cases:
"I guess what you propose is simpler, but might still have corner cases where we still get warnings. In particular, if some file (for whatever reason) does not include build_bug.h and uses a raw _Static_assert(), then we still get warnings. E.g. I see 1 user of raw _Static_assert() (drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h )."
I believe the raw use of _Static_assert() should be allowed, so this should be fixed in genksyms.
Even after commit 14dc3983b5df ("kbuild: avoid static_assert for genksyms"), I confirmed the following test code emits the warning.
---------------->8----------------
#include <linux/export.h>
_Static_assert((1 ?: 0), "");
void foo(void) { }
EXPORT_SYMBOL(foo);
---------------->8----------------WARNING: modpost: EXPORT symbol "foo" [vmlinux] version generation failed, symbol will not be versioned.
Now that commit 869b91992bce ("genksyms: Ignore module scoped _Static_assert()") fixed this issue properly, the workaround should be reverted.
---
I will apply this after Macro's patch is pulled.
include/linux/build_bug.h | 5 ----- 1 file changed, 5 deletions(-)
include/linux/build_bug.h +0 -5
@@ -77,9 +77,4 @@#define static_assert (expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)#define __static_assert (expr, msg, ...) _Static_assert(expr, msg) -#ifdef __GENKSYMS__ -/* genksyms gets confused by _Static_assert */ -#define _Static_assert (expr, ...) -#endif -#endif /* _LINUX_BUILD_BUG_H */
Signature · 1 line
2.27.0
Quoted 27 lines · Masahiro Yamada
This reverts commit
14dc3983b5dff513a90bd5a8cc90acaf7867c3d0.Macro Elver had sent a fix proper fix earlier, and also pointed out corner cases:
"I guess what you propose is simpler, but might still have corner cases where we still get warnings. In particular, if some file (for whatever reason) does not include
build_bug.hand uses a raw_Static_assert(), then we still get warnings. E.g. I see 1 user of raw_Static_assert()(drivers/gpu/drm/amd/amdgpu/amdgv_sriovmsg.h)."I believe the raw use of
_Static_assert()should be allowed, so this should be fixed in genksyms.Even after commit
14dc3983b5df("kbuild: avoidstatic_assertfor genksyms"), I confirmed the following test code emits the warning.---------------->8---------------- #include <linux/export.h> _Static_assert((1 ?: 0), ""); void foo(void) { } EXPORT_SYMBOL(foo); ---------------->8----------------
Quoted 3 lines
WARNING: modpost: EXPORT symbol "foo" [vmlinux] version generation failed, symbol will not be versioned.
Now that commit
869b91992bce("genksyms: Ignore module scoped
I updated the commit id in the mainline.
9ab55d7f240f
Now, applied to linux-kbuild.
Quoted 32 lines
_Static_assert()") fixed this issue properly, the workaround should be reverted.Cc Marco Elver <[email protected]>Signed-off-by Masahiro Yamada <[email protected]>---
I will apply this after Macro's patch is pulled.
include/linux/build_bug.h | 5 ----- 1 file changed, 5 deletions(-)include/linux/build_bug.h +0
-6@@ -77,9 +77,4 @@#define static_assert (expr, ...) __static_assert(expr, ##__VA_ARGS__, #expr)#define __static_assert (expr, msg, ...) _Static_assert(expr, msg) -#ifdef __GENKSYMS__ -/* genksyms gets confused by _Static_assert */ -#define _Static_assert (expr, ...) -#endif -#endif /* _LINUX_BUILD_BUG_H */ --2.27.0
Signature · 2 lines
Best Regards Masahiro Yamada