Kernel integer types are sometimes used inside defines too. Expand check_kerneltypes() to notice these too.
Annoyingly, lines like #define VFIO_IRQ_SET_DATA_BOOL (1 << 1) /* Data is bool (u8) */ force me to first strip oneline comments from the processed line. Both regexes added here are just complicated enough to catch all current uses of kernel integer types inside preprocessor #defines. Signed-off-by: Paul Bolle <pebo...@tiscali.nl> --- scripts/headers_check.pl | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/scripts/headers_check.pl b/scripts/headers_check.pl index 317aa3a..dc7b34c 100644 --- a/scripts/headers_check.pl +++ b/scripts/headers_check.pl @@ -163,7 +163,18 @@ sub check_sizetypes sub check_kerneltypes { - if ($line =~ m/^[[:space:]]*([us](8|16|32|64))\b/) { + my $match = 0; + # delete oneline comment + (my $scrubbed = $line) =~ s/\/\*.*\*\///; + + if ($scrubbed =~ m/^[[:space:]]*([us](8|16|32|64))\b/) { + $match = 1; + } elsif ($scrubbed =~ m/# *define *.*\b([us](8|16|32|64))\b/) { + # matches lines like + # #define BAR bar(MAGIC, u64) + $match = 1; + } + if ($match) { printf STDERR "$filename:$lineno: " . "found $1 type exported to userspace; " . "use __$1 instead\n"; -- 1.7.11.7 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/