From: Kaveh R. Ghazi Date: Thu, 10 Aug 2000 15:21:18 +0000 (+0000) Subject: c-lex.c (parse_float, yylex): For -Wtraditional, issue a warning about non-traditiona... X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7da92c086fa7008497a8f959418c7ce05e048d24;p=gcc.git c-lex.c (parse_float, yylex): For -Wtraditional, issue a warning about non-traditional numeric constant suffixes. * c-lex.c (parse_float, yylex): For -Wtraditional, issue a warning about non-traditional numeric constant suffixes. * cppexp.c (parse_number): Likewise. * invoke.texi: (-Wtraditional): Document new behavior. From-SVN: r35607 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 0f8a523fba6..01468781b4c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2000-08-10 Kaveh R. Ghazi + + * c-lex.c (parse_float, yylex): For -Wtraditional, issue a + warning about non-traditional numeric constant suffixes. + + * cppexp.c (parse_number): Likewise. + + * invoke.texi: (-Wtraditional): Document new behavior. + Thu Aug 10 00:11:04 2000 Ovidiu Predescu * gthr-posix.h: Include auto-host.h. Conditionally include diff --git a/gcc/c-lex.c b/gcc/c-lex.c index 9cbbc4daae9..77442e31648 100644 --- a/gcc/c-lex.c +++ b/gcc/c-lex.c @@ -1109,12 +1109,16 @@ parse_float (data) case 'f': case 'F': if (fflag) error ("more than one `f' in numeric constant"); + else if (warn_traditional && !in_system_header) + warning ("traditional C rejects the `%c' suffix", args->c); fflag = 1; break; case 'l': case 'L': if (lflag) error ("more than one `l' in numeric constant"); + else if (warn_traditional && !in_system_header) + warning ("traditional C rejects the `%c' suffix", args->c); lflag = 1; break; @@ -1773,6 +1777,8 @@ yylex () { if (spec_unsigned) error ("two `u's in integer constant"); + else if (warn_traditional && !in_system_header) + warning ("traditional C rejects the `%c' suffix", c); spec_unsigned = 1; if (spec_long) suffix_lu = 1; diff --git a/gcc/cppexp.c b/gcc/cppexp.c index 18f494fbe02..9631526b18e 100644 --- a/gcc/cppexp.c +++ b/gcc/cppexp.c @@ -218,6 +218,8 @@ parse_number (pfile, tok) goto invalid_suffix; op.unsignedp = sufftab[i].u; + if (CPP_WTRADITIONAL (pfile) && sufftab[i].u) + cpp_warning (pfile, "traditional C rejects the `U' suffix"); if (CPP_OPTION (pfile, c89) && sufftab[i].l == 2) SYNTAX_ERROR ("too many 'l' suffixes in integer constant"); } diff --git a/gcc/invoke.texi b/gcc/invoke.texi index a1096f1d274..14dd1096b02 100644 --- a/gcc/invoke.texi +++ b/gcc/invoke.texi @@ -1838,6 +1838,15 @@ omitted. This is done under the assumption that the zero initializer in user code appears conditioned on e.g. @code{__STDC__} to avoid missing initializer warnings and relies on default initialization to zero in the traditional C case. + +@item +The `U' integer constant suffix, or the `F' or `L' floating point +constant suffixes. (Traditonal C does support the `L' suffix on integer +constants.) Note, these suffixes appear in macros defined in the system +headers of most modern systems, e.g. the _MIN/_MAX macros in limits.h. +Use of these macros can lead to spurious warnings as they do not +necessarily reflect whether the code in question is any less portable to +traditional C given that suitable backup definitions are provided. @end itemize @item -Wundef