Blame SOURCES/glibc-rh1505492-werror-activate.patch

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