From 611495e21b07c658c2e6eab3b3a6c648a8e1b1a3 Mon Sep 17 00:00:00 2001 From: Gavin Romig-Koch Date: Thu, 1 Jul 1999 11:22:17 +0000 Subject: [PATCH] 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 --- gcc/cp/ChangeLog | 3 +++ gcc/cp/lex.c | 21 +++------------------ 2 files changed, 6 insertions(+), 18 deletions(-) diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c71ffd713e6..25a0005bb5b 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,5 +1,8 @@ 1999-07-01 Gavin Romig-Koch + * 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 diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 1e2672627e9..54489905ac3 100644 --- a/gcc/cp/lex.c +++ b/gcc/cp/lex.c @@ -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); -- 2.30.2