From: Richard Kenner Date: Sat, 26 Dec 1992 23:11:58 +0000 (-0500) Subject: (check_format): Using both a precision and the `0' flag is only a problem on `d'... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8d162cabbb5b9ad58baef5c8376857463ebcafb7;p=gcc.git (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 --- diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index dfde12e5513..46e6dac0944 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;