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