summaryrefslogtreecommitdiff
path: root/scripts/headers_check.pl
AgeCommit message (Collapse)Author
2017-05-14scripts: Switch to more portable Perl shebangKamil Rytarowski
The default NetBSD package manager is pkgsrc and it installs Perl along other third party programs under custom and configurable prefix. The default prefix for binary prebuilt packages is /usr/pkg, and the Perl executable lands in /usr/pkg/bin/perl. This change switches "/usr/bin/perl" to "/usr/bin/env perl" as it's the most portable solution that should work for almost everybody. Perl's executable is detected automatically. This change switches -w option passed to the executable with more modern "use warnings;" approach. There is no functional change to the default behavior. While there, drop "require 5" from scripts/namespace.pl (Perl from 1994?). Signed-off-by: Kamil Rytarowski <n54@gmx.com> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2016-05-24headers_check: don't warn about c++ guardsArnd Bergmann
A recent addition to the DRM tree for 4.7 added 'extern "C"' guards for c++ to all the DRM headers, and that now causes warnings in 'make headers_check': usr/include/drm/amdgpu_drm.h:38: userspace cannot reference function or variable defined in the kernel usr/include/drm/drm.h:63: userspace cannot reference function or variable defined in the kernel usr/include/drm/drm.h:699: userspace cannot reference function or variable defined in the kernel usr/include/drm/drm_fourcc.h:30: userspace cannot reference function or variable defined in the kernel usr/include/drm/drm_mode.h:33: userspace cannot reference function or variable defined in the kernel usr/include/drm/drm_sarea.h:38: userspace cannot reference function or variable defined in the kernel usr/include/drm/exynos_drm.h:21: userspace cannot reference function or variable defined in the kernel usr/include/drm/i810_drm.h:7: userspace cannot reference function or variable defined in the kernel This changes the headers_check.pl script to not warn about this. I'm listing the merge commit as introducing the problem, because there are several patches in this branch that each do this for one file. Signed-off-by: Arnd Bergmann <arnd@arndb.de> Fixes: 7c10ddf87472 ("Merge branch 'drm-uapi-extern-c-fixes' of https://github.com/evelikov/linux into drm-next") Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
2014-08-20kbuild: Make scripts executableMichal Marek
The Makefiles call the respective interpreter explicitly, but this makes it easier to use the scripts manually. Signed-off-by: Michal Marek <mmarek@suse.cz>
2014-01-23headers_check: special case seqbuf_dump()Paul Bolle
"make headers_check" warns about soundcard.h for (at least) five years now: [...]/usr/include/linux/soundcard.h:1054: userspace cannot reference function or variable defined in the kernel We're apparently stuck with providing OSSlib-3.8 compatibility, so let's special case this declaration just to silence it. Notes: 0) Support for OSSlib post 3.8 was already removed in commit 43a990765a ("sound: Remove OSSlib stuff from linux/soundcard.h"). Five years have passed since that commit: do people still care about OSSlib-3.8? If not, quite a bit of code could be remove from soundcard.h (and probably ultrasound.h). 2) By the way, what is actually meant by: It is no longer possible to actually link against OSSlib with this header, but we still provide these macros for programs using them. Doesn't that mean compatibility to OSSlib isn't even useful? 3) Anyhow, a previous discussion soundcard.h, which led to that commit, starts at https://lkml.org/lkml/2009/1/20/349 . 4) And, yes, I sneaked in a whitespace fix. Signed-off-by: Paul Bolle <pebolle@tiscali.nl> Cc: Takashi Iwai <tiwai@suse.de> Acked-by: Arnd Bergmann <arnd@arndb.de> Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-03-26headers_check: recursively search for linux/types.h inclusionBobby Powers
headers_check.pl currently emits some spurious warnings, especially for the drm headers, about using __[us]{8,16,32,64} types without including linux/types.h. Recursively search for types.h inclusion, avoiding circular references. Signed-off-by: Bobby Powers <bobbypowers@gmail.com> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Dave Airlie <airlied@linux.ie> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-12-14headers_check: Fix warning textakpm@linux-foundation.org
Fix the warning text too, per Randy. Cc: Alexander Shishkin <virtuoso@slind.org> Cc: Michal Marek <mmarek@suse.cz> Cc: Randy Dunlap <randy.dunlap@oracle.com> Cc: Stephen Hemminger <shemminger@vyatta.com> Cc: WANG Cong <amwang@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-12-14headers_check: better search for functions in headersakpm@linux-foundation.org
Some headers don't bother with "extern" in function prototypes, which results in said prototypes being unnoticed and exported to userland. This patch slightly improves detection of such cases by checking for C type names as well in the beginning of a line. Signed-off-by: Alexander Shishkin <virtuoso@slind.org> Cc: Stephen Hemminger <shemminger@vyatta.com> Cc: Michal Marek <mmarek@suse.cz> Cc: WANG Cong <amwang@redhat.com> Cc: Randy Dunlap <randy.dunlap@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
2010-03-07headers_check: fix perl warningsStephen Hemminger
According to PBP; best way practice is to use local reference for file handle and three argument open. Also perl prototypes are a mistake. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Acked-by: WANG Cong <amwang@redhat.com> Cc: Michal Marek <mmarek@suse.cz> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Michal Marek <mmarek@suse.cz>
2009-06-09kbuild/headers_check: refine extern checkAmerigo Wang
'extern' checking information is not clear, refine it. Plus, fix a comment. Signed-off-by: WANG Cong <amwang@redhat.com> [sam: redid the extern error message] Acked-by: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2009-06-09scripts/headers_check.pl: correct RE in header CONFIG leak checkRobert P. J. Day
Correct the regular expression in scripts/headers_check.pl to include '_' as a valid character in the class; otherwise, the check will report a "leaked" symbol of CONFIG_A_B_C as merely CONFIG_A. This patch will make no difference whatsoever in the current kernel tree as the call to the perl routine that does that check is currently commented out: &check_include(); &check_asm_types(); &check_sizetypes(); &check_prototypes(); # Dropped for now. Too much noise &check_config(); However, I noticed that problem when I was building the yum downloadable kernel source rpm for fedora 11 (beta), which *does* run that check, and that's where the problem became obvious. Signed-off-by: Robert P. J. Day <rpjday@crashcourse.ca> Cc: David Woodhouse <dwmw2@infradead.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2009-01-31kbuild: drop check for CONFIG_ in headers_checkSam Ravnborg
The check for references to CONFIG_ symbols in exported headers turned out to be too agressive with the current state of affairs. After the work of Jaswinder to clean up all relevant cases we are down to almost pure noise. So lets drop the check for now - we can always add it back later should our headers be ready for that. Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
2009-01-02kbuild: ignore a few files in headers_checkSam Ravnborg
The new check for asm/types.h and linux/types.h had a few false positives. o We cannot let linux/types.h include linux/types.h o The int-ll64.h and int-ll64.h define the types and are included by linux/types.h Handle this by hardcoding the filenames in the headers_check script. Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2009-01-02kbuild: add checks for include of linux/types in userspace headersSam Ravnborg
If we see __[us](8|16|32|64) then we must include <linux/types.h> If wee see include of <asm/types.h> then we recommend <linux/types.h> Original script from Mike but modified by me. Cc: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2009-01-02kbuild: check for leaked CONFIG_ symbols to userspaceSam Ravnborg
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2009-01-02headers_check.pl: disallow extern'sMike Frysinger
Since prototypes with "extern" refer to kernel functions, they make no sense in userspace, so reject them automatically. Signed-off-by: Mike Frysinger <vapier@gentoo.org> [sam: made it into a warning] Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-10-29Fix incompatibility with versions of Perl less than 5.6.0Jeremy Huntwork
Fix headers_install.pl and headers_check.pl to be compatible with versions of Perl less than 5.6.0. It has been tested with Perl 5.005_03 and 5.8.8. I realize this may not be an issue for most people, but there will still be some that hit it, I imagine. There are three basic issues: 1. Prior to 5.6.0 open() only used 2 arguments, and the versions of the scripts in 2.6.27.1 use 3. 2. 5.6.0 also introduced the ability to use uninitialized scalar variables as file handles, which the current scripts make use of. 3. Lastly, 5.6.0 also introduced the pragma 'use warnings'. We can use the -w switch and be backwards compatible. Signed-off-by: Jeremy Huntwork <jhuntwork@lightcubesolutions.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
2008-07-25kbuild: optimize headers_* targetsSam Ravnborg
Move the core functionality of headers_install and headers_check to two small perl scripts. The makefile is adapted to use the perl scrip and changed to operate on all files in a directory. So if one file is changed then all files in the directory is processed. perl were chosen for the helper scripts because this is pure text processing which perl is good at and especially the headers_check.pl script are expected to see changes / new checks implmented. The speed is ~300% faster on this box. And the output generated to the screen is now down to two lines per directory (one for install, one for check) so it is easier to scroll back after a kernel build. The perl scripts has been brought to sanity by patient feedback from: Vegard Nossum <vegard.nossum@gmail.com> Signed-off-by: Sam Ravnborg <sam@ravnborg.org>