aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1992-12-26 18:11:58 -0500
committerRichard Kenner <kenner@gcc.gnu.org>1992-12-26 18:11:58 -0500
commit8d162cabbb5b9ad58baef5c8376857463ebcafb7 (patch)
tree4111a7cb08e372c573b746ef75adf1d078df47ae /gcc
parenteae957a8b8701537efa1af34a619971e5f81827e (diff)
downloadgcc-8d162cabbb5b9ad58baef5c8376857463ebcafb7.zip
gcc-8d162cabbb5b9ad58baef5c8376857463ebcafb7.tar.gz
gcc-8d162cabbb5b9ad58baef5c8376857463ebcafb7.tar.bz2
(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
Diffstat (limited to 'gcc')
-rw-r--r--gcc/c-typeck.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index dfde12e..46e6dac 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -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;