From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x329.google.com (mail-wm1-x329.google.com [IPv6:2a00:1450:4864:20::329]) by sourceware.org (Postfix) with ESMTPS id 804A73858C27 for ; Wed, 19 Jan 2022 17:08:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 804A73858C27 Received: by mail-wm1-x329.google.com with SMTP id 25-20020a05600c231900b003497473a9c4so15623152wmo.5 for ; Wed, 19 Jan 2022 09:08:28 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QjRqVuzjc7LaKiOut2ZGJ37v1JVq8Dfl7h/jEoAw4co=; b=m44+WmJN6lebpaIShdYUBNSOJRGa8ULBQhC4VHXmY1ZZnFZC7NFPHyj3Ac4ZghQfoK kMtugHtDjCX4hlDXd87iIjEAhjI08MhPsMD1pW9MozcQfVldckDzgRy+zKr+pahpgwIL TzNihjbXGOhF2NcTe64j7pS8n7dtv/bgLh358DkFXBUPa/CLoHp+p8zsaIK0rnNztT1Z PcqpQL6tEDlpAkLXIIaiDiZxV1UAHEpcxgAqxjUSe7ajfqXloSMyaXNkVN2/lPdSyDn2 ft1MsFIdnW0TCa2NeR8ZFMqHX3zr7L8hVLKm7yVazQ41aD7MrTjPlvGAEezSKYwMSlM3 1AxA== X-Gm-Message-State: AOAM531vp2jUX/KEwl/1pSs2OvJZlOvdcpYUESUK7n4sSLZYpy/ZAY6G R+kRRhTt2CqSIK9eXcC7a5d0+XxpiqMPl+0Iaqdgnw== X-Google-Smtp-Source: ABdhPJxWmv5swWBmXGKCD7ibgItu3QmINRnXpSyNrQEGEiFmibV8z/qX/VAGz7ahAsl4ubeXFZg1TPssygE5XkFaOiE= X-Received: by 2002:a5d:6848:: with SMTP id o8mr30212008wrw.2.1642612107403; Wed, 19 Jan 2022 09:08:27 -0800 (PST) MIME-Version: 1.0 References: <20220117200429.2106612-1-soap@gentoo.org> In-Reply-To: <20220117200429.2106612-1-soap@gentoo.org> From: Eric Gallager Date: Wed, 19 Jan 2022 12:08:16 -0500 Message-ID: Subject: Re: [PATCH] Make `-Werror` optional in libatomic/libbacktrace/libgomp/libitm/libsanitizer To: David Seifert Cc: gcc-patches , Jakub Jelinek Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 19 Jan 2022 17:08:33 -0000 On Mon, Jan 17, 2022 at 3:05 PM David Seifert via Gcc-patches wrote: > > * `-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 ++++--- > libgomp/configure.ac | 6 ++++-- > libitm/configure.ac | 6 ++++-- > libsanitizer/configure.ac | 9 +++++++++ > libsanitizer/libbacktrace/Makefile.am | 2 -- > 6 files changed, 25 insertions(+), 11 deletions(-) Hi, thanks for the patch, I personally support it (assuming it goes along with a regeneration of the configure scripts). Reading it, though, reminded me of another quibble I had about warning options used when building GCC: The GCC docs for -Wextra say "(This option used to be called -W. The older name is still supported, but the newer name is more descriptive.)" See: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#Warning-Options This to me seems to imply that -Wextra is the preferred name, and that the old name of -W should be replaced by it. Could we also make a change to rename all instances of -W in configure scripts to -Wextra too? Just a thought. Thanks, Eric > > diff --git a/libatomic/configure.ac b/libatomic/configure.ac > index f350b9b3509..5a9f69bb74d 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([--enable-werror], [turns on -Werror @<:@default=yes@:>@])]) > # 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..a2858e6ecde 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([--enable-werror], [turns on -Werror @<:@default=yes@:>@])]) > +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/libgomp/configure.ac b/libgomp/configure.ac > index bfb613b91f0..c3062dc5a07 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([--enable-werror], [turns on -Werror @<:@default=yes@:>@])]) > # 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..ad99d14098e 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([--enable-werror], [turns on -Werror @<:@default=yes@:>@])]) > # 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..64eb42afc83 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([--enable-werror], [turns on -Werror @<:@default=yes@:>@])]) > + > +WARN_FLAGS="-W -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.34.1 >