linux-sparse.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
To: Christopher Li <sparse@chrisli.org>
Cc: Sparse Mailing-list <linux-sparse@vger.kernel.org>
Subject: [PATCH 2/3] Makefile: Fix some macro redefinition warnings
Date: Thu, 16 May 2013 20:42:45 +0100	[thread overview]
Message-ID: <519536B5.7020603@ramsay1.demon.co.uk> (raw)


In particular, gcc complains as follows:

       CC       sparse-llvm.o
  <command line>:1:1: warning: "__STDC_CONSTANT_MACROS" redefined
  <command line>:1:1: warning: this is the location of the previous definition
  <command line>:1:1: warning: "__STDC_FORMAT_MACROS" redefined
  <command line>:1:1: warning: this is the location of the previous definition
  <command line>:1:1: warning: "__STDC_LIMIT_MACROS" redefined
  <command line>:1:1: warning: this is the location of the previous definition

The warnings are caused by the macros being defined twice on the
gcc command line. These command line -D macro definitions come
originally from the output of 'llvm-config --cflags', which is
recorded in the $(LLVM_CFLAGS) variable. This variable is then
included in the $(BASIC_CFLAGS) variable twice due to duplication
of the target-specific additions to the BASIC_CFLAGS, viz:

  sparse-llvm_EXTRA_DEPS := sparse-llvm.o
  sparse-llvm.o $(sparse-llvm_EXTRA_DEPS): BASIC_CFLAGS += $(LLVM_CFLAGS)

In order to suppress the warnings, we remove the duplication of
the sparse-llvm.o target in the above rule.

Signed-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 35e3801..ba2ba85 100644
--- a/Makefile
+++ b/Makefile
@@ -90,7 +90,7 @@ LLVM_LIBS := $(shell llvm-config --libs)
 PROGRAMS += $(LLVM_PROGS)
 INST_PROGRAMS += sparse-llvm sparsec
 sparse-llvm_EXTRA_DEPS := sparse-llvm.o
-sparse-llvm.o $(sparse-llvm_EXTRA_DEPS): BASIC_CFLAGS += $(LLVM_CFLAGS)
+$(sparse-llvm_EXTRA_DEPS): BASIC_CFLAGS += $(LLVM_CFLAGS)
 sparse-llvm_EXTRA_OBJS := $(LLVM_LIBS)
 endif
 endif
-- 
1.8.2


             reply	other threads:[~2013-05-16 19:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-16 19:42 Ramsay Jones [this message]
2013-05-17 18:30 ` [PATCH 2/3] Makefile: Fix some macro redefinition warnings Christopher Li

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=519536B5.7020603@ramsay1.demon.co.uk \
    --to=ramsay@ramsay1.demon.co.uk \
    --cc=linux-sparse@vger.kernel.org \
    --cc=sparse@chrisli.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;
as well as URLs for NNTP newsgroup(s).