(check_format): Using both a precision and the `0' flag is only a problem on `d'...
authorRichard Kenner <kenner@gcc.gnu.org>
Sat, 26 Dec 1992 23:11:58 +0000 (18:11 -0500)
committerRichard Kenner <kenner@gcc.gnu.org>
Sat, 26 Dec 1992 23:11:58 +0000 (18:11 -0500)
(check_format): Using both a precision and the `0' flag is only a
problem on `d', `i', `o', `u', `x', and `X' conversions.

From-SVN: r2915

gcc/c-typeck.c

index dfde12e551332a76736d0f41d42b766e5d6c6e0a..46e6dac09444865bb5821c4e7f41d49ec6388f87 100644 (file)
@@ -1556,11 +1556,6 @@ check_format (info, params)
          if (*format_chars == '.')
            {
              precise = TRUE;
-             /* "For d, i, o, u, x, and X conversions,
-                if a precision is specified, the 0 flag will be ignored.
-                For other conversions, the behavior is undefined."  */
-             if (index (flag_chars, '0') != 0)
-               warning ("precision and `0' flag both used in one %%-sequence");
              ++format_chars;
              if (*format_chars != '*' && !ISDIGIT (*format_chars))
                warning ("`.' not followed by `*' or digit in format");
@@ -1667,6 +1662,16 @@ check_format (info, params)
              warning (message);
            }
        }
+      if (precise && index (flag_chars, '0') != 0
+         && (format_char == 'd' || format_char == 'i'
+             || format_char == 'o' || format_char == 'u'
+             || format_char == 'x' || format_char == 'x'))
+       {
+         sprintf (message,
+                  "precision and `0' flag not both allowed with `%c' format",
+                  format_char);
+         warning (message);
+       }
       switch (length_char)
        {
        default: wanted_type = fci->nolen ? *(fci->nolen) : 0; break;