diff options
author | Kevin Brodsky <[email protected]> | 2023-04-11 10:27:47 +0100 |
---|---|---|
committer | Andrew Morton <[email protected]> | 2023-04-18 16:39:34 -0700 |
commit | 31088f6f7906253ef4577f6a9b84e2d42447dba0 (patch) | |
tree | 175da91db6f8837b40443c973767ef06b1549b31 /scripts/gdb/vmlinux-gdb.py | |
parent | a3b2aeac9d154e5e15ddbf19de934c0c606b6acd (diff) |
uapi/linux/const.h: prefer ISO-friendly __typeof__
typeof is (still) a GNU extension, which means that it cannot be used when
building ISO C (e.g. -std=c99). It should therefore be avoided in uapi
headers in favour of the ISO-friendly __typeof__.
Unfortunately this issue could not be detected by
CONFIG_UAPI_HEADER_TEST=y as the __ALIGN_KERNEL() macro is not expanded in
any uapi header.
This matters from a userspace perspective, not a kernel one. uapi
headers and their contents are expected to be usable in a variety of
situations, and in particular when building ISO C applications (with
-std=c99 or similar).
This particular problem can be reproduced by trying to use the
__ALIGN_KERNEL macro directly in application code, say:
#include <linux/const.h>
int align(int x, int a)
{
return __KERNEL_ALIGN(x, a);
}
and trying to build that with -std=c99.
Link: https://lkml.kernel.org/r/[email protected]
Fixes: a79ff731a1b2 ("netfilter: xtables: make XT_ALIGN() usable in exported headers by exporting __ALIGN_KERNEL()")
Signed-off-by: Kevin Brodsky <[email protected]>
Reported-by: Ruben Ayrapetyan <[email protected]>
Tested-by: Ruben Ayrapetyan <[email protected]>
Reviewed-by: Petr Vorel <[email protected]>
Tested-by: Petr Vorel <[email protected]>
Reviewed-by: Masahiro Yamada <[email protected]>
Cc: Sam Ravnborg <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'scripts/gdb/vmlinux-gdb.py')
0 files changed, 0 insertions, 0 deletions