On Tue, 8 Oct 2024 at 12:24, Richard Sandiford <richard.sandif...@arm.com> wrote: > > Christophe Lyon <christophe.l...@linaro.org> writes: > > When --enable-werror is enabled when running the top-level configure, > > it passes --enable-werror-always to subdirs. Some of them, like > > libgcc, ignore it. > > > > This patch adds support for it, enabled only for aarch64, to avoid > > breaking bootstrap for other targets. > > > > The patch also adds -Wno-prio-ctor-dtor to avoid a warning when compiling > > lse_init.c > > > > libgcc/ > > * Makefile.in (WERROR): New. > > * config/aarch64/t-aarch64: Handle WERROR. Always use > > -Wno-prio-ctor-dtor. > > * configure.ac: Add support for --enable-werror-always. > > * configure: Regenerate. > > --- > > libgcc/Makefile.in | 1 + > > libgcc/config/aarch64/t-aarch64 | 1 + > > libgcc/configure | 31 +++++++++++++++++++++++++++++++ > > libgcc/configure.ac | 5 +++++ > > 4 files changed, 38 insertions(+) > > > > [...] > > diff --git a/libgcc/configure.ac b/libgcc/configure.ac > > index 4e8c036990f..6b3ea2aea5c 100644 > > --- a/libgcc/configure.ac > > +++ b/libgcc/configure.ac > > @@ -13,6 +13,7 @@ sinclude(../config/unwind_ipinfo.m4) > > sinclude(../config/gthr.m4) > > sinclude(../config/sjlj.m4) > > sinclude(../config/cet.m4) > > +sinclude(../config/warnings.m4) > > > > AC_INIT([GNU C Runtime Library], 1.0,,[libgcc]) > > AC_CONFIG_SRCDIR([static-object.mk]) > > @@ -746,6 +747,10 @@ AC_SUBST(HAVE_STRUB_SUPPORT) > > # Determine what GCC version number to use in filesystem paths. > > GCC_BASE_VER > > > > +# Only enable with --enable-werror-always until existing warnings are > > +# corrected. > > +ACX_PROG_CC_WARNINGS_ARE_ERRORS([manual]) > > It looks like this is borrowed from libcpp and/or libdecnumber. > Those are a bit different from libgcc in that they're host libraries > that can be built with any supported compiler (including non-GCC ones). > In constrast, libgcc can only be built with the corresponding version > of GCC. The usual restrictions on -Werror -- only use it during stages > 2 and 3, or if the user explicitly passes --enable-werror -- don't apply > in libgcc's case. We should always be building with the "right" version > of GCC (even for Canadian crosses) and so should always be able to use > -Werror. > > So personally, I think we should just go with: > > diff --git a/libgcc/config/aarch64/t-aarch64 b/libgcc/config/aarch64/t-aarch64 > index b70e7b94edd..ae1588ce307 100644 > --- a/libgcc/config/aarch64/t-aarch64 > +++ b/libgcc/config/aarch64/t-aarch64 > @@ -30,3 +30,4 @@ LIB2ADDEH += \ > $(srcdir)/config/aarch64/__arm_za_disable.S > > SHLIB_MAPFILES += $(srcdir)/config/aarch64/libgcc-sme.ver > +LIBGCC2_CFLAGS += $(WERROR) -Wno-prio-ctor-dtor > > ...this, but with $(WERROR) replaced by -Werror. > > At least, it would be a good way of finding out if there's a case > I've forgotten :) >
Indeed that would be efficient :-) As I said, I just dared to make use of -Werror if we could inherit it from the top-level configure. > Let's see what others think though. Sure, I'm happy with forcing -Werror if others agree :-) Thanks, Christophe > > Thanks, > Richard