From 4e1e54607bca5b43285c73427c3eeabe05947e1f Mon Sep 17 00:00:00 2001 From: Joseph Myers Date: Sat, 5 Aug 2000 00:03:21 +0100 Subject: [PATCH] c-common.c (time_char_table): Mark up formats added in C99 and make other corrections. * c-common.c (time_char_table): Mark up formats added in C99 and make other corrections. %D and %g were added in C99. %Og is an extension. %EX is permitted. %R, %T, %n, %r, %t were added in C99. %e was added in C99. %Oj is an extension. %G and %z are in C99 rather than GNU extensions, but %OG and %Oz are extensions. %h was added in C99. %C was added in C99. %OY and %OC are extensions. Add the C99 format %F. (check_format_info): If pedantic and not in C99 mode, warn for C99 formats, %E and %O. From-SVN: r35496 --- gcc/ChangeLog | 12 ++++++++++++ gcc/c-common.c | 32 +++++++++++++++++++++++--------- 2 files changed, 35 insertions(+), 9 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 4552578089f..6f56ef59434 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +2000-08-04 Joseph S. Myers + + * c-common.c (time_char_table): Mark up formats added in C99 and + make other corrections. %D and %g were added in C99. %Og is an + extension. %EX is permitted. %R, %T, %n, %r, %t were added in + C99. %e was added in C99. %Oj is an extension. %G and %z are in + C99 rather than GNU extensions, but %OG and %Oz are extensions. + %h was added in C99. %C was added in C99. %OY and %OC are + extensions. Add the C99 format %F. + (check_format_info): If pedantic and not in C99 mode, warn for C99 + formats, %E and %O. + Fri Aug 4 23:01:58 2000 J"orn Rennecke * function.c (schedule_fixup_var_refs): New function, broken out diff --git a/gcc/c-common.c b/gcc/c-common.c index 5aa69dbc8c5..0814c4d125a 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -1268,22 +1268,31 @@ static format_char_info scan_char_table[] = { 'E' - E modifier is acceptable 'O' - O modifier is acceptable to Standard C 'o' - O modifier is acceptable as a GNU extension + '9' - added to the C standard in C99 'G' - other GNU extensions */ static format_char_info time_char_table[] = { { "y", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "2EO-_0w" }, - { "D", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "2" }, - { "g", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "2O-_0w" }, + { "D", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "29" }, + { "g", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "2Oo-_0w9" }, { "cx", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "3E" }, - { "%RTXnrt", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "" }, + { "%", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "" }, + { "X", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "E" }, + { "RTnrt", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "9" }, { "P", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "G" }, - { "HIMSUWdemw", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0Ow" }, - { "Vju", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0Oow" }, - { "Gklsz", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0OGw" }, + { "HIMSUWdmw", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0Ow" }, + { "e", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0Ow9" }, + { "j", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0Oow" }, + { "Vu", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0Ow9" }, + { "Gz", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0Oow9" }, + { "kls", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0OGw" }, { "ABZa", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "^#" }, { "p", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "#" }, - { "bh", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "^" }, - { "CY", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0EOw" }, + { "b", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "^" }, + { "h", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "^9" }, + { "Y", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0EOow" }, + { "F", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "w9" }, + { "C", 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, "-_0EOow9" }, { NULL, 0, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL } }; @@ -1900,9 +1909,14 @@ check_format_info (info, params) { if (index (fci->flag_chars, 'G') != 0) warning ("ANSI C does not support `%%%c'", format_char); - if (index (fci->flag_chars, 'o') != 0 + if (index (fci->flag_chars, '9') != 0 && !flag_isoc99) + warning ("ANSI C does not support `%%%c'", format_char); + if ((index (fci->flag_chars, 'o') != 0 + || (!flag_isoc99 && index (fci->flag_chars, 'O') != 0)) && index (flag_chars, 'O') != 0) warning ("ANSI C does not support `%%O%c'", format_char); + if (!flag_isoc99 && index (flag_chars, 'E')) + warning ("ANSI C does not support `%%E%c'", format_char); } if (wide && index (fci->flag_chars, 'w') == 0) warning ("width used with `%c' format", format_char); -- 2.30.2