public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
* Re: c/3190: -Wformat-y2k doesn't belong to -Wall - it's hard to avoid
@ 2001-06-15 12:09 jsm28
  0 siblings, 0 replies; 2+ messages in thread
From: jsm28 @ 2001-06-15 12:09 UTC (permalink / raw)
  To: gcc-bugs, gcc-prs, jsm28, jsm28, nobody, proski

Synopsis: -Wformat-y2k doesn't belong to -Wall - it's hard to avoid

Responsible-Changed-From-To: unassigned->jsm28
Responsible-Changed-By: jsm28
Responsible-Changed-When: Fri Jun 15 12:09:21 2001
Responsible-Changed-Why:
    Mine once the appropriate solution is worked out.
State-Changed-From-To: open->analyzed
State-Changed-By: jsm28
State-Changed-When: Fri Jun 15 12:09:21 2001
State-Changed-Why:
    There are three separate cases here:
    
    * Those that use 2-digit years in all locales (%D, %g, %y).
    * Those that use 2-digit years in some locales, depending
    on the system (%c, %x).
    * Those that use 2-digit years in some locales, including
    the C locale (%Ey).
    
    I think at least the first of these does belong in -Wall
    (those formats don't depend on locale, so if you really
    want 2-digit years you can emulate them within ISO C).
    I'll await comments from the maintainers of NetBSD's GCC
    (which is where the option -Wno-format-y2k originated)
    as I think they have wanted to remove the Y2K warnings from
    -Wall as well.

http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view&pr=3190&database=gcc


^ permalink raw reply	[flat|nested] 2+ messages in thread

* c/3190: -Wformat-y2k doesn't belong to -Wall - it's hard to avoid
@ 2001-06-14 22:56 proski
  0 siblings, 0 replies; 2+ messages in thread
From: proski @ 2001-06-14 22:56 UTC (permalink / raw)
  To: gcc-gnats

>Number:         3190
>Category:       c
>Synopsis:       -Wformat-y2k doesn't belong to -Wall - it's hard to avoid
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          rejects-legal
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 14 22:56:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     proski@gnu.org
>Release:        gcc-3_0-branch CVS
>Organization:
>Environment:
RedHat Linux 7.1, i586 (K6-2)
>Description:
-Wall assumes -Wformat which in turn includes -Wformat-y2k

invoke.texi says:
-Wall ... enables all the warnings ... that are easy to avoid (or modify to prevent the warning)

The warning is:
`%c' yields only last 2 digits of year in some locales

No method is suggested to avoid the warning. I really want to use what the user prefers by setting locale. It's a user visible string.

I fail to see how this is "easy to avoid" without sacrificing some functionality.
>How-To-Repeat:
$ cat >test.c <<EOF
int main()
{
    strftime (NULL, 0, "%c", NULL);
    return 0;
}
EOF
$ gcc -c -Wall test.c
===> test.c:4: warning: `%c' yields only last 2 digits of year in some locales
>Fix:
(Very incomplete!!! Documentation should be changed in several places)
--- c-format.c
+++ c-format.c
@@ -59,12 +59,12 @@ set_Wformat (setting)
      int setting;
 {
   warn_format = setting;
-  warn_format_y2k = setting;
   warn_format_extra_args = setting;
   if (setting != 1)
     {
       warn_format_nonliteral = setting;
       warn_format_security = setting;
+      warn_format_y2k = setting;
     }
 }
 
>Release-Note:
>Audit-Trail:
>Unformatted:


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2001-06-15 12:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-06-15 12:09 c/3190: -Wformat-y2k doesn't belong to -Wall - it's hard to avoid jsm28
  -- strict thread matches above, loose matches on Subject: below --
2001-06-14 22:56 proski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).