[COMMITTED] Fix setenv.c diagnostic pragma to be compatible with GCC 4.6

Message ID 20150602200030.94E542C3AB9@topped-with-meat.com
State Committed
Headers

Commit Message

Roland McGrath June 2, 2015, 8 p.m. UTC
  2015-06-02  Roland McGrath  <roland@hack.frob.com>

	* stdlib/setenv.c [__GNUC__,__GNUC_MINOR__ < 4,7]: Use
	"-Wuninitialized" rather than "-Wmaybe-uninitialized" in pragma.
  

Comments

Andreas Schwab June 2, 2015, 8:35 p.m. UTC | #1
Roland McGrath <roland@hack.frob.com> writes:

> +#if ((__GNUC__ << 16) + __GNUC_MINOR__) >= ((4 << 16) + 7)
       __GNUC_PREREQ (4, 7)

Andreas.
  
Roland McGrath June 5, 2015, 9:04 p.m. UTC | #2
> > +#if ((__GNUC__ << 16) + __GNUC_MINOR__) >= ((4 << 16) + 7)
>        __GNUC_PREREQ (4, 7)

Other comments in the file gave me the impression that the pragma needs to
come before header includes (hence why it's not using the preferred macro
DIAG_IGNORE_NEEDS_COMMENT).
  

Patch

diff --git a/stdlib/setenv.c b/stdlib/setenv.c
index 184a8cd..b9e0ba8 100644
--- a/stdlib/setenv.c
+++ b/stdlib/setenv.c
@@ -24,7 +24,11 @@ 
    there seems to be no way to pacify GCC selectively, only for the
    place where it's needed.  Do not use DIAG_IGNORE_NEEDS_COMMENT
    here, as it's not defined yet.  */
-#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#if ((__GNUC__ << 16) + __GNUC_MINOR__) >= ((4 << 16) + 7)
+# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
+#else
+# pragma GCC diagnostic ignored "-Wuninitialized"
+#endif
 
 #include <errno.h>
 #if !_LIBC