lex.c (real_yylex): Change integer literal overflow handling to be like c-lex.c.

* lex.c (real_yylex) : Change integer literal overflow handling to
	be like c-lex.c.

From-SVN: r27879
This commit is contained in:
Gavin Romig-Koch 1999-07-01 11:22:17 +00:00 committed by Gavin Romig-Koch
parent 0d072f2298
commit 611495e21b
2 changed files with 6 additions and 18 deletions

View File

@ -1,5 +1,8 @@
1999-07-01 Gavin Romig-Koch <gavin@cygnus.com>
* lex.c (real_yylex) : Change integer literal overflow handling to
be like c-lex.c.
* lex.c (real_yylex): Improve 'integer constant out of range' messages.
1999-06-28 Richard Henderson <rth@cygnus.com>

View File

@ -3857,7 +3857,7 @@ real_yylex ()
int spec_long = 0;
int spec_long_long = 0;
int spec_imag = 0;
int bytes, warn;
int warn;
while (1)
{
@ -3895,25 +3895,10 @@ real_yylex ()
c = getch ();
}
/* If the constant is not long long and it won't fit in an
unsigned long, or if the constant is long long and won't fit
in an unsigned long long, then warn that the constant is out
of range. */
/* ??? This assumes that long long and long integer types are
a multiple of 8 bits. This better than the original code
though which assumed that long was exactly 32 bits and long
long was exactly 64 bits. */
if (spec_long_long)
bytes = TYPE_PRECISION (long_long_integer_type_node) / 8;
else
bytes = TYPE_PRECISION (long_integer_type_node) / 8;
/* If it won't fit in the host's representation for integers,
then pedwarn. */
warn = overflow;
for (i = bytes; i < TOTAL_PARTS; i++)
if (parts[i])
warn = 1;
if (warn)
pedwarn ("integer constant is too large for this configuration of the compiler - truncated to %d bits", HOST_BITS_PER_WIDE_INT * 2);