public inbox for linux-kbuild@vger.kernel.org
 help / color / mirror / Atom feed
From: "Vegard Nossum" <vegard.nossum@gmail.com>
To: Sam Ravnborg <sam@ravnborg.org>
Cc: linux-kernel@vger.kernel.org, linux-kbuild@vger.kernel.org,
	David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH 6/6] kbuild: optimize headers_* targets
Date: Sun, 8 Jun 2008 22:37:41 +0200	[thread overview]
Message-ID: <19f34abd0806081337n2024f33fof890f63b4e136b83@mail.gmail.com> (raw)
In-Reply-To: <1212955658-32168-6-git-send-email-sam@ravnborg.org>

Hi Sam,

Just one more comment from me :-)

On Sun, Jun 8, 2008 at 10:07 PM, Sam Ravnborg <sam@ravnborg.org> wrote:
> diff --git a/scripts/headers_install.pl b/scripts/headers_install.pl
> new file mode 100644
> index 0000000..283c055
> --- /dev/null
> +++ b/scripts/headers_install.pl
> @@ -0,0 +1,43 @@
> +#!/usr/bin/perl
> +#
> +# headers_install prepare the listed header files for use in
> +# user space and copy the files to their destination.
> +#
> +# Usage: headers_install.pl odir installdir [files...]
> +# odir:    dir to open files
> +# install: dir to install the files
> +# files:   list of files to check
> +#
> +# Step in preparation for users space:
> +# 1) Drop all use of compiler.h definitions
> +# 2) Drop include of compiler.h
> +# 3) Drop all sections defined out by __KERNEL__ (using unifdef)
> +
> +use strict;
> +use warnings;
> +
> +my ($odir, $installdir, @files) = @ARGV;
> +
> +my $ret = 0;
> +my $unifdef = "scripts/unifdef -U__KERNEL__";
> +
> +foreach my $file (@files) {
> +       my $tmpfile = "$installdir/$file.tmp";
> +       open(my $infile, '<', "$odir/$file") or die "$odir/$file: $!\n";
> +       open(my $outfile, '>', "$tmpfile") or die "$tmpfile: $!\n";
> +       while (my $line = <$infile>) {
> +               $line =~ s/([\s(])__user\s/$1/g;
> +               $line =~ s/([\s(])__force\s/$1/g;
> +               $line =~ s/([\s(])__iomem\s/$1/g;
> +               $line =~ s/\s__attribute_const__\s/ /g;
> +               $line =~ s/\s__attribute_const__$//g;
> +               $line =~ s/^#include <linux\/compiler.h>//;
> +               printf $outfile "%s", $line;
> +       }
> +       close $outfile;
> +       close $infile;
> +       $ret = system $unifdef . " $tmpfile > $installdir/$file";

This seems flawed as we'll always exit with the $ret of the last file.
Do you intend to abort on the first error, or go as far as possible?

Maybe you can use something like this:

system ... or warn "$file: $!\n"
$ret = $? unless $ret;

(This should preserve the $ret from the first process that fails with
a non-zero exit code.)

> +       unlink $tmpfile;
> +}
> +
> +exit $ret;

What do you think?


Vegard

-- 
"The animistic metaphor of the bug that maliciously sneaked in while
the programmer was not looking is intellectually dishonest as it
disguises that the error is the programmer's own creation."
	-- E. W. Dijkstra, EWD1036

  reply	other threads:[~2008-06-08 20:37 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-08  9:47 [PATCH] Speed up "make headers_*" Sam Ravnborg
2008-06-08 10:12 ` Vegard Nossum
2008-06-08 10:41   ` Sam Ravnborg
2008-06-08 10:49     ` David Woodhouse
2008-06-08 11:17       ` Sam Ravnborg
2008-06-08 12:23         ` Oleg Verych
2008-06-08 13:17         ` David Woodhouse
2008-06-08 17:06           ` Segher Boessenkool
2008-06-08 17:34             ` Andreas Schwab
2008-06-08 19:45               ` Segher Boessenkool
2008-06-08 20:36           ` Geert Uytterhoeven
2008-06-08 11:01     ` WANG Cong
2008-06-08 11:18       ` Sam Ravnborg
2008-06-08 11:06     ` Vegard Nossum
2008-06-08 11:20       ` Sam Ravnborg
2008-06-08 11:20 ` David Woodhouse
2008-06-08 11:30   ` Sam Ravnborg
2008-06-08 11:47     ` David Woodhouse
2008-06-08 12:14       ` David Woodhouse
2008-06-08 12:29         ` David Woodhouse
2008-06-08 20:07 ` Sam Ravnborg
2008-06-08 20:58   ` David Woodhouse
2008-06-08 21:13     ` Sam Ravnborg
2008-06-09  6:23     ` Sam Ravnborg
2008-06-08 20:07 ` [PATCH 1/6] kbuild: refactor headers_* targets in Makefile Sam Ravnborg
2008-06-08 20:07 ` [PATCH 2/6] kbuild: always unifdef files in headers_install* Sam Ravnborg
2008-06-08 20:07 ` [PATCH 3/6] kbuild: drop support of ALTARCH for headers_* Sam Ravnborg
2008-06-08 20:07 ` [PATCH 4/6] kbuild: code refactoring in Makefile.headerinst Sam Ravnborg
2008-06-08 20:07 ` [PATCH 5/6] kbuild: error out early in make headers_install Sam Ravnborg
2008-06-09 10:19   ` David Woodhouse
2008-06-08 20:07 ` [PATCH 6/6] kbuild: optimize headers_* targets Sam Ravnborg
2008-06-08 20:37   ` Vegard Nossum [this message]
2008-06-08 21:15     ` Sam Ravnborg

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=19f34abd0806081337n2024f33fof890f63b4e136b83@mail.gmail.com \
    --to=vegard.nossum@gmail.com \
    --cc=dwmw2@infradead.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sam@ravnborg.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