aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-lex.c
diff options
context:
space:
mode:
authorJoseph Myers <jsm28@cam.ac.uk>2000-08-08 09:23:31 +0100
committerJoseph Myers <jsm28@gcc.gnu.org>2000-08-08 09:23:31 +0100
commit43d1e05928a16e48e017625e8dad6aeca2a31282 (patch)
tree47882cf65efdea22f41931efaa28770890ac5197 /gcc/c-lex.c
parent2c58a147178958f7d58f570cd3cac743a4d969d5 (diff)
downloadgcc-43d1e05928a16e48e017625e8dad6aeca2a31282.zip
gcc-43d1e05928a16e48e017625e8dad6aeca2a31282.tar.gz
gcc-43d1e05928a16e48e017625e8dad6aeca2a31282.tar.bz2
c-lex.c (yylex): Don't allow integer suffixes 'LUL', 'Ll', 'lL'.
* c-lex.c (yylex): Don't allow integer suffixes 'LUL', 'Ll', 'lL'. testsuite: * gcc.dg/noncompile/const-ll-1.c: New test. From-SVN: r35563
Diffstat (limited to 'gcc/c-lex.c')
-rw-r--r--gcc/c-lex.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/c-lex.c b/gcc/c-lex.c
index 616ecbe..e0137e3 100644
--- a/gcc/c-lex.c
+++ b/gcc/c-lex.c
@@ -1762,6 +1762,7 @@ yylex ()
int spec_unsigned = 0;
int spec_long = 0;
int spec_long_long = 0;
+ int suffix_lu = 0;
int spec_imag = 0;
int warn = 0, i;
@@ -1773,6 +1774,8 @@ yylex ()
if (spec_unsigned)
error ("two `u's in integer constant");
spec_unsigned = 1;
+ if (spec_long)
+ suffix_lu = 1;
}
else if (c == 'l' || c == 'L')
{
@@ -1780,12 +1783,16 @@ yylex ()
{
if (spec_long_long)
error ("three `l's in integer constant");
+ else if (suffix_lu)
+ error ("`LUL' is not a valid integer suffix");
+ else if (c != spec_long)
+ error ("`Ll' and `lL' are not valid integer suffixes");
else if (pedantic && ! flag_isoc99
&& ! in_system_header && warn_long_long)
pedwarn ("ANSI C forbids long long integer constants");
spec_long_long = 1;
}
- spec_long = 1;
+ spec_long = c;
}
else if (c == 'i' || c == 'j' || c == 'I' || c == 'J')
{