apparmor: avoid -Wempty-body warning
Subsystems (2)
PATCH 1/1 apparmor: avoid -Wempty-body warning
From: Arnd Bergmann <[email protected]>
Building with 'make W=1' shows a warning for an empty macro:
security/apparmor/label.c: In function '__label_update':security/apparmor/label.c:2096:59: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body]
2096 | AA_BUG(labels_ns(label) != labels_ns(new));
Change the macro defintion to use no_printk(), which improves format string checking and avoids the warning.
--- security/apparmor/include/lib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
security/apparmor/include/lib.h +1 -1
@@ -36,7 +36,7 @@ #define AA_BUG_FMT(X, fmt, args...) \ WARN((X), "AppArmor WARN %s: (" #X "): " fmt, __func__, ##args)#else -#define AA_BUG_FMT(X, fmt, args...) +#define AA_BUG_FMT(X, fmt, args...) no_printk(fmt, ##args)#endif #define AA_ERROR(fmt, args...) \
Signature · 1 line
2.29.2
John Johansen
maintainerQuoted 4 lines · Arnd Bergmann
From: Arnd Bergmann <[email protected]>
Building with 'make W=1' shows a warning for an empty macro:
Quoted 8 lines
security/apparmor/label.c: In function '__label_update':security/apparmor/label.c:2096:59: error: suggest braces around empty body in an 'else' statement [-Werror=empty-body]
2096 |AA_BUG(labels_ns(label) != labels_ns(new));Change the macro defintion to use
no_printk(), which improves format string checking and avoids the warning.Signed-off-by Arnd Bergmann <[email protected]>
I have pulled it into the apparmor tree
Quoted 18 lines
--- security/apparmor/include/lib.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)security/apparmor/include/lib.h +1
-1@@ -36,7 +36,7 @@ #define AA_BUG_FMT(X, fmt, args...) \ WARN((X), "AppArmor WARN %s: (" #X "): " fmt, __func__, ##args)#else -#define AA_BUG_FMT(X, fmt, args...) +#define AA_BUG_FMT(X, fmt, args...) no_printk(fmt, ##args)#endif #define AA_ERROR(fmt, args...) \