All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tristan Gingold <gingold@adacore.com>
To: qemu-devel@nongnu.org
Cc: Tristan Gingold <gingold@adacore.com>
Subject: [Qemu-devel] [PATCH] scripts: add a guard macro in generated .h files
Date: Mon,  7 Feb 2011 16:21:40 +0100	[thread overview]
Message-ID: <1297092100-19171-1-git-send-email-gingold@adacore.com> (raw)

To avoid redefinition warnings.

Signed-off-by: Tristan Gingold <gingold@adacore.com>
---
 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 */"
-- 
1.7.3.GIT

             reply	other threads:[~2011-02-07 15:21 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-07 15:21 Tristan Gingold [this message]
2011-02-20 18:14 ` [Qemu-devel] [PATCH] scripts: add a guard macro in generated .h files Aurelien Jarno
2011-02-21  6:42   ` Tristan Gingold
2011-02-21  8:14     ` [Qemu-devel] " Paolo Bonzini
2011-02-21 18:13       ` Tristan Gingold

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=1297092100-19171-1-git-send-email-gingold@adacore.com \
    --to=gingold@adacore.com \
    --cc=qemu-devel@nongnu.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.