aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/ChangeLog9
-rw-r--r--gcc/c-lex.c6
-rw-r--r--gcc/cppexp.c2
-rw-r--r--gcc/invoke.texi9
4 files changed, 26 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 0f8a523..0146878 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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
diff --git a/gcc/c-lex.c b/gcc/c-lex.c
index 9cbbc4d..77442e3 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 18f494f..9631526 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 a1096f1..14dd109 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