Use -Wabi=2 to fix warnings about -Wabi having no effect on its own. This requires suppressing two warnings in src/c++11/debug.cc which do not affect the library ABI.
Previously libstdc++ defaulted to --enable-werror but the -Werror flag was not actually added unless --enable-maintainer-mode was used. This is not documented and not the expected behaviour. This removes any special treatment for maintainer-mode, makes -Werror depend directly on --enable-werror, and changes the default to --enable-werror=no. PR libstdc++/86450 * acinclude.m4 (GLIBCXX_CHECK_COMPILER_FEATURES): Don't define WERROR. (GLIBCXX_EXPORT_FLAGS): Use -Wabi=2 instead of -Wabi. * configure: Regenerate. * configure.ac: Change GLIBCXX_ENABLE_WERROR default to "no". * doc/Makefile.in: Regenerate. * fragment.am: Set WERROR_FLAG to -Werror instead of $(WERROR). * include/Makefile.in: Regenerate. * libsupc++/Makefile.in: Regenerate. * po/Makefile.in: Regenerate. * python/Makefile.in: Regenerate. * src/Makefile.in: Regenerate. * src/c++11/Makefile.in: Regenerate. * src/c++11/debug.cc: Use diagnostic pragmas to suppress warnings from -Wabi=2 that don't affect exported symbols. * src/c++98/Makefile.in: Regenerate. * src/filesystem/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. Tested powerpc64le-linux, committed to trunk.
commit 0e99fd82ce20499c4da0d0950e7197f14d45311f Author: Jonathan Wakely <jwak...@redhat.com> Date: Tue Jul 17 00:59:17 2018 +0100 PR libstdc++/86450 use -Wabi=2 and simplify -Werror use Use -Wabi=2 to fix warnings about -Wabi having no effect on its own. This requires suppressing two warnings in src/c++11/debug.cc which do not affect the library ABI. Previously libstdc++ defaulted to --enable-werror but the -Werror flag was not actually added unless --enable-maintainer-mode was used. This is not documented and not the expected behaviour. This removes any special treatment for maintainer-mode, makes -Werror depend directly on --enable-werror, and changes the default to --enable-werror=no. PR libstdc++/86450 * acinclude.m4 (GLIBCXX_CHECK_COMPILER_FEATURES): Don't define WERROR. (GLIBCXX_EXPORT_FLAGS): Use -Wabi=2 instead of -Wabi. * configure: Regenerate. * configure.ac: Change GLIBCXX_ENABLE_WERROR default to "no". * doc/Makefile.in: Regenerate. * fragment.am: Set WERROR_FLAG to -Werror instead of $(WERROR). * include/Makefile.in: Regenerate. * libsupc++/Makefile.in: Regenerate. * po/Makefile.in: Regenerate. * python/Makefile.in: Regenerate. * src/Makefile.in: Regenerate. * src/c++11/Makefile.in: Regenerate. * src/c++11/debug.cc: Use diagnostic pragmas to suppress warnings from -Wabi=2 that don't affect exported symbols. * src/c++98/Makefile.in: Regenerate. * src/filesystem/Makefile.in: Regenerate. * testsuite/Makefile.in: Regenerate. diff --git a/libstdc++-v3/acinclude.m4 b/libstdc++-v3/acinclude.m4 index cf5add167e6..bbf3c8df3e1 100644 --- a/libstdc++-v3/acinclude.m4 +++ b/libstdc++-v3/acinclude.m4 @@ -140,13 +140,6 @@ AC_DEFUN([GLIBCXX_CHECK_COMPILER_FEATURES], [ ac_test_CXXFLAGS="${CXXFLAGS+set}" ac_save_CXXFLAGS="$CXXFLAGS" - # Check for maintainer-mode bits. - if test x"$USE_MAINTAINER_MODE" = xno; then - WERROR='' - else - WERROR='-Werror' - fi - # Check for -ffunction-sections -fdata-sections AC_MSG_CHECKING([for g++ that supports -ffunction-sections -fdata-sections]) CXXFLAGS='-g -Werror -ffunction-sections -fdata-sections' @@ -163,7 +156,6 @@ AC_DEFUN([GLIBCXX_CHECK_COMPILER_FEATURES], [ AC_MSG_RESULT($ac_fdsections) AC_LANG_RESTORE - AC_SUBST(WERROR) AC_SUBST(SECTION_FLAGS) ]) @@ -733,7 +725,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 -Wabi' + WARN_FLAGS="-Wall -Wextra -Wwrite-strings -Wcast-qual -Wabi=2" AC_SUBST(WARN_FLAGS) ]) diff --git a/libstdc++-v3/configure.ac b/libstdc++-v3/configure.ac index 7e1fd84606a..1e0a33fb3ea 100644 --- a/libstdc++-v3/configure.ac +++ b/libstdc++-v3/configure.ac @@ -175,7 +175,7 @@ GLIBCXX_ENABLE_CXX_FLAGS GLIBCXX_ENABLE_FULLY_DYNAMIC_STRING([no]) GLIBCXX_ENABLE_EXTERN_TEMPLATE([yes]) GLIBCXX_ENABLE_PYTHON -GLIBCXX_ENABLE_WERROR([yes]) +GLIBCXX_ENABLE_WERROR([no]) GLIBCXX_ENABLE_VTABLE_VERIFY([no]) # Checks for operating systems support that doesn't require linking. diff --git a/libstdc++-v3/fragment.am b/libstdc++-v3/fragment.am index 898569520b9..216c572fc60 100644 --- a/libstdc++-v3/fragment.am +++ b/libstdc++-v3/fragment.am @@ -14,9 +14,9 @@ toolexecdir = $(glibcxx_toolexecdir) toolexeclibdir = $(glibcxx_toolexeclibdir) if ENABLE_WERROR -WERROR_FLAG=$(WERROR) +WERROR_FLAG = -Werror else -WERROR_FLAG= +WERROR_FLAG = endif if ENABLE_EXTERN_TEMPLATE diff --git a/libstdc++-v3/src/c++11/debug.cc b/libstdc++-v3/src/c++11/debug.cc index cb64dd9240e..88fe889dd6a 100644 --- a/libstdc++-v3/src/c++11/debug.cc +++ b/libstdc++-v3/src/c++11/debug.cc @@ -66,6 +66,10 @@ namespace return __gnu_internal::get_mutex(index); } +#pragma GCC diagnostic push +// Suppress -Wabi=2 warnings due to PR c++/51322 mangling change +#pragma GCC diagnostic warning "-Wabi=6" + void swap_its(__gnu_debug::_Safe_sequence_base& __lhs, __gnu_debug::_Safe_iterator_base*& __lhs_its, @@ -90,6 +94,7 @@ namespace swap_its(__lhs, __lhs._M_const_iterators, __rhs, __rhs._M_const_iterators); } +#pragma GCC diagnostic pop template<typename _Action> void