Ping - old patch from April - mingw support for I32/I64 MS printf formatters to c-format.c
Kai Tietz
Kai.Tietz@onevision.com
Tue Mar 18 13:20:00 GMT 2008
Hi Danny,
"Danny Smith" <dansmister@gmail.com> wrote on 16.03.2008 06:32:03:
> On Fri, Mar 14, 2008 at 11:55 PM, Kai Tietz <Kai.Tietz@onevision.com> w
> > Thank you for the log file. I correct the tested cases so far. The
major
> > problem is that by your suggestion 'I64' length specifier isn't
treated as
> > equivalent to the gnu 'll' length sepecifier. This is the reason for
the
> > failure of a lot of warnings. I let the test-case ms_warnll-1.c as it
is
> > for showing the issue. I64 and co are declared as STD_EXT, which is
in my
> > opinion not correct. They should be set as STD_C890 IMHO.
I mean STD_C890 is STD_C89. I removed from the testcase ms_warnll-1.c the
-std settings to let the test pass. We should test I64.
I attached the revised patch.
> As I indicated earlier, handling of ms_strftime was and still is
incorrect.
>
> With your patch and this snippet:
>
> #include <time.h>
> #include <stdio.h>
> #include <sys/types.h>
>
> int main()
> {
> char buf[128];
> time_t ltime;
> struct tm* today;
>
> time (<ime);
> today = localtime(<ime);
>
> printf ("c, x, y, formats\n");
> strftime (buf, 128, "c: %c\n", today);
> printf (buf);
> strftime (buf, 128, "x: %x\n", today);
> printf (buf);
> strftime (buf, 128, "y: %y\n", today);
> printf (buf);
>
>
> printf ("Alternative #c, #x, #y, formats\n");
> strftime (buf, 128, "#c %#c\n", today);
> printf (buf);
> strftime (buf, 128, "#x %#x\n", today);
> printf (buf);
> strftime (buf, 128, "#y %#y\n", today);
> printf (buf);
>
> return 0;
> }
>
> compiled as
>
> gcc -Wall -Wformat-y2k ms_stftrime_y2k.c
>
> I get:
>
> ms_stftrime_y2k.c: In function 'main':
> ms_stftrime_y2k.c:24: warning: '#' flag used with '%c' ms_strftime
format
> ms_stftrime_y2k.c: warning: '#' flag used with '%x' ms_strftime format
> ms_stftrime_y2k.c:28: warning: '#' flag used with '%y' ms_strftime
format
>
> 1) The warnings are bogus.
> 2) There are no y2k warnings, but there should be, because this is
> the output:
>
> c, x, y, formats
> c: 03/16/08 16:05:38
> x: 03/16/08
> y: 08
> Alternative #c, #x, #y, formats
> #c Sunday, March 16, 2008 16:05:38
> #x Sunday, March 16, 2008
> #y 8
>
>
> Note that '#' does not have glibc meaning. Instead, when prefixing c
> and x flags, is like 'E'.
I corrected this as general option with type of STD_EXT and add the y2k
check to cxy format specifiers.
Cheers,
Kai
| (\_/) This is Bunny. Copy and paste Bunny
| (='.'=) into your signature to help him gain
| (")_(") world domination.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: mingw-msformat.txt
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20080318/8e94442f/attachment.txt>
More information about the Gcc-patches
mailing list