public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH v2] Make `-Werror` optional in libatomic/libbacktrace/libgomp/libitm/libsanitizer
@ 2022-02-03 11:08 David Seifert
  2022-02-03 11:23 ` Jonathan Wakely
  0 siblings, 1 reply; 11+ messages in thread
From: David Seifert @ 2022-02-03 11:08 UTC (permalink / raw)
  To: gcc-patches; +Cc: jakub, David Seifert

* `-Werror` can cause issues when a more recent version of GCC compiles
  an older version:
  - https://bugs.gentoo.org/229059
  - https://bugs.gentoo.org/475350
  - https://bugs.gentoo.org/667104
---
 libatomic/configure.ac                | 6 ++++--
 libbacktrace/configure.ac             | 7 ++++---
 libgo/configure.ac                    | 8 ++++----
 libgomp/configure.ac                  | 6 ++++--
 libitm/configure.ac                   | 6 ++++--
 libsanitizer/configure.ac             | 9 +++++++++
 libsanitizer/libbacktrace/Makefile.am | 2 --
 7 files changed, 29 insertions(+), 15 deletions(-)

diff --git a/libatomic/configure.ac b/libatomic/configure.ac
index f350b9b3509..c715d06fe8b 100644
--- a/libatomic/configure.ac
+++ b/libatomic/configure.ac
@@ -251,10 +251,12 @@ LIBAT_ENABLE_SYMVERS
 CFLAGS="$save_CFLAGS"
 AC_CACHE_SAVE
 
+AC_ARG_ENABLE([werror], [
+  AS_HELP_STRING([--disable-werror], [disable building with -Werror])])
 # Add -Wall -Werror if we are using GCC.
-if test "x$GCC" = "xyes"; then
+AS_IF([test "x$enable_werror" != "xno" && test "x$GCC" = "xyes"], [
   XCFLAGS="$XCFLAGS -Wall -Werror"
-fi
+])
 
 # Add CET specific flags if CET is enabled
 GCC_CET_FLAGS(CET_FLAGS)
diff --git a/libbacktrace/configure.ac b/libbacktrace/configure.ac
index 0dfd82bc03e..f18de946597 100644
--- a/libbacktrace/configure.ac
+++ b/libbacktrace/configure.ac
@@ -145,10 +145,11 @@ ACX_PROG_CC_WARNING_OPTS([-W -Wall -Wwrite-strings -Wstrict-prototypes \
 			  -Wmissing-format-attribute -Wcast-qual],
 			  [WARN_FLAGS])
 
-if test -n "${with_target_subdir}"; then
+AC_ARG_ENABLE([werror], [
+  AS_HELP_STRING([--disable-werror], [disable building with -Werror])])
+AS_IF([test "x$enable_werror" != "xno" && test -n "${with_target_subdir}"], [
   WARN_FLAGS="$WARN_FLAGS -Werror"
-fi
-
+])
 AC_SUBST(WARN_FLAGS)
 
 if test -n "${with_target_subdir}"; then
diff --git a/libgo/configure.ac b/libgo/configure.ac
index 1f4f32dae2b..11dd9a7fc21 100644
--- a/libgo/configure.ac
+++ b/libgo/configure.ac
@@ -62,11 +62,11 @@ AC_PROG_AWK
 WARN_FLAGS='-Wall -Wextra -Wwrite-strings -Wcast-qual'
 AC_SUBST(WARN_FLAGS)
 
-AC_ARG_ENABLE(werror, [AS_HELP_STRING([--enable-werror],
-                                      [turns on -Werror @<:@default=yes@:>@])])
-if test "x$enable_werror" != "xno"; then
+AC_ARG_ENABLE([werror], [
+  AS_HELP_STRING([--disable-werror], [disable building with -Werror])])
+AS_IF([test "x$enable_werror" != "xno" && test "x$GCC" = "xyes"], [
   WERROR="-Werror"
-fi
+])
 AC_SUBST(WERROR)
 
 glibgo_toolexecdir=no
diff --git a/libgomp/configure.ac b/libgomp/configure.ac
index bfb613b91f0..9b77c8f44e8 100644
--- a/libgomp/configure.ac
+++ b/libgomp/configure.ac
@@ -121,10 +121,12 @@ AC_SUBST(CFLAGS)
 # in both places for now and restore CFLAGS at the end of config.
 save_CFLAGS="$CFLAGS"
 
+AC_ARG_ENABLE([werror], [
+  AS_HELP_STRING([--disable-werror], [disable building with -Werror])])
 # Add -Wall -Werror if we are using GCC.
-if test "x$GCC" = "xyes"; then
+AS_IF([test "x$enable_werror" != "xno" && test "x$GCC" = "xyes"], [
   XCFLAGS="$XCFLAGS -Wall -Werror"
-fi
+])
 
 # Find other programs we need.
 AC_CHECK_TOOL(AR, ar)
diff --git a/libitm/configure.ac b/libitm/configure.ac
index ac81b146845..616158f5c43 100644
--- a/libitm/configure.ac
+++ b/libitm/configure.ac
@@ -261,10 +261,12 @@ GCC_CHECK_ELF_STYLE_WEAKREF
 CFLAGS="$save_CFLAGS"
 AC_CACHE_SAVE
 
+AC_ARG_ENABLE([werror], [
+  AS_HELP_STRING([--disable-werror], [disable building with -Werror])])
 # Add -Wall -Werror if we are using GCC.
-if test "x$GCC" = "xyes"; then
+AS_IF([test "x$enable_werror" != "xno" && test "x$GCC" = "xyes"], [
   XCFLAGS="$XCFLAGS -Wall -Werror"
-fi
+])
 
 XCFLAGS="$XCFLAGS $XPCFLAGS"
 
diff --git a/libsanitizer/configure.ac b/libsanitizer/configure.ac
index 13cd302030d..432f05d160a 100644
--- a/libsanitizer/configure.ac
+++ b/libsanitizer/configure.ac
@@ -400,6 +400,15 @@ fi
 AC_SUBST([TSAN_TARGET_DEPENDENT_OBJECTS])
 AC_SUBST([SANITIZER_COMMON_TARGET_DEPENDENT_OBJECTS])
 
+AC_ARG_ENABLE([werror], [
+  AS_HELP_STRING([--disable-werror], [disable building with -Werror])])
+
+WARN_FLAGS="-Wextra -Wall -Wwrite-strings -Wmissing-format-attribute -Wcast-qual"
+AS_IF([test "x$enable_werror" != "xno"], [
+  WARN_FLAGS="$WARN_FLAGS -Werror"
+])
+AC_SUBST([WARN_FLAGS])
+
 # Determine what GCC version number to use in filesystem paths.
 GCC_BASE_VER
 
diff --git a/libsanitizer/libbacktrace/Makefile.am b/libsanitizer/libbacktrace/Makefile.am
index 16accd468df..0cf8d2104c0 100644
--- a/libsanitizer/libbacktrace/Makefile.am
+++ b/libsanitizer/libbacktrace/Makefile.am
@@ -34,8 +34,6 @@ ACLOCAL_AMFLAGS = -I ../.. -I ../../config
 AM_CPPFLAGS = -I $(top_srcdir)/../include -I $(top_srcdir)/../libgcc \
 	-I ../../libgcc -I .. -I $(top_srcdir) -I $(top_srcdir)/../libbacktrace
 
-WARN_FLAGS = -W -Wall -Wwrite-strings -Wmissing-format-attribute \
-	     -Wcast-qual -Werror
 C_WARN_FLAGS = $(WARN_FLAGS) -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition
 CXX_WARN_FLAGS = $(WARN_FLAGS) -Wno-unused-parameter
 AM_CFLAGS = $(C_WARN_FLAGS)
-- 
2.35.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2022-02-22 22:57 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-03 11:08 [PATCH v2] Make `-Werror` optional in libatomic/libbacktrace/libgomp/libitm/libsanitizer David Seifert
2022-02-03 11:23 ` Jonathan Wakely
2022-02-03 11:27   ` David Seifert
2022-02-03 11:30   ` [PATCH v3] " David Seifert
2022-02-03 11:50     ` Jakub Jelinek
2022-02-03 11:59       ` David Seifert
2022-02-03 12:06         ` Jakub Jelinek
2022-02-03 14:06           ` [PATCH v4] " David Seifert
2022-02-03 15:16             ` Jakub Jelinek
2022-02-22 22:57             ` Ian Lance Taylor
2022-02-04  2:09         ` [PATCH v3] " Hans-Peter Nilsson

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 read-only IMAP folder(s) and NNTP newsgroup(s).