[llvm-commits] [llvm] r81719 - in /llvm/trunk: unittests/Makefile unittests/TestMain.cpp utils/unittest/Makefile utils/unittest/UnitTestMain/ utils/unittest/UnitTestMain/Makefile utils/unittest/UnitTestMain/TestMain.cpp

Julien Lerouge jlerouge at apple.com
Wed Sep 30 14:59:29 PDT 2009


On Sun, Sep 27, 2009 at 02:20:39PM -0700, Chris Lattner wrote:
> On Sep 18, 2009, at 9:11 AM, Julien Lerouge wrote:
>>> +++ llvm/trunk/utils/unittest/UnitTestMain/Makefile Sun Sep 13 16:31:21 
>>> 2009
>>> @@ -16,9 +16,4 @@
>>> CPP.Flags += -I$(LLVM_SRC_ROOT)/utils/unittest/googletest/include
>>> CPP.Flags += -Wno-variadic-macros
>>>
>>
>> -Wno-variadic-macros is not supported with older GCC, can we re-use the
>> logic in googletest/Makefile ? patch attached.
>
> This patch seems reasonable to me, though an autoconf check for those flags 
> would be even better (make builds go faster).
>

This patch adds an autoconf check and removes another flag that was used
in unittests/Makefile.unittest. I have kept the orignal names (NO_xxx).
Should fix the build with older GCC.

Thanks,
Julien

-- 
Julien Lerouge
PGP Key Id: 0xB1964A62
PGP Fingerprint: 392D 4BAD DB8B CE7F 4E5F FA3C 62DB 4AA7 B196 4A62
PGP Public Key from: keyserver.pgp.com
-------------- next part --------------
Index: Makefile.config.in
===================================================================
--- Makefile.config.in	(revision 83157)
+++ Makefile.config.in	(working copy)
@@ -320,3 +320,9 @@
 # support (via the -load option).
 ENABLE_LLVMC_DYNAMIC_PLUGINS = 1
 #@ENABLE_LLVMC_DYNAMIC_PLUGINS@
+
+# Optional flags supported by the compiler
+# -Wno-missing-field-initializers
+NO_MISSING_FIELD_INITIALIZERS = @NO_MISSING_FIELD_INITIALIZERS@
+# -Wno-variadic-macros
+NO_VARIADIC_MACROS = @NO_VARIADIC_MACROS@
Index: utils/unittest/UnitTestMain/Makefile
===================================================================
--- utils/unittest/UnitTestMain/Makefile	(revision 83157)
+++ utils/unittest/UnitTestMain/Makefile	(working copy)
@@ -10,8 +10,6 @@
 LEVEL = ../../..
 
 include $(LEVEL)/Makefile.config
-NO_MISSING_FIELD_INITIALIZERS := $(shell $(CXX) -Wno-missing-field-initializers -fsyntax-only -xc /dev/null 2>/dev/null && echo -Wno-missing-field-initializers)
-NO_VARIADIC_MACROS := $(shell $(CXX) -Wno-variadic-macros -fsyntax-only -xc /dev/null 2>/dev/null && echo -Wno-variadic-macros)
 
 LIBRARYNAME = UnitTestMain
 BUILD_ARCHIVE = 1
Index: utils/unittest/googletest/Makefile
===================================================================
--- utils/unittest/googletest/Makefile	(revision 83157)
+++ utils/unittest/googletest/Makefile	(working copy)
@@ -10,8 +10,6 @@
 LEVEL := ../../..
 
 include $(LEVEL)/Makefile.config
-NO_MISSING_FIELD_INITIALIZERS := $(shell $(CXX) -Wno-missing-field-initializers -fsyntax-only -xc /dev/null 2>/dev/null && echo -Wno-missing-field-initializers)
-NO_VARIADIC_MACROS := $(shell $(CXX) -Wno-variadic-macros -fsyntax-only -xc /dev/null 2>/dev/null && echo -Wno-variadic-macros)
 
 LIBRARYNAME = GoogleTest
 BUILD_ARCHIVE = 1
Index: unittests/Makefile.unittest
===================================================================
--- unittests/Makefile.unittest	(revision 83157)
+++ unittests/Makefile.unittest	(working copy)
@@ -19,7 +19,7 @@
 LLVMUnitTestExe = $(BuildMode)/$(TESTNAME)Tests$(EXEEXT)
 
 CPP.Flags += -I$(LLVM_SRC_ROOT)/utils/unittest/googletest/include/
-CPP.Flags += -Wno-variadic-macros
+CPP.Flags += $(NO_VARIADIC_MACROS)
 LIBS += -lGoogleTest -lUnitTestMain
 
 $(LLVMUnitTestExe): $(ObjectsO) $(ProjLibsPaths) $(LLVMLibsPaths)
Index: autoconf/m4/cxx_flag_check.m4
===================================================================
--- autoconf/m4/cxx_flag_check.m4	(revision 0)
+++ autoconf/m4/cxx_flag_check.m4	(revision 0)
@@ -0,0 +1,2 @@
+AC_DEFUN([CXX_FLAG_CHECK],
+  [AC_SUBST($1, `$CXX $2 -fsyntax-only -xc /dev/null 2>/dev/null && echo $2`)])
Index: autoconf/configure.ac
===================================================================
--- autoconf/configure.ac	(revision 83157)
+++ autoconf/configure.ac	(working copy)
@@ -929,6 +929,12 @@
 dnl Tool compatibility is okay if we make it here.
 AC_MSG_RESULT([ok])
 
+dnl Check optional compiler flags. 
+AC_MSG_CHECKING([optional compiler flags])
+CXX_FLAG_CHECK(NO_VARIADIC_MACROS, [-Wno-variadic-macros])
+CXX_FLAG_CHECK(NO_MISSING_FIELD_INITIALIZERS, [-Wno-missing-field-initializers])
+AC_MSG_RESULT([$NO_VARIADIC_MACROS $NO_MISSING_FIELD_INITIALIZERS])
+
 dnl===-----------------------------------------------------------------------===
 dnl===
 dnl=== SECTION 5: Check for libraries


More information about the llvm-commits mailing list