Commit 8d162cab by Richard Kenner

(check_format): Using both a precision and the `0' flag is only a problem on `d'...

(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
parent eae957a8
...@@ -1556,11 +1556,6 @@ check_format (info, params) ...@@ -1556,11 +1556,6 @@ check_format (info, params)
if (*format_chars == '.') if (*format_chars == '.')
{ {
precise = TRUE; 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; ++format_chars;
if (*format_chars != '*' && !ISDIGIT (*format_chars)) if (*format_chars != '*' && !ISDIGIT (*format_chars))
warning ("`.' not followed by `*' or digit in format"); warning ("`.' not followed by `*' or digit in format");
...@@ -1667,6 +1662,16 @@ check_format (info, params) ...@@ -1667,6 +1662,16 @@ check_format (info, params)
warning (message); 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) switch (length_char)
{ {
default: wanted_type = fci->nolen ? *(fci->nolen) : 0; break; default: wanted_type = fci->nolen ? *(fci->nolen) : 0; break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment