]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c/32102 (-Wall stomps on -Wstrict-overflow)
authorManuel López-Ibáñez <manu@gcc.gnu.org>
Tue, 22 Jan 2008 14:11:44 +0000 (14:11 +0000)
committerManuel López-Ibáñez <manu@gcc.gnu.org>
Tue, 22 Jan 2008 14:11:44 +0000 (14:11 +0000)
2008-01-22  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>

        PR 32102
        * doc/invoke.texi (-Wall): -Wall enables -Wstrict-overflow=1.
        * flags.h (warn_strict_aliasing): Remove.
        (warn_strict_overflow): Remove.
        * opts.c (warn_strict_aliasing): Remove.
        (warn_strict_overflow): Remove.
        * c-opts.c (c_common_handle_option): -Wall only sets
        -Wstrict-aliasing or -Wstrict-overflow if they are uninitialized.
        (c_common_post_options): Give default values to -Wstrict-aliasing
        and -Wstrict-overflow if they are uninitialized.
        * common.opt (Wstrict-aliasing): Specify Var and Init.
        (Wstrict-overflow): Likewise.

testsuite/
        * gcc.dg/Wstrict-overflow-21.c: New.
        * g++.dg/warn/Wstrict-aliasing-8.C: New.

From-SVN: r131720

gcc/ChangeLog
gcc/c-opts.c
gcc/common.opt
gcc/doc/invoke.texi
gcc/flags.h
gcc/opts.c
gcc/testsuite/ChangeLog

index 639b0fbedcd3b80969c49b2e0d4091a4f7cba75d..bc76be76da41992e02bedbe1da43bf6260102d2e 100644 (file)
@@ -1,3 +1,18 @@
+2008-01-22  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
+
+       PR 32102
+       * doc/invoke.texi (-Wall): -Wall enables -Wstrict-overflow=1.
+       * flags.h (warn_strict_aliasing): Remove.
+       (warn_strict_overflow): Remove.
+       * opts.c (warn_strict_aliasing): Remove.
+       (warn_strict_overflow): Remove.
+       * c-opts.c (c_common_handle_option): -Wall only sets
+       -Wstrict-aliasing or -Wstrict-overflow if they are uninitialized.
+       (c_common_post_options): Give default values to -Wstrict-aliasing
+       and -Wstrict-overflow if they are uninitialized.
+       * common.opt (Wstrict-aliasing): Specify Var and Init.
+       (Wstrict-overflow): Likewise.
+
 2008-01-22  Kenneth Zadeck <zadeck@naturalbridge.com>
 
        PR rtl-optimization/26854
index ee9b7acc713dcc5b4ecfd26ed0478b0d4d1ce7d0..4cb76872be3f98e63ea0f49011cf4581c3e65b84 100644 (file)
@@ -401,9 +401,11 @@ c_common_handle_option (size_t scode, const char *arg, int value)
       warn_return_type = value;
       warn_sequence_point = value;     /* Was C only.  */
       warn_switch = value;
-      set_Wstrict_aliasing (value);
+      if (warn_strict_aliasing == -1)
+       set_Wstrict_aliasing (value);
       warn_address = value;
-      warn_strict_overflow = value;
+      if (warn_strict_overflow == -1)
+       warn_strict_overflow = value;
       warn_array_bounds = value;
 
       /* Only warn about unknown pragmas that are not in system
@@ -1090,6 +1092,11 @@ c_common_post_options (const char **pfilename)
   if (warn_pointer_sign == -1)
     warn_pointer_sign = 0;
 
+  if (warn_strict_aliasing == -1)
+    warn_strict_aliasing = 0;
+  if (warn_strict_overflow == -1)
+    warn_strict_overflow = 0;
+
   /* -Woverlength-strings is off by default, but is enabled by -pedantic.
      It is never enabled in C++, as the minimum limit is not normative
      in that standard.  */
index 5c659e4d3079dff67150df74b19c00fad9a8fe24..810f879fe48a5a70bc6a23c81d430f474c31e467 100644 (file)
@@ -155,7 +155,7 @@ Common Warning
 Warn about code which might break strict aliasing rules
 
 Wstrict-aliasing=
-Common Joined UInteger Warning
+Common Joined UInteger Var(warn_strict_aliasing) Init(-1) Warning
 Warn about code which might break strict aliasing rules
 
 Wstrict-overflow
@@ -163,7 +163,7 @@ Common Warning
 Warn about optimizations that assume that signed overflow is undefined
 
 Wstrict-overflow=
-Common Joined UInteger Warning
+Common Joined UInteger Var(warn_strict_overflow) Init(-1) Warning
 Warn about optimizations that assume that signed overflow is undefined
 
 Wswitch
index a41f9725f380d7916281b81b6b085b21eeabd539..6b145532ff4caab41e56b17829bf30de2af0e7e3 100644 (file)
@@ -2649,7 +2649,7 @@ Options} and @ref{Objective-C and Objective-C++ Dialect Options}.
 -Wsequence-point  @gol
 -Wsign-compare @r{(only in C++)}  @gol
 -Wstrict-aliasing  @gol
--Wstrict-overflow  @gol
+-Wstrict-overflow=1  @gol
 -Wswitch  @gol
 -Wtrigraphs  @gol
 -Wuninitialized @r{(only with} @option{-O1} @r{and above)}  @gol
index d52d030a0d7d8eabdaee7b137ed69033b9394e75..e3174732995912204f6efd8bccd791ec13e83ede 100644 (file)
@@ -137,16 +137,6 @@ extern void set_Wstrict_aliasing (int onoff);
 extern bool warn_larger_than;
 extern HOST_WIDE_INT larger_than_size;
 
-/* Nonzero means warn about constructs which might not be strict
-   aliasing safe.  */
-
-extern int warn_strict_aliasing;
-
-/* Nonzero means warn about optimizations which rely on undefined
-   signed overflow.  */
-
-extern int warn_strict_overflow;
-
 /* Temporarily suppress certain warnings.
    This is set while reading code from a system header file.  */
 
index 5d952c6304e1db8fc1c38cdc016154f3883daa53..16ca6bf81ab8c3bad3f1142de68875973b118c90 100644 (file)
@@ -58,14 +58,6 @@ bool extra_warnings;
 bool warn_larger_than;
 HOST_WIDE_INT larger_than_size;
 
-/* Nonzero means warn about constructs which might not be
-   strict-aliasing safe.  */
-int warn_strict_aliasing;
-
-/* Nonzero means warn about optimizations which rely on undefined
-   signed overflow.  */
-int warn_strict_overflow;
-
 /* Hack for cooperation between set_Wunused and set_Wextra.  */
 static bool maybe_warn_unused_parameter;
 
index 1c9c54c9b967932fe80a6a1443938fbd7319c5ca..9a6eb68daab25da7a914c054d45cb4221cdde38a 100644 (file)
@@ -1,3 +1,9 @@
+2008-01-22  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
+
+       PR 32102
+       * gcc.dg/Wstrict-overflow-21.c: New.
+       * g++.dg/warn/Wstrict-aliasing-8.C: New.
+
 2008-01-22  Manuel Lopez-Ibanez  <manu@gcc.gnu.org>
 
        PR middle-end/33092