diff options
author | Gavin Romig-Koch <gavin@cygnus.com> | 1999-07-01 11:22:17 +0000 |
---|---|---|
committer | Gavin Romig-Koch <gavin@gcc.gnu.org> | 1999-07-01 11:22:17 +0000 |
commit | 611495e21b07c658c2e6eab3b3a6c648a8e1b1a3 (patch) | |
tree | 0c4df4dbd7a96702a02cd297899ed20bdc452f55 | |
parent | 0d072f2298d8f17990241da9d521cc3b7638b39c (diff) | |
download | gcc-611495e21b07c658c2e6eab3b3a6c648a8e1b1a3.zip gcc-611495e21b07c658c2e6eab3b3a6c648a8e1b1a3.tar.gz gcc-611495e21b07c658c2e6eab3b3a6c648a8e1b1a3.tar.bz2 |
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
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/lex.c | 21 |
2 files changed, 6 insertions, 18 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c71ffd7..25a0005 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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> diff --git a/gcc/cp/lex.c b/gcc/cp/lex.c index 1e26726..5448990 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); |