linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kbuild: uapi: Drop types.h check from headers_check.pl
@ 2025-10-23 22:51 Nathan Chancellor
  2025-10-24  7:54 ` Thomas Weißschuh
  2025-10-27 21:59 ` Nicolas Schier
  0 siblings, 2 replies; 3+ messages in thread
From: Nathan Chancellor @ 2025-10-23 22:51 UTC (permalink / raw)
  To: Nathan Chancellor, Nicolas Schier
  Cc: Thomas Weißschuh, linux-kbuild, linux-kernel

Since commit d6fc9fcbaa65 ("kbuild: compile-test exported headers to
ensure they are self-contained"), the UAPI headers are compile tested
standalone with the compiler. This compile testing will catch a missing
include of types.h, making the types.h checking in headers_check.pl
originally added in commit 483b41218fa9 ("kbuild: add checks for include
of linux/types in userspace headers") obsolete.

Signed-off-by: Nathan Chancellor <nathan@kernel.org>
---
 usr/include/headers_check.pl | 63 --------------------------------------------
 1 file changed, 63 deletions(-)

diff --git a/usr/include/headers_check.pl b/usr/include/headers_check.pl
index 1fbc8785f96e..af5a513eaa00 100755
--- a/usr/include/headers_check.pl
+++ b/usr/include/headers_check.pl
@@ -39,7 +39,6 @@ foreach my $file (@files) {
 		$lineno++;
 		&check_include();
 		&check_asm_types();
-		&check_sizetypes();
 		&check_declarations();
 		# Dropped for now. Too much noise &check_config();
 	}
@@ -103,65 +102,3 @@ sub check_asm_types
 		$ret = 1;
 	}
 }
-
-my $linux_types;
-my %import_stack = ();
-sub check_include_typesh
-{
-	my $path = $_[0];
-	my $import_path;
-
-	my $fh;
-	my @file_paths = ($path, $dir . "/" .  $path, dirname($filename) . "/" . $path);
-	for my $possible ( @file_paths ) {
-	    if (not $import_stack{$possible} and open($fh, '<', $possible)) {
-		$import_path = $possible;
-		$import_stack{$import_path} = 1;
-		last;
-	    }
-	}
-	if (eof $fh) {
-	    return;
-	}
-
-	my $line;
-	while ($line = <$fh>) {
-		if ($line =~ m/^\s*#\s*include\s+<linux\/types.h>/) {
-			$linux_types = 1;
-			last;
-		}
-		if (my $included = ($line =~ /^\s*#\s*include\s+[<"](\S+)[>"]/)[0]) {
-			check_include_typesh($included);
-		}
-	}
-	close $fh;
-	delete $import_stack{$import_path};
-}
-
-sub check_sizetypes
-{
-	if ($filename =~ /types.h|int-l64.h|int-ll64.h/o) {
-		return;
-	}
-	if ($lineno == 1) {
-		$linux_types = 0;
-	} elsif ($linux_types >= 1) {
-		return;
-	}
-	if ($line =~ m/^\s*#\s*include\s+<linux\/types.h>/) {
-		$linux_types = 1;
-		return;
-	}
-	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 " .
-		              "without #include <linux/types.h>\n";
-		$linux_types = 2;
-		$ret = 1;
-	}
-}

---
base-commit: ac1280211e1c41704c756fd1bc5512f92010b3f0
change-id: 20251023-headers-pl-drop-check-sizes-2c68b02d31ff

Best regards,
--  
Nathan Chancellor <nathan@kernel.org>


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

* Re: [PATCH] kbuild: uapi: Drop types.h check from headers_check.pl
  2025-10-23 22:51 [PATCH] kbuild: uapi: Drop types.h check from headers_check.pl Nathan Chancellor
@ 2025-10-24  7:54 ` Thomas Weißschuh
  2025-10-27 21:59 ` Nicolas Schier
  1 sibling, 0 replies; 3+ messages in thread
From: Thomas Weißschuh @ 2025-10-24  7:54 UTC (permalink / raw)
  To: Nathan Chancellor; +Cc: Nicolas Schier, linux-kbuild, linux-kernel

Oct 24, 2025 01:51:49 Nathan Chancellor <nathan@kernel.org>:

> Since commit d6fc9fcbaa65 ("kbuild: compile-test exported headers to
> ensure they are self-contained"), the UAPI headers are compile tested
> standalone with the compiler. This compile testing will catch a missing
> include of types.h, making the types.h checking in headers_check.pl
> originally added in commit 483b41218fa9 ("kbuild: add checks for include
> of linux/types in userspace headers") obsolete.
>
> Signed-off-by: Nathan Chancellor <nathan@kernel.org>

Reviewed-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>

> ---
> usr/include/headers_check.pl | 63 --------------------------------------------
> 1 file changed, 63 deletions(-)

(...)

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

* Re: [PATCH] kbuild: uapi: Drop types.h check from headers_check.pl
  2025-10-23 22:51 [PATCH] kbuild: uapi: Drop types.h check from headers_check.pl Nathan Chancellor
  2025-10-24  7:54 ` Thomas Weißschuh
@ 2025-10-27 21:59 ` Nicolas Schier
  1 sibling, 0 replies; 3+ messages in thread
From: Nicolas Schier @ 2025-10-27 21:59 UTC (permalink / raw)
  To: Nathan Chancellor
  Cc: Nicolas Schier, Thomas Weißschuh, linux-kbuild, linux-kernel

On Thu, 23 Oct 2025 23:51:29 +0100, Nathan Chancellor wrote:
> Since commit d6fc9fcbaa65 ("kbuild: compile-test exported headers to
> ensure they are self-contained"), the UAPI headers are compile tested
> standalone with the compiler. This compile testing will catch a missing
> include of types.h, making the types.h checking in headers_check.pl
> originally added in commit 483b41218fa9 ("kbuild: add checks for include
> of linux/types in userspace headers") obsolete.
> 
> [...]

Applied to kbuild-next, thanks!

[1/1] kbuild: uapi: Drop types.h check from headers_check.pl
      https://git.kernel.org/kbuild/c/c260df04

Please note that commit hashes might change in case of issues with
kbuild-next.

Best regards,
-- 
Nicolas


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

end of thread, other threads:[~2025-10-27 22:05 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-10-23 22:51 [PATCH] kbuild: uapi: Drop types.h check from headers_check.pl Nathan Chancellor
2025-10-24  7:54 ` Thomas Weißschuh
2025-10-27 21:59 ` Nicolas Schier

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).