This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
silence some -Wc++-compat warnings
authorDavid Mitchell <davem@iabyn.com>
Fri, 19 Jun 2015 12:41:42 +0000 (13:41 +0100)
committerDavid Mitchell <davem@iabyn.com>
Fri, 19 Jun 2015 12:43:45 +0000 (13:43 +0100)
The initialisers for PL_inf and PL_nan disabled -Wc++-compat warnings for
some ifdef branches but not others. Expand the scope of the
GCC_DIAG_IGNORE() to all cases.

perl.h

diff --git a/perl.h b/perl.h
index 5c2607d..fdbad6a 100644 (file)
--- a/perl.h
+++ b/perl.h
@@ -5551,13 +5551,13 @@ EXTCONST bool PL_valid_types_NV_set[];
  * falsely misoptimize that to zero (x-x is always zero, right?)
  */
 
+/* The quadmath literals are anon structs which -Wc++-compat doesn't like. */
+GCC_DIAG_IGNORE(-Wc++-compat);
+
 #  ifdef USE_QUADMATH
 /* Cannot use HUGE_VALQ for PL_inf because not a compile-time
- * constant.  Also, the quadmath literals are anon structs which
- * -Wc++-compat doesn't like. */
-GCC_DIAG_IGNORE(-Wc++-compat);
+ * constant. */
 INFNAN_NV_U8_DECL PL_inf = { 1.0Q/0.0Q };
-GCC_DIAG_RESTORE;
 #  elif NVSIZE == LONG_DOUBLESIZE && defined(LONGDBLINFBYTES)
 INFNAN_U8_NV_DECL PL_inf = { { LONGDBLINFBYTES } };
 #  elif NVSIZE == DOUBLESIZE && defined(DOUBLEINFBYTES)
@@ -5592,11 +5592,8 @@ INFNAN_NV_U8_DECL PL_inf = { 1.0/0.0 }; /* keep last */
 
 #  ifdef USE_QUADMATH
 /* Cannot use nanq("0") for PL_nan because not a compile-time
- * constant.  Also, the quadmath literals are anon structs which
- * -Wc++-compat doesn't like. */
-GCC_DIAG_IGNORE(-Wc++-compat);
+ * constant. */
 INFNAN_NV_U8_DECL PL_nan = { 0.0Q/0.0Q };
-GCC_DIAG_RESTORE;
 #  elif NVSIZE == LONG_DOUBLESIZE && defined(LONGDBLNANBYTES)
 INFNAN_U8_NV_DECL PL_nan = { { LONGDBLNANBYTES } };
 #  elif NVSIZE == DOUBLESIZE && defined(DOUBLENANBYTES)
@@ -5625,6 +5622,8 @@ INFNAN_NV_U8_DECL PL_nan = { 0.0/0.0 }; /* keep last */
 #    endif
 #  endif
 
+GCC_DIAG_RESTORE;
+
 #else
 
 INFNAN_NV_U8_DECL PL_inf;