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]

Re: [Patch] Warning during GCC bootstrap on i686-pc-mingw32


On Wed, Apr 16, 2008 at 9:40 PM, Kai Tietz <Kai.Tietz@onevision.com> wrote:
> "Danny Smith" <dansmister@gmail.com> wrote on 16.04.2008 03:52:18:
>
>
>
>  > As noted in
>  > http://gcc.gnu.org/ml/gcc/2008-04/msg00371.html
>  >
>  > the pedantic warning for the use of "I64" printf length specifier
>  > "../../src/gcc/cfg.c:540: warning: ISO C does not support the ''
>  > ms_printf length modifier"
>  > is wrong.
>  >
>  > The problem is in the use of '\0' as a prefix to flag multichar length
>  > specs string.
>  >
>  > This patch gets rid of the use of a terminator as a prefix and simply
>  > uses strncmp to handle
>  > the comparison .
>  >
>  > Tested i686-pc-mingw32.
>  >
>  > OK for trunk?
>  >
>  > 2008-04-16  Danny Smith  <dannysmith@users.net>
>  >
>  >    * c-format.c (check_format_info_main): Use strncmp rather than a
>  > magic prefix
>  >    to handle multichar length specs.
>  >    * config/i386/msformat-c.c (format_length_info
>  ms_printf_length_specs):
>  >    Don't prefix "I64" and "I32" with '\0'.
>  >
>  > Index: c-format.c
>  > ===================================================================
>  > --- c-format.c   (revision 134294)
>  > +++ c-format.c   (working copy)
>  > @@ -1779,26 +1779,12 @@
>  >        length_chars_std = STD_C89;
>  >        if (fli)
>  >     {
>  > -     while (fli->name != 0 && fli->name[0] != *format_chars)
>  > -       {
>  > -         if (fli->name[0] == '\0')
>  > -      {
>  > -        int si  = strlen (fli->name + 1) + 1;
>  > -        int i = 1;
>  > -        while (fli->name[i] != 0 && fli->name[i] == format_chars [i -
>  1])
>  > -          ++i;
>  > -       if (si == i)
>  > -         {
>  > -           if (si > 2)
>  > -             format_chars += si - 2;
>  > -           break;
>  > -         }
>  > -          }
>  > +     while (fli->name != 0
>  > +        && strncmp (fli->name, format_chars, strlen (fli->name)))
>  >           fli++;
>  > -       }
>  >       if (fli->name != 0)
>  >         {
>  > -         format_chars++;
>  > +          format_chars += strlen (fli->name);
>  >           if (fli->double_name != 0 && fli->name[0] == *format_chars)
>  >        {
>  >          format_chars++;
>  > Index: config/i386/msformat-c.c
>  > ===================================================================
>  > --- config/i386/msformat-c.c   (revision 134294)
>  > +++ config/i386/msformat-c.c   (working copy)
>  > @@ -38,8 +38,8 @@
>  >  {
>  >    { "h", FMT_LEN_h, STD_C89, NULL, 0, 0 },
>  >    { "l", FMT_LEN_l, STD_C89, NULL, 0, 0 },
>  > -  { "\0I32", FMT_LEN_l, STD_EXT, NULL, 0, 0 },
>  > -  { "\0I64", FMT_LEN_ll, STD_EXT, NULL, 0, 0 },
>  > +  { "I32", FMT_LEN_l, STD_EXT, NULL, 0, 0 },
>  > +  { "I64", FMT_LEN_ll, STD_EXT, NULL, 0, 0 },
>  >    { "I", FMT_[PatchLEN_L, STD_EXT, NULL, 0, 0 },
>  >    { NULL, 0, 0, NULL, 0, 0 }
>  >  };
>  >
>
>  AFAICS does this patch won't work. Because it breaks as example "l"/"ll"
>  checking in default case (gnu_printf).

Testcase results with my patch show no breakage.

make -k check-gcc  RUNTESTFLAGS="format.exp"

		=== gcc Summary ===

# of expected passes		3958
# of unsupported tests		12

/develop/svn/trunk/build/gcc/xgcc  version 4.4.0 20080414 (experimental) (GCC)

Danny


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