aboutsummaryrefslogtreecommitdiff
path: root/gdb/c-exp.y
diff options
context:
space:
mode:
authorJohn Gilmore <gnu@cygnus>1993-03-20 08:44:42 +0000
committerJohn Gilmore <gnu@cygnus>1993-03-20 08:44:42 +0000
commitf24c159f1bc6baef47a62c2473633e9875fa7a59 (patch)
tree9b02c284efa48e44132d1458fc5e240121d3bbf1 /gdb/c-exp.y
parent6aa83a798d27cbd0b14990c048310fa98cdea393 (diff)
downloadgdb-f24c159f1bc6baef47a62c2473633e9875fa7a59.zip
gdb-f24c159f1bc6baef47a62c2473633e9875fa7a59.tar.gz
gdb-f24c159f1bc6baef47a62c2473633e9875fa7a59.tar.bz2
Lint: * c-exp.y (parse_number): Avoid shift warning.
* serial.h (struct ttystate): Declare empty one on DOS.
Diffstat (limited to 'gdb/c-exp.y')
-rw-r--r--gdb/c-exp.y15
1 files changed, 12 insertions, 3 deletions
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 555471f..933007e 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -1042,9 +1042,18 @@ parse_number (p, len, parsed_float, putithere)
/* If the number is too big to be an int, or it's got an l suffix
then it's a long. Work out if this has to be a long by
shifting right and and seeing if anything remains, and the
- target int size is different to the target long size. */
-
- if ((TARGET_INT_BIT != TARGET_LONG_BIT && (n >> TARGET_INT_BIT)) || long_p)
+ target int size is different to the target long size.
+
+ In the expression below, we could have tested
+ (n >> TARGET_INT_BIT)
+ to see if it was zero,
+ but too many compilers warn about that, when ints and longs
+ are the same size. So we shift it twice, with fewer bits
+ each time, for the same result. */
+
+ if ( (TARGET_INT_BIT != TARGET_LONG_BIT
+ && ((n >> 2) >> (TARGET_INT_BIT-2))) /* Avoid shift warning */
+ || long_p)
{
high_bit = ((unsigned LONGEST)1) << (TARGET_LONG_BIT-1);
unsigned_type = builtin_type_unsigned_long;