From: Geert Uytterhoeven geert@linux-m68k.org
[ Upstream commit 66128f4287b04aef4d4db9bf5035985ab51487d5 ]
On m68k, check_sizetypes in headers_check reports:
./usr/include/asm/bootinfo-amiga.h:17: found __[us]{8,16,32,64} type without #include <linux/types.h>
This header file does not use any of the Linux-specific integer types, but merely refers to them from comments, so this is a false positive. As of commit c3a9d74ee413bdb3 ("kbuild: uapi: upgrade check_sizetypes() warning to error"), this check was promoted to an error, breaking m68k all{mod,yes}config builds.
Fix this by stripping simple comments before looking for Linux-specific integer types.
Signed-off-by: Geert Uytterhoeven geert@linux-m68k.org Reviewed-by: Thomas Weißschuh thomas.weissschuh@linutronix.de Link: https://patch.msgid.link/949f096337e28d50510e970ae3ba3ec9c1342ec0.1759753998... [nathan: Adjust comment and remove unnecessary escaping from slashes in regex] Signed-off-by: Nathan Chancellor nathan@kernel.org Signed-off-by: Sasha Levin sashal@kernel.org ---
LLM Generated explanations, may be completely bogus:
YES – removing the in-line `/* … */` fragments before running the size- type regex prevents the false-positive that currently stops m68k `all{mod,yes}config` builds after the warning was promoted to an error.
- The added substitution in `usr/include/headers_check.pl:152` strips same-line block comments so references like `/* size (__be32) */` disappear before the `__[us](8|16|32|64)` check, one of which triggers today in `arch/m68k/include/uapi/asm/bootinfo-amiga.h` purely from comments. Because only the comment text is removed, genuine usages (e.g., `__u32 foo;`) remain intact, so real missing-include problems are still caught. - The failure being addressed was introduced by c3a9d74ee413bdb3, which turned the diagnostic into an error and now breaks headers_check/all*config for m68k; this change is the minimal fix to restore buildability. - The change is tightly scoped (a single Perl substitution), has no dependencies, and does not affect kernel runtime behavior, so regression risk is negligible.
usr/include/headers_check.pl | 2 ++ 1 file changed, 2 insertions(+)
diff --git a/usr/include/headers_check.pl b/usr/include/headers_check.pl index 2b70bfa5558e6..02767e8bf22d0 100755 --- a/usr/include/headers_check.pl +++ b/usr/include/headers_check.pl @@ -155,6 +155,8 @@ sub check_sizetypes if (my $included = ($line =~ /^\s*#\s*include\s+[<"](\S+)[>"]/)[0]) { check_include_typesh($included); } + # strip single-line comments, as types may be referenced within them + $line =~ s@/*.*?*/@@; if ($line =~ m/__[us](8|16|32|64)\b/) { printf STDERR "$filename:$lineno: " . "found __[us]{8,16,32,64} type " .