Patchwork [v3] libstdc++/47058

login
register
mail settings
Submitter Benjamin Kosnik
Date Feb. 17, 2012, 8:33 p.m.
Message ID <20120217123321.340c6b29@shotwell>
Download mbox | patch
Permalink /patch/142006/
State New
Headers show

Comments

Benjamin Kosnik - Feb. 17, 2012, 8:33 p.m.
Adds support for disabling -Werror with --disable-werror configure flag.

tested x86/linux --enable-maintainer-mode
tested x86/linux --enable-maintainer-mode --disable-werror

-benjamin

Patch

2012-02-17  Benjamin Kosnik  <bkoz@redhat.com>

	    PR libstdc++/47058
	    * acinclude.m4 (GLIBCXX_ENABLE_WERROR): New.
	    (GLIBCXX_EXPORT_FLAGS): Add -Wabi to WARN_FLAGS
	    * configure.ac: Use it.
	    * fragment.am: Set WERROR_FLAG conditionally on --disable-werror.
	    * configure: Regenerate.
	    * python/Makefile.in: Same.
	    * Makefile.in: Same.
	    * doc/Makefile.in: Same.
	    * include/Makefile.in: Same.
	    * po/Makefile.in: Same.
	    * python/Makefile.in: Same.
	    * src/Makefile.in: Same.
	    * src/c++11/Makefile.in: Same.
	    * src/c++98/Makefile.in: Same.
	    * testsuite/Makefile.in: Same.

diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4
index e7ffacc..46a5532 100644
--- a/libstdc++-v3/acinclude.m4
+++ b/libstdc++-v3/acinclude.m4
@@ -729,7 +729,7 @@  AC_DEFUN([GLIBCXX_EXPORT_FLAGS], [
   # OPTIMIZE_CXXFLAGS = -O3 -fstrict-aliasing -fvtable-gc
   AC_SUBST(OPTIMIZE_CXXFLAGS)
 
-  WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual'
+  WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi'
   AC_SUBST(WARN_FLAGS)
 ])
 
@@ -3591,6 +3591,17 @@  AC_SUBST(python_mod_dir)
 GLIBCXX_CONDITIONAL(ENABLE_PYTHONDIR, test $python_mod_dir != no)
 ])
 
+dnl
+dnl Check to see if -Werror is disabled.
+dnl
+dnl --enable-werror/--disable-werror
+AC_DEFUN([GLIBCXX_ENABLE_WERROR], [
+  AC_MSG_CHECKING([for -Werror])
+  GLIBCXX_ENABLE(werror,$1,,[turns on -Werror])
+  AC_MSG_RESULT($enable_werror)
+  GLIBCXX_CONDITIONAL(ENABLE_WERROR, test $enable_werror = yes)
+])
+
 
 # Macros from the top-level gcc directory.
 m4_include([../config/gc++filt.m4])
diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac
index 81b523f..49de141 100644
--- a/libstdc++-v3/configure.ac
+++ b/libstdc++-v3/configure.ac
@@ -131,6 +131,7 @@  GLIBCXX_ENABLE_CXX_FLAGS
 GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING([no])
 GLIBCXX_ENABLE_EXTERN_TEMPLATE([yes])
 GLIBCXX_ENABLE_PYTHON
+GLIBCXX_ENABLE_WERROR([yes])
 
 # Checks for operating systems support that doesn't require linking.
 GLIBCXX_CHECK_MATH_PROTO
diff --git a/libstdc++-v3/fragment.am b/libstdc++-v3/fragment.am
index 2bcbc1a..304d396 100644
--- a/libstdc++-v3/fragment.am
+++ b/libstdc++-v3/fragment.am
@@ -13,12 +13,18 @@  STAMP = echo timestamp >
 toolexecdir = $(glibcxx_toolexecdir)
 toolexeclibdir = $(glibcxx_toolexeclibdir)
 
+if ENABLE_WERROR
+WERROR_FLAG=$(WERROR)
+else
+WERROR_FLAG=
+endif
+
 # These bits are all figured out from configure.  Look in acinclude.m4
 # or configure.ac to see how they are set.  See GLIBCXX_EXPORT_FLAGS.
 CONFIG_CXXFLAGS = \
 	$(SECTION_FLAGS) $(EXTRA_CXX_FLAGS) -frandom-seed=$@
 WARN_CXXFLAGS = \
-	$(WARN_FLAGS) $(WERROR) -fdiagnostics-show-location=once -Wabi
+	$(WARN_FLAGS) $(WERROR_FLAG) -fdiagnostics-show-location=once 
 
 # -I/-D flags to pass when compiling.
 AM_CPPFLAGS = $(GLIBCXX_INCLUDES)