Skip to content

Commit

Permalink
headers_check.pl: disallow extern's
Browse files Browse the repository at this point in the history
Since prototypes with "extern" refer to kernel functions, they make no
sense in userspace, so reject them automatically.

Signed-off-by: Mike Frysinger <[email protected]>
[sam: made it into a warning]
Signed-off-by: Sam Ravnborg <[email protected]>
  • Loading branch information
vapier authored and sravnborg committed Jan 2, 2009
1 parent 7826005 commit 46b8af5
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion scripts/headers_check.pl
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@
# Only include files located in asm* and linux* are checked.
# The rest are assumed to be system include files.
#
# 2) TODO: check for leaked CONFIG_ symbols
# 2) It is checked that prototypes does not use "extern"
#
# 3) TODO: check for leaked CONFIG_ symbols

use strict;

Expand All @@ -33,6 +35,7 @@
while ($line = <FH>) {
$lineno++;
check_include();
check_prototypes();
}
close FH;
}
Expand All @@ -54,3 +57,10 @@ sub check_include
}
}
}

sub check_prototypes
{
if ($line =~ m/^\s*extern\b/) {
printf STDERR "$filename:$lineno: extern's make no sense in userspace\n";
}
}

0 comments on commit 46b8af5

Please sign in to comment.