From: Jim Wilson Date: Wed, 25 Mar 1998 13:42:05 +0000 (+0000) Subject: Fix bug reported by David C Binderman, accept 'L' when pedantic with FP format. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a16b4c9c69c516b40af4b868ce9135cae8f9fd25;p=gcc.git Fix bug reported by David C Binderman, accept 'L' when pedantic with FP format. * c-common.c (check_format_info): Initialize type, is_type. New local integral_format. Don't warn for 'L' when pedantic. Do warn for 'L' when pedantic if used with integral format specifier. From-SVN: r18827 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index e76dc8109b4..1e100897a22 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +Wed Mar 25 13:40:48 1998 Jim Wilson + + * c-common.c (check_format_info): Initialize type, is_type. New local + integral_format. Don't warn for 'L' when pedantic. Do warn for 'L' + when pedantic if used with integral format specifier. + Wed Mar 25 16:09:01 1998 Michael Meissner * rs6000.h (FUNCTION_ARG_PADDING): Cast result to be enum diff --git a/gcc/c-common.c b/gcc/c-common.c index 952306e1a20..efc6051dc3f 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -379,8 +379,8 @@ void decl_attributes (node, attributes, prefix_attributes) tree node, attributes, prefix_attributes; { - tree decl = 0, type; - int is_type; + tree decl = 0, type = 0; + int is_type = 0; tree a; if (attrtab_idx == 0) @@ -1185,6 +1185,7 @@ check_format_info (info, params) int length_char; int format_char; int format_length; + int integral_format; tree format_tree; tree cur_param; tree cur_type; @@ -1448,7 +1449,7 @@ check_format_info (info, params) else if (*format_chars == 'q' || *format_chars == 'L') { length_char = *format_chars++; - if (pedantic) + if (pedantic && length_char == 'q') pedwarn ("ANSI C does not support the `%c' length modifier", length_char); } @@ -1557,10 +1558,10 @@ check_format_info (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')) + integral_format = (format_char == 'd' || format_char == 'i' + || format_char == 'o' || format_char == 'u' + || format_char == 'x' || format_char == 'x'); + if (precise && index (flag_chars, '0') != 0 && integral_format) { sprintf (message, "`0' flag ignored with precision specifier and `%c' format", @@ -1575,7 +1576,8 @@ check_format_info (info, params) case 'q': wanted_type = fci->qlen ? *(fci->qlen) : 0; break; case 'L': wanted_type = fci->bigllen ? *(fci->bigllen) : 0; break; } - if (wanted_type == 0) + if (wanted_type == 0 + || (pedantic && length_char == 'L' && integral_format)) { sprintf (message, "use of `%c' length character with `%c' type character",