From: "Jörn Engel" <joern@wohnheim.fh-wedel.de>
To: Sam Ravnborg <sam@ravnborg.org>,
Kernel Mailing List <linux-kernel@vger.kernel.org>,
Linus Torvalds <torvalds@osdl.org>,
Russell King <rmk@arm.linux.org.uk>,
Jamie Lokier <jamie@shareable.org>
Subject: [PATCH] check headers for complete includes, etc.
Date: Mon, 29 Sep 2003 15:36:24 +0200 [thread overview]
Message-ID: <20030929133624.GA14611@wohnheim.fh-wedel.de> (raw)
In-Reply-To: <20030928194431.GB16921@wohnheim.fh-wedel.de>
On Sun, 28 September 2003 21:44:31 +0200, Jörn Engel wrote:
> On Sun, 28 September 2003 21:31:50 +0200, Sam Ravnborg wrote:
> >
> > That should do it. Can you also integrate the check Linus mentioned,
> > to make sure no declarations are present.
>
> If it's simple enough, you'll have it tomorrow. Linus' check might
> take a bit longer, I'm not sure yet how to define an empty object
> file. Is it enough if objdump -tT only shows sections?
>
> > I would name the target: headercheck:
> > to be consistent with the other targets.
>
> ok.
First version of the script. Seems to work, but it catches a lot,
maybe too much.
Jörn
--
"Error protection by error detection and correction."
-- from a university class
--- /dev/null 1970-01-01 01:00:00.000000000 +0100
+++ linux-2.6.0-test5/scripts/checkheader.pl 2003-09-29 15:33:10.000000000 +0200
@@ -0,0 +1,43 @@
+#!/usr/bin/perl -w
+use strict;
+
+my $normsymbols = "^\n"
+ . "lib/header.o: file format elf32-i386\n"
+ . "\n"
+ . "SYMBOL TABLE:\n"
+ . "00000000 l df \\*ABS\\* 00000000 header.c\n"
+ . "00000000 l d .text 00000000 \n"
+ . "00000000 l d .data 00000000 \n"
+ . "00000000 l d .bss 00000000 \n"
+ . "00000000 l d .comment 00000000 \n"
+ . "\n"
+ . "\n\$";
+
+#my @headers = ("linux/fs.h");
+my @headers = sort(split(/\n/, `(cd include/ && find linux -name "*.h")`));
+my $basename = "lib/header";
+
+foreach my $h (@headers) {
+ close(STDERR);
+ open(STDERR, ">", "$basename.err");
+
+ open(HC, '>', "$basename.c");
+ print(HC "#include <$h>\n");
+ close(HC);
+
+ # tests
+ if (system("make", "$basename.o") != 0) {
+ print("WARNING: header doesn't build standalone: $h\n");
+ next;
+ }
+
+ my $symbols = `objdump -t $basename.o`;
+ if ($symbols !~ /$normsymbols/) {
+ print("WARNING: Symbols may be declared: $h\n");
+ }
+} continue {
+ # cleanup
+ unlink("$basename.c");
+ unlink("$basename.err");
+ unlink("$basename.o");
+}
--- linux-2.6.0-test5/Makefile~headercheck 2003-09-28 21:37:19.000000000 +0200
+++ linux-2.6.0-test5/Makefile 2003-09-29 15:31:13.000000000 +0200
@@ -838,6 +838,9 @@
-name '*.[hcS]' -type f -print | sort \
| xargs $(PERL) -w scripts/checkincludes.pl
+headercheck:
+ $(PERL) scripts/checkheader.pl
+
versioncheck:
find * $(RCS_FIND_IGNORE) \
-name '*.[hcS]' -type f -print | sort \
next prev parent reply other threads:[~2003-09-29 13:36 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-28 10:14 Linux 2.6.0-test6 Geert Uytterhoeven
2003-09-28 12:50 ` Russell King
2003-09-28 13:54 ` Bernardo Innocenti
2003-09-28 17:37 ` Linus Torvalds
2003-09-28 18:46 ` Sam Ravnborg
2003-09-28 18:52 ` Linus Torvalds
2003-09-28 19:44 ` Jamie Lokier
2003-09-28 19:16 ` Jörn Engel
2003-09-28 19:31 ` Sam Ravnborg
2003-09-28 19:44 ` Jörn Engel
2003-09-29 13:36 ` Jörn Engel [this message]
2003-09-29 13:40 ` [PATCH] check headers for complete includes, etc Jörn Engel
2003-09-29 14:50 ` Sam Ravnborg
2003-09-29 15:00 ` Jörn Engel
2003-09-29 17:10 ` Dominik Kubla
2003-10-01 9:48 ` [PATCH v2] " Jörn Engel
2003-10-01 16:39 ` Sam Ravnborg
2003-10-01 17:00 ` Jörn Engel
2003-10-01 18:01 ` [PATCH v3] " Jörn Engel
2003-10-01 21:09 ` Sam Ravnborg
2003-10-02 8:37 ` [PATCH v4] " Jörn Engel
2003-09-28 19:42 ` Linux 2.6.0-test6 Russell King
2003-09-28 20:00 ` Jörn Engel
2003-09-28 21:43 ` Tim Schmielau
2003-09-28 21:54 ` Arnaldo Carvalho de Melo
2003-10-02 16:16 ` [PATCH] remove unnecessary #includes from <linux/fs.h> Jörn Engel
2003-10-02 17:22 ` Sam Ravnborg
2003-10-02 17:26 ` Jörn Engel
2003-10-03 15:03 ` Tim Schmielau
2003-09-29 15:08 ` Linux 2.6.0-test6 Chris Friesen
2003-09-29 15:14 ` Geert Uytterhoeven
2003-09-28 19:28 ` Russell King
2003-09-29 8:52 ` Geert Uytterhoeven
2003-09-29 19:19 ` bill davidsen
2003-09-30 10:42 ` Jörn Engel
2003-09-30 15:17 ` Bill Davidsen
2003-10-01 9:08 ` Jörn Engel
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030929133624.GA14611@wohnheim.fh-wedel.de \
--to=joern@wohnheim.fh-wedel.de \
--cc=jamie@shareable.org \
--cc=linux-kernel@vger.kernel.org \
--cc=rmk@arm.linux.org.uk \
--cc=sam@ravnborg.org \
--cc=torvalds@osdl.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®