public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] kbuild: uapi: Strip comments before size type check
@ 2025-10-06 12:33 Geert Uytterhoeven
  2025-10-06 12:40 ` Andreas Schwab
  2025-10-07 16:55 ` Nathan Chancellor
  0 siblings, 2 replies; 6+ messages in thread
From: Geert Uytterhoeven @ 2025-10-06 12:33 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier, Thomas Weißschuh
  Cc: linux-kbuild, linux-m68k, linux-kernel, Geert Uytterhoeven

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>
---
v2:
  - Add Reviewed-by,
  - Drop support for C99 comments.
---
 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 21c2fb9520e6af2d..16c238aadfebb061 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 comments (single-line only)
+	$line =~ s@\/\*.*?\*\/@@;
 	if ($line =~ m/__[us](8|16|32|64)\b/) {
 		printf STDERR "$filename:$lineno: " .
 		              "found __[us]{8,16,32,64} type " .
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2025-10-07 16:55 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-06 12:33 [PATCH v2] kbuild: uapi: Strip comments before size type check Geert Uytterhoeven
2025-10-06 12:40 ` Andreas Schwab
2025-10-06 13:20   ` Geert Uytterhoeven
2025-10-06 18:02     ` Nathan Chancellor
2025-10-07  7:42       ` Geert Uytterhoeven
2025-10-07 16:55 ` Nathan Chancellor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox