This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch to remove -Wformat-y2k from -Wall


By popular demand, and lack of any feedback on suitable more detailed
options for the various cases involved (some of which might fit within
the definition of -Wall while others might not), this patch moves
-Wformat-y2k out of -Wformat.

Bootstrapped with no regressions on i686-pc-linux-gnu.  Applied to
mainline.  People checking for potential Y2.1K problems will now need
to add -Wformat-y2k to their options.

2003-11-08  Joseph S. Myers  <jsm@polyomino.org.uk>

	PR c/3190
	PR c/8714
	* c-format.c (set_Wformat): Do not enable -Wformat-y2k by default.
	* invoke.texi: Update.

2003-11-08  Joseph S. Myers  <jsm@polyomino.org.uk>

	PR c/3190
	PR c/8714
	* gcc.dg/format/c90-strftime-1.c, gcc.dg/format/c90-strftime-2.c,
	gcc.dg/format/c99-strftime-1.c, gcc.dg/format/ext3.c,
	gcc.dg/format/no-y2k-1.c: Update.

--- GCC/gcc/c-format.c.orig	2003-10-04 07:29:09.000000000 +0000
+++ GCC/gcc/c-format.c	2003-11-08 14:25:43.000000000 +0000
@@ -37,13 +37,13 @@ void
 set_Wformat (int setting)
 {
   warn_format = setting;
-  warn_format_y2k = setting;
   warn_format_extra_args = setting;
   warn_format_zero_length = setting;
   if (setting != 1)
     {
       warn_format_nonliteral = setting;
       warn_format_security = setting;
+      warn_format_y2k = setting;
     }
   /* Make sure not to disable -Wnonnull if -Wformat=0 is specified.  */
   if (setting)
--- GCC/gcc/doc/invoke.texi.orig	2003-11-04 12:55:02.000000000 +0000
+++ GCC/gcc/doc/invoke.texi	2003-11-08 14:26:34.000000000 +0000
@@ -218,7 +218,7 @@
 -Werror  -Werror-implicit-function-declaration @gol
 -Wfloat-equal  -Wformat  -Wformat=2 @gol
 -Wno-format-extra-args -Wformat-nonliteral @gol
--Wformat-security  -Wno-format-y2k @gol
+-Wformat-security  -Wformat-y2k @gol
 -Wimplicit  -Wimplicit-function-declaration  -Wimplicit-int @gol
 -Wimport  -Wno-import  -Winit-self  -Winline @gol
 -Wno-invalid-offsetof  -Winvalid-pch @gol
@@ -2125,14 +2125,14 @@
 several functions, @option{-Wformat} also implies @option{-Wnonnull}.
 
 @option{-Wformat} is included in @option{-Wall}.  For more control over some
-aspects of format checking, the options @option{-Wno-format-y2k},
+aspects of format checking, the options @option{-Wformat-y2k},
 @option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
 @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
 @option{-Wformat=2} are available, but are not included in @option{-Wall}.
 
-@item -Wno-format-y2k
-@opindex Wno-format-y2k
-If @option{-Wformat} is specified, do not warn about @code{strftime}
+@item -Wformat-y2k
+@opindex Wformat-y2k
+If @option{-Wformat} is specified, also warn about @code{strftime}
 formats which may yield only a two-digit year.
 
 @item -Wno-format-extra-args
@@ -2176,7 +2176,7 @@
 @opindex Wformat=2
 Enable @option{-Wformat} plus format checks not included in
 @option{-Wformat}.  Currently equivalent to @samp{-Wformat
--Wformat-nonliteral -Wformat-security}.
+-Wformat-nonliteral -Wformat-security -Wformat-y2k}.
 
 @item -Wnonnull
 @opindex Wnonnull
--- GCC/gcc/testsuite/gcc.dg/format/c90-strftime-1.c.orig	2001-01-07 10:41:52.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/format/c90-strftime-1.c	2003-11-08 14:25:13.000000000 +0000
@@ -1,7 +1,7 @@
 /* Test for strftime formats.  Formats using C90 features.  */
 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
 /* { dg-do compile } */
-/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */
+/* { dg-options "-std=iso9899:1990 -pedantic -Wformat -Wformat-y2k" } */
 
 #include "format.h"
 
--- GCC/gcc/testsuite/gcc.dg/format/c90-strftime-2.c.orig	2001-01-07 10:41:52.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/format/c90-strftime-2.c	2003-11-08 14:25:21.000000000 +0000
@@ -2,7 +2,7 @@
    pedantic C90 mode.  */
 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
 /* { dg-do compile } */
-/* { dg-options "-std=iso9899:1990 -pedantic -Wformat" } */
+/* { dg-options "-std=iso9899:1990 -pedantic -Wformat -Wformat-y2k" } */
 
 #include "format.h"
 
--- GCC/gcc/testsuite/gcc.dg/format/c99-strftime-1.c.orig	2001-01-07 10:41:52.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/format/c99-strftime-1.c	2003-11-08 14:25:06.000000000 +0000
@@ -1,7 +1,7 @@
 /* Test for strftime formats.  Formats using C99 features.  */
 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
 /* { dg-do compile } */
-/* { dg-options "-std=iso9899:1999 -pedantic -Wformat" } */
+/* { dg-options "-std=iso9899:1999 -pedantic -Wformat -Wformat-y2k" } */
 
 #include "format.h"
 
--- GCC/gcc/testsuite/gcc.dg/format/ext-3.c.orig	2001-01-07 10:41:52.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/format/ext-3.c	2003-11-08 14:24:57.000000000 +0000
@@ -3,7 +3,7 @@
 */
 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
 /* { dg-do compile } */
-/* { dg-options "-std=gnu99 -Wformat" } */
+/* { dg-options "-std=gnu99 -Wformat -Wformat-y2k" } */
 
 #include "format.h"
 
--- GCC/gcc/testsuite/gcc.dg/format/no-y2k-1.c.orig	2001-01-07 10:41:52.000000000 +0000
+++ GCC/gcc/testsuite/gcc.dg/format/no-y2k-1.c	2003-11-08 14:24:42.000000000 +0000
@@ -1,7 +1,7 @@
-/* Test for warnings for Y2K problems being disabled by -Wno-format-y2k.  */
+/* Test for warnings for Y2K problems not being on by default.  */
 /* Origin: Joseph Myers <jsm28@cam.ac.uk> */
 /* { dg-do compile } */
-/* { dg-options "-std=gnu99 -Wformat -Wno-format-y2k" } */
+/* { dg-options "-std=gnu99 -Wformat" } */
 
 #include "format.h"
 

-- 
Joseph S. Myers
jsm@polyomino.org.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]