From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=45471 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PrDnq-0002GG-Ed for qemu-devel@nongnu.org; Sun, 20 Feb 2011 13:14:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PrDnn-0007y7-8v for qemu-devel@nongnu.org; Sun, 20 Feb 2011 13:14:38 -0500 Received: from hall.aurel32.net ([88.191.126.93]:46663) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PrDnm-0007xh-UR for qemu-devel@nongnu.org; Sun, 20 Feb 2011 13:14:35 -0500 Date: Sun, 20 Feb 2011 19:14:29 +0100 From: Aurelien Jarno Subject: Re: [Qemu-devel] [PATCH] scripts: add a guard macro in generated .h files Message-ID: <20110220181429.GS18619@volta.aurel32.net> References: <1297092100-19171-1-git-send-email-gingold@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <1297092100-19171-1-git-send-email-gingold@adacore.com> List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Tristan Gingold Cc: qemu-devel@nongnu.org On Mon, Feb 07, 2011 at 04:21:40PM +0100, Tristan Gingold wrote: > To avoid redefinition warnings. > > Signed-off-by: Tristan Gingold > --- > rules.mak | 2 +- > scripts/create_config | 12 ++++++++++++ > 2 files changed, 13 insertions(+), 1 deletions(-) > > diff --git a/rules.mak b/rules.mak > index ed59c9e..fb38f96 100644 > --- a/rules.mak > +++ b/rules.mak > @@ -57,7 +57,7 @@ find-in-path = $(if $(find-string /, $1), \ > @test -f $@ || cp $< $@ > > %.h-timestamp: %.mak > - $(call quiet-command, sh $(SRC_PATH)/scripts/create_config < $< > $@, " GEN $*.h") > + $(call quiet-command, sh $(SRC_PATH)/scripts/create_config $* < $< > $@, " GEN $*.h") > @cmp $@ $*.h >/dev/null 2>&1 || cp $@ $*.h > > # will delete the target of a rule if commands exit with a nonzero exit status > diff --git a/scripts/create_config b/scripts/create_config > index 0098e68..0302eab 100755 > --- a/scripts/create_config > +++ b/scripts/create_config > @@ -1,7 +1,17 @@ > #!/bin/sh > > +if [ $# -ne 1 ]; then > + echo "Usage: $0 filename" 2>&1 > + exit 1 > +fi > + > +cond_macro=`echo $1 | tr a-z- A-Z_`_H > + > echo "/* Automatically generated by create_config - do not modify */" > > +echo "#ifndef $cond_macro" > +echo "#define $cond_macro" > + > while read line; do > > case $line in > @@ -101,3 +111,5 @@ case $line in > esac > > done # read > + > +echo "#endif /* $cond_macro */" config-host.h only contains #define entries, and GCC doesn't choke when as long as the definitions are the same. What is the use case of this patch? -- Aurelien Jarno GPG: 1024D/F1BCDB73 aurelien@aurel32.net http://www.aurel32.net