|
|
c6d234 |
commit a4ecc9eb9b15bc51a1dc4726c06d35eaea74e162
|
|
|
c6d234 |
Author: Joseph Myers <joseph@codesourcery.com>
|
|
|
c6d234 |
Date: Wed Dec 10 01:14:48 2014 +0000
|
|
|
c6d234 |
|
|
|
c6d234 |
Use -Werror by default, add --disable-werror.
|
|
|
c6d234 |
|
|
|
c6d234 |
As discussed starting at
|
|
|
c6d234 |
<https://sourceware.org/ml/libc-alpha/2014-11/msg00323.html>, this
|
|
|
c6d234 |
patch makes the glibc build use -Werror by default to avoid
|
|
|
c6d234 |
accidentally adding new warnings to the build. The configure option
|
|
|
c6d234 |
--disable-werror can be used to disable this.
|
|
|
c6d234 |
|
|
|
c6d234 |
-Wno-error=undef is temporarily used because the build isn't clean
|
|
|
c6d234 |
regarding -Wundef warnings. The idea is that once the remaining
|
|
|
c6d234 |
-Wundef warnings have been cleaned up (in at least one configuration),
|
|
|
c6d234 |
-Wno-error=undef will be removed.
|
|
|
c6d234 |
|
|
|
c6d234 |
I get a clean build and test on x86_64 (GCC 4.9 branch) with this
|
|
|
c6d234 |
patch. The expectation is that this may well break the build for some
|
|
|
c6d234 |
other configurations, and people seeing such breakage should make
|
|
|
c6d234 |
appropriate fixes to fix or suppress the warnings for their
|
|
|
c6d234 |
configurations. In some cases that may involve using pragmas as the
|
|
|
c6d234 |
right fix (I think that will be right for the -Wno-inline issue for
|
|
|
c6d234 |
MIPS I referred to in
|
|
|
c6d234 |
<https://sourceware.org/ml/libc-alpha/2012-11/msg00798.html>, for
|
|
|
c6d234 |
example), in some cases -Wno-error in sysdeps makefiles (__restore_rt
|
|
|
c6d234 |
in MIPS sigaction, for example), in some cases substantive fixes for
|
|
|
c6d234 |
the warnings.
|
|
|
c6d234 |
|
|
|
c6d234 |
Note that if, with a view to listing all the warnings then fixing them
|
|
|
c6d234 |
all, you just look for "warning:" in output from building and testing
|
|
|
c6d234 |
with --disable-werror, you'll see lots of warnings from the linker
|
|
|
c6d234 |
about functions such as tmpnam. Those warnings can be ignored - only
|
|
|
c6d234 |
compiler warnings are relevant to -Werror, not linker warnings.
|
|
|
c6d234 |
|
|
|
c6d234 |
* configure.ac (--disable-werror): New configure option.
|
|
|
c6d234 |
(enable_werror): New AC_SUBST.
|
|
|
c6d234 |
* configure: Regenerated.
|
|
|
c6d234 |
* config.make.in (enable-werror): New variable.
|
|
|
c6d234 |
* Makeconfig [$(enable-werror) = yes] (+gccwarn): Add -Werror
|
|
|
c6d234 |
-Wno-error=undef.
|
|
|
c6d234 |
(+gccwarn-c): Do not use -Werror=implicit-function-declaration.
|
|
|
c6d234 |
* manual/install.texi (Configuring and compiling): Document
|
|
|
c6d234 |
--disable-werror.
|
|
|
c6d234 |
* INSTALL: Regenerated.
|
|
|
c6d234 |
* debug/Makefile (CFLAGS-tst-chk1.c): Add -Wno-error.
|
|
|
c6d234 |
(CFLAGS-tst-chk2.c): Likewise.
|
|
|
c6d234 |
(CFLAGS-tst-chk3.c): Likewise.
|
|
|
c6d234 |
(CFLAGS-tst-chk4.cc): Likewise.
|
|
|
c6d234 |
(CFLAGS-tst-chk5.cc): Likewise.
|
|
|
c6d234 |
(CFLAGS-tst-chk6.cc): Likewise.
|
|
|
c6d234 |
(CFLAGS-tst-lfschk1.c): Likewise.
|
|
|
c6d234 |
(CFLAGS-tst-lfschk2.c): Likewise.
|
|
|
c6d234 |
(CFLAGS-tst-lfschk3.c): Likewise.
|
|
|
c6d234 |
(CFLAGS-tst-lfschk4.cc): Likewise.
|
|
|
c6d234 |
(CFLAGS-tst-lfschk5.cc): Likewise.
|
|
|
c6d234 |
(CFLAGS-tst-lfschk6.cc): Likewise.
|
|
|
c6d234 |
|
|
|
c6d234 |
Conflicts:
|
|
|
c6d234 |
INSTALL
|
|
|
c6d234 |
manual/install.texi
|
|
|
c6d234 |
(Textual conflicts due to elision backport;
|
|
|
c6d234 |
glibc-rh841653-0.patch and others)
|
|
|
c6d234 |
configure.ac
|
|
|
c6d234 |
(Change applied to configure.in instead.)
|
|
|
c6d234 |
|
|
|
c6d234 |
diff --git a/INSTALL b/INSTALL
|
|
|
c6d234 |
index 264e57bc5f0316f7..82b29f5d8746f929 100644
|
|
|
c6d234 |
--- a/INSTALL
|
|
|
c6d234 |
+++ b/INSTALL
|
|
|
c6d234 |
@@ -143,6 +143,13 @@ will be used, and CFLAGS sets optimization options for the compiler.
|
|
|
c6d234 |
`--enable-lock-elision=yes'
|
|
|
c6d234 |
Enable lock elision for pthread mutexes by default.
|
|
|
c6d234 |
|
|
|
c6d234 |
+`--disable-werror'
|
|
|
c6d234 |
+ By default, the GNU C Library is built with `-Werror'. If you wish
|
|
|
c6d234 |
+ to build without this option (for example, if building with a newer
|
|
|
c6d234 |
+ version of GCC than this version of the GNU C Library was tested
|
|
|
c6d234 |
+ with, so new warnings cause the build with `-Werror' to fail), you
|
|
|
c6d234 |
+ can configure with `--disable-werror'.
|
|
|
c6d234 |
+
|
|
|
c6d234 |
`--build=BUILD-SYSTEM'
|
|
|
c6d234 |
`--host=HOST-SYSTEM'
|
|
|
c6d234 |
These options are for cross-compiling. If you specify both
|
|
|
c6d234 |
diff --git a/Makeconfig b/Makeconfig
|
|
|
c6d234 |
index 02f1cc1255c5ac07..6f61e4835c0a7770 100644
|
|
|
c6d234 |
--- a/Makeconfig
|
|
|
c6d234 |
+++ b/Makeconfig
|
|
|
c6d234 |
@@ -644,7 +644,10 @@ else
|
|
|
c6d234 |
+gccwarn := -Wall -Wwrite-strings -Winline
|
|
|
c6d234 |
endif
|
|
|
c6d234 |
+gccwarn += -Wundef
|
|
|
c6d234 |
-+gccwarn-c = -Wstrict-prototypes -Werror=implicit-function-declaration
|
|
|
c6d234 |
+ifeq ($(enable-werror),yes)
|
|
|
c6d234 |
++gccwarn += -Werror -Wno-error=undef
|
|
|
c6d234 |
+endif
|
|
|
c6d234 |
++gccwarn-c = -Wstrict-prototypes
|
|
|
c6d234 |
|
|
|
c6d234 |
# We do not depend on the address of constants in different files to be
|
|
|
c6d234 |
# actually different, so allow the compiler to merge them all.
|
|
|
c6d234 |
diff --git a/config.make.in b/config.make.in
|
|
|
c6d234 |
index d5490f61cd3faeba..3c65c9f03ab65a74 100644
|
|
|
c6d234 |
--- a/config.make.in
|
|
|
c6d234 |
+++ b/config.make.in
|
|
|
c6d234 |
@@ -49,6 +49,7 @@ sysheaders = @sysheaders@
|
|
|
c6d234 |
sysincludes = @SYSINCLUDES@
|
|
|
c6d234 |
c++-sysincludes = @CXX_SYSINCLUDES@
|
|
|
c6d234 |
all-warnings = @all_warnings@
|
|
|
c6d234 |
+enable-werror = @enable_werror@
|
|
|
c6d234 |
|
|
|
c6d234 |
have-z-combreloc = @libc_cv_z_combreloc@
|
|
|
c6d234 |
have-z-execstack = @libc_cv_z_execstack@
|
|
|
c6d234 |
diff --git a/configure b/configure
|
|
|
c6d234 |
index b185b400dfbc21de..769f0fa149d0ef9c 100755
|
|
|
c6d234 |
--- a/configure
|
|
|
c6d234 |
+++ b/configure
|
|
|
c6d234 |
@@ -660,6 +660,7 @@ build_pt_chown
|
|
|
c6d234 |
build_nscd
|
|
|
c6d234 |
link_obsolete_rpc
|
|
|
c6d234 |
libc_cv_nss_crypt
|
|
|
c6d234 |
+enable_werror
|
|
|
c6d234 |
all_warnings
|
|
|
c6d234 |
force_install
|
|
|
c6d234 |
bindnow
|
|
|
c6d234 |
@@ -758,6 +759,7 @@ enable_static_nss
|
|
|
c6d234 |
enable_force_install
|
|
|
c6d234 |
enable_kernel
|
|
|
c6d234 |
enable_all_warnings
|
|
|
c6d234 |
+enable_werror
|
|
|
c6d234 |
enable_multi_arch
|
|
|
c6d234 |
enable_nss_crypt
|
|
|
c6d234 |
enable_obsolete_rpc
|
|
|
c6d234 |
@@ -1419,6 +1421,7 @@ Optional Features:
|
|
|
c6d234 |
--enable-kernel=VERSION compile for compatibility with kernel not older than
|
|
|
c6d234 |
VERSION
|
|
|
c6d234 |
--enable-all-warnings enable all useful warnings gcc can issue
|
|
|
c6d234 |
+ --disable-werror do not build with -Werror
|
|
|
c6d234 |
--enable-multi-arch enable single DSO with optimizations for multiple
|
|
|
c6d234 |
architectures
|
|
|
c6d234 |
--enable-nss-crypt enable libcrypt to use nss
|
|
|
c6d234 |
@@ -3803,6 +3806,15 @@ fi
|
|
|
c6d234 |
|
|
|
c6d234 |
|
|
|
c6d234 |
|
|
|
c6d234 |
+# Check whether --enable-werror was given.
|
|
|
c6d234 |
+if test "${enable_werror+set}" = set; then :
|
|
|
c6d234 |
+ enableval=$enable_werror; enable_werror=$enableval
|
|
|
c6d234 |
+else
|
|
|
c6d234 |
+ enable_werror=yes
|
|
|
c6d234 |
+fi
|
|
|
c6d234 |
+
|
|
|
c6d234 |
+
|
|
|
c6d234 |
+
|
|
|
c6d234 |
# Check whether --enable-multi-arch was given.
|
|
|
c6d234 |
if test "${enable_multi_arch+set}" = set; then :
|
|
|
c6d234 |
enableval=$enable_multi_arch; multi_arch=$enableval
|
|
|
c6d234 |
diff --git a/configure.in b/configure.in
|
|
|
c6d234 |
index f8c36ba306e01f59..9feb463ddfed2a27 100644
|
|
|
c6d234 |
--- a/configure.in
|
|
|
c6d234 |
+++ b/configure.in
|
|
|
c6d234 |
@@ -234,6 +234,13 @@ AC_ARG_ENABLE([all-warnings],
|
|
|
c6d234 |
[])
|
|
|
c6d234 |
AC_SUBST(all_warnings)
|
|
|
c6d234 |
|
|
|
c6d234 |
+AC_ARG_ENABLE([werror],
|
|
|
c6d234 |
+ AC_HELP_STRING([--disable-werror],
|
|
|
c6d234 |
+ [do not build with -Werror]),
|
|
|
c6d234 |
+ [enable_werror=$enableval],
|
|
|
c6d234 |
+ [enable_werror=yes])
|
|
|
c6d234 |
+AC_SUBST(enable_werror)
|
|
|
c6d234 |
+
|
|
|
c6d234 |
AC_ARG_ENABLE([multi-arch],
|
|
|
c6d234 |
AC_HELP_STRING([--enable-multi-arch],
|
|
|
c6d234 |
[enable single DSO with optimizations for multiple architectures]),
|
|
|
c6d234 |
diff --git a/debug/Makefile b/debug/Makefile
|
|
|
c6d234 |
index e4efd9bcc687e562..6588b6327ae01205 100644
|
|
|
c6d234 |
--- a/debug/Makefile
|
|
|
c6d234 |
+++ b/debug/Makefile
|
|
|
c6d234 |
@@ -89,19 +89,21 @@ CFLAGS-tst-longjmp_chk2.c = -fexceptions -fasynchronous-unwind-tables
|
|
|
c6d234 |
CPPFLAGS-tst-longjmp_chk2.c = -D_FORTIFY_SOURCE=1
|
|
|
c6d234 |
|
|
|
c6d234 |
# We know these tests have problems with format strings, this is what
|
|
|
c6d234 |
-# we are testing. Disable that warning.
|
|
|
c6d234 |
-CFLAGS-tst-chk1.c = -Wno-format
|
|
|
c6d234 |
-CFLAGS-tst-chk2.c = -Wno-format
|
|
|
c6d234 |
-CFLAGS-tst-chk3.c = -Wno-format
|
|
|
c6d234 |
-CFLAGS-tst-chk4.cc = -Wno-format
|
|
|
c6d234 |
-CFLAGS-tst-chk5.cc = -Wno-format
|
|
|
c6d234 |
-CFLAGS-tst-chk6.cc = -Wno-format
|
|
|
c6d234 |
-CFLAGS-tst-lfschk1.c = -Wno-format
|
|
|
c6d234 |
-CFLAGS-tst-lfschk2.c = -Wno-format
|
|
|
c6d234 |
-CFLAGS-tst-lfschk3.c = -Wno-format
|
|
|
c6d234 |
-CFLAGS-tst-lfschk4.cc = -Wno-format
|
|
|
c6d234 |
-CFLAGS-tst-lfschk5.cc = -Wno-format
|
|
|
c6d234 |
-CFLAGS-tst-lfschk6.cc = -Wno-format
|
|
|
c6d234 |
+# we are testing. Disable that warning. They also generate warnings
|
|
|
c6d234 |
+# from warning attributes, which cannot be disabled via pragmas, so
|
|
|
c6d234 |
+# require -Wno-error to be used.
|
|
|
c6d234 |
+CFLAGS-tst-chk1.c = -Wno-format -Wno-error
|
|
|
c6d234 |
+CFLAGS-tst-chk2.c = -Wno-format -Wno-error
|
|
|
c6d234 |
+CFLAGS-tst-chk3.c = -Wno-format -Wno-error
|
|
|
c6d234 |
+CFLAGS-tst-chk4.cc = -Wno-format -Wno-error
|
|
|
c6d234 |
+CFLAGS-tst-chk5.cc = -Wno-format -Wno-error
|
|
|
c6d234 |
+CFLAGS-tst-chk6.cc = -Wno-format -Wno-error
|
|
|
c6d234 |
+CFLAGS-tst-lfschk1.c = -Wno-format -Wno-error
|
|
|
c6d234 |
+CFLAGS-tst-lfschk2.c = -Wno-format -Wno-error
|
|
|
c6d234 |
+CFLAGS-tst-lfschk3.c = -Wno-format -Wno-error
|
|
|
c6d234 |
+CFLAGS-tst-lfschk4.cc = -Wno-format -Wno-error
|
|
|
c6d234 |
+CFLAGS-tst-lfschk5.cc = -Wno-format -Wno-error
|
|
|
c6d234 |
+CFLAGS-tst-lfschk6.cc = -Wno-format -Wno-error
|
|
|
c6d234 |
LDLIBS-tst-chk4 = -lstdc++
|
|
|
c6d234 |
LDLIBS-tst-chk5 = -lstdc++
|
|
|
c6d234 |
LDLIBS-tst-chk6 = -lstdc++
|
|
|
c6d234 |
diff --git a/manual/install.texi b/manual/install.texi
|
|
|
c6d234 |
index 7fe6e005c3fdd5fb..3799cee621ddc4f9 100644
|
|
|
c6d234 |
--- a/manual/install.texi
|
|
|
c6d234 |
+++ b/manual/install.texi
|
|
|
c6d234 |
@@ -177,6 +177,13 @@ you understand and accept those risks.
|
|
|
c6d234 |
@item --enable-lock-elision=yes
|
|
|
c6d234 |
Enable lock elision for pthread mutexes by default.
|
|
|
c6d234 |
|
|
|
c6d234 |
+@item --disable-werror
|
|
|
c6d234 |
+By default, @theglibc{} is built with @option{-Werror}. If you wish
|
|
|
c6d234 |
+to build without this option (for example, if building with a newer
|
|
|
c6d234 |
+version of GCC than this version of @theglibc{} was tested with, so
|
|
|
c6d234 |
+new warnings cause the build with @option{-Werror} to fail), you can
|
|
|
c6d234 |
+configure with @option{--disable-werror}.
|
|
|
c6d234 |
+
|
|
|
c6d234 |
@item --build=@var{build-system}
|
|
|
c6d234 |
@itemx --host=@var{host-system}
|
|
|
c6d234 |
These options are for cross-compiling. If you specify both options and
|