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
This commit is contained in:
Kaveh R. Ghazi 2000-08-10 15:21:18 +00:00 committed by Kaveh Ghazi
parent b498d041fa
commit 7da92c086f
4 changed files with 26 additions and 0 deletions

View File

@ -1,3 +1,12 @@
2000-08-10 Kaveh R. Ghazi <ghazi@caip.rutgers.edu>
* 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 <ovidiu@cup.hp.com>
* gthr-posix.h: Include auto-host.h. Conditionally include

View File

@ -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;

View File

@ -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");
}

View File

@ -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