Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

kbuild: uapi: Drop types.h check from headers_check.pl

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>
Link: https://patch.msgid.link/20251023-headers-pl-drop-check-sizes-v1-1-18bd21cf8f5e@kernel.org
Signed-off-by: Nicolas Schier <nsc@kernel.org>

authored by

Nathan Chancellor and committed by
Nicolas Schier
2d7eda1d 7319256d

-63
-63
usr/include/headers_check.pl
··· 39 39 $lineno++; 40 40 &check_include(); 41 41 &check_asm_types(); 42 - &check_sizetypes(); 43 42 &check_declarations(); 44 43 # Dropped for now. Too much noise &check_config(); 45 44 } ··· 99 100 $linux_asm_types = 1; 100 101 printf STDERR "$filename:$lineno: " . 101 102 "include of <linux/types.h> is preferred over <asm/types.h>\n"; 102 - $ret = 1; 103 - } 104 - } 105 - 106 - my $linux_types; 107 - my %import_stack = (); 108 - sub check_include_typesh 109 - { 110 - my $path = $_[0]; 111 - my $import_path; 112 - 113 - my $fh; 114 - my @file_paths = ($path, $dir . "/" . $path, dirname($filename) . "/" . $path); 115 - for my $possible ( @file_paths ) { 116 - if (not $import_stack{$possible} and open($fh, '<', $possible)) { 117 - $import_path = $possible; 118 - $import_stack{$import_path} = 1; 119 - last; 120 - } 121 - } 122 - if (eof $fh) { 123 - return; 124 - } 125 - 126 - my $line; 127 - while ($line = <$fh>) { 128 - if ($line =~ m/^\s*#\s*include\s+<linux\/types.h>/) { 129 - $linux_types = 1; 130 - last; 131 - } 132 - if (my $included = ($line =~ /^\s*#\s*include\s+[<"](\S+)[>"]/)[0]) { 133 - check_include_typesh($included); 134 - } 135 - } 136 - close $fh; 137 - delete $import_stack{$import_path}; 138 - } 139 - 140 - sub check_sizetypes 141 - { 142 - if ($filename =~ /types.h|int-l64.h|int-ll64.h/o) { 143 - return; 144 - } 145 - if ($lineno == 1) { 146 - $linux_types = 0; 147 - } elsif ($linux_types >= 1) { 148 - return; 149 - } 150 - if ($line =~ m/^\s*#\s*include\s+<linux\/types.h>/) { 151 - $linux_types = 1; 152 - return; 153 - } 154 - if (my $included = ($line =~ /^\s*#\s*include\s+[<"](\S+)[>"]/)[0]) { 155 - check_include_typesh($included); 156 - } 157 - # strip single-line comments, as types may be referenced within them 158 - $line =~ s@/\*.*?\*/@@; 159 - if ($line =~ m/__[us](8|16|32|64)\b/) { 160 - printf STDERR "$filename:$lineno: " . 161 - "found __[us]{8,16,32,64} type " . 162 - "without #include <linux/types.h>\n"; 163 - $linux_types = 2; 164 103 $ret = 1; 165 104 } 166 105 }