c-common.c (print_char_table): Add entries for the X/Open ' format flag (print decima...
authorJoseph Myers <jsm28@cam.ac.uk>
Sat, 5 Aug 2000 18:31:15 +0000 (19:31 +0100)
committerJoseph Myers <jsm28@gcc.gnu.org>
Sat, 5 Aug 2000 18:31:15 +0000 (19:31 +0100)
* c-common.c (print_char_table): Add entries for the X/Open '
format flag (print decimals with locale's thousands grouping
character).  Make %C expect wint_t.
(check_format_info): If pedantic, warn when the %n$ operand
number form is used.  Allow for the ' flag; warn about it if
pedantic.

From-SVN: r35507

gcc/ChangeLog
gcc/c-common.c

index 78006cf794aff2fc03b4c34718a680c98d882688..b9c6caf048534ab5344e2af55f463481a951fe24 100644 (file)
@@ -1,3 +1,12 @@
+2000-08-05  Joseph S. Myers  <jsm28@cam.ac.uk>
+
+       * c-common.c (print_char_table): Add entries for the X/Open '
+       format flag (print decimals with locale's thousands grouping
+       character).  Make %C expect wint_t.
+       (check_format_info): If pedantic, warn when the %n$ operand
+       number form is used.  Allow for the ' flag; warn about it if
+       pedantic.
+
 2000-08-05  Zack Weinberg  <zack@wolery.cumb.org>
 
        * i386.h (FUNCTION_OK_FOR_SIBCALL):  Not OK if DECL's return
index 0814c4d125ad3cf49617cbd27869f4c8979b4349..64df897524f4412dc136df8b0e6bb5ad8352a019 100644 (file)
@@ -1233,14 +1233,15 @@ typedef struct {
 } format_char_info;
 
 static format_char_info print_char_table[] = {
-  { "di",      0,      T_I,    T_I,    T_I,    T_L,    T_LL,   T_LL,   T_ST,   T_PD,   T_IM,   "-wp0 +       },
+  { "di",      0,      T_I,    T_I,    T_I,    T_L,    T_LL,   T_LL,   T_ST,   T_PD,   T_IM,   "-wp0 +'"       },
   { "oxX",     0,      T_UI,   T_UI,   T_UI,   T_UL,   T_ULL,  T_ULL,  T_ST,   T_PD,   T_UIM,  "-wp0#"         },
-  { "u",       0,      T_UI,   T_UI,   T_UI,   T_UL,   T_ULL,  T_ULL,  T_ST,   T_PD,   T_UIM,  "-wp0         },
+  { "u",       0,      T_UI,   T_UI,   T_UI,   T_UL,   T_ULL,  T_ULL,  T_ST,   T_PD,   T_UIM,  "-wp0'"         },
 /* A GNU extension.  */
   { "m",       0,      T_V,    NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   "-wp"           },
-  { "fFeEgGaA",        0,      T_D,    NULL,   NULL,   T_D,    NULL,   T_LD,   NULL,   NULL,   NULL,   "-wp0 +#"       },
+  { "fFgG",    0,      T_D,    NULL,   NULL,   T_D,    NULL,   T_LD,   NULL,   NULL,   NULL,   "-wp0 +#'"      },
+  { "eEaA",    0,      T_D,    NULL,   NULL,   T_D,    NULL,   T_LD,   NULL,   NULL,   NULL,   "-wp0 +#"       },
   { "c",       0,      T_I,    NULL,   NULL,   T_WI,   NULL,   NULL,   NULL,   NULL,   NULL,   "-w"            },
-  { "C",       0,      T_W   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   "-w"            },
+  { "C",       0,      T_WI,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   "-w"            },
   { "s",       1,      T_C,    NULL,   NULL,   T_W,    NULL,   NULL,   NULL,   NULL,   NULL,   "-wp"           },
   { "S",       1,      T_W,    NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   "-wp"           },
   { "p",       1,      T_V,    NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   NULL,   "-w"            },
@@ -1699,6 +1700,9 @@ check_format_info (info, params)
                {
                  int opnum = atoi (format_chars);
 
+                 if (pedantic)
+                   warning ("ANSI C does not support printf %%n$");
+
                  params = first_fillin_param;
                  format_chars = p + 1;
                  has_operand_number = 1;
@@ -1714,7 +1718,7 @@ check_format_info (info, params)
                }
            }
 
-         while (*format_chars != 0 && index (" +#0-", *format_chars) != 0)
+         while (*format_chars != 0 && index (" +#0-'", *format_chars) != 0)
            {
              if (index (flag_chars, *format_chars) != 0)
                warning ("repeated `%c' flag in format", *format_chars++);
@@ -1735,6 +1739,8 @@ check_format_info (info, params)
          if (index (flag_chars, '0') != 0
              && index (flag_chars, '-') != 0)
            warning ("use of both `0' and `-' flags in format");
+         if (index (flag_chars, '\'') && pedantic)
+           warning ("ANSI C does not support the `'' format flag");
          if (*format_chars == '*')
            {
              wide = TRUE;