aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppexp.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@rabi.phys.columbia.edu>1998-10-11 00:05:11 +0000
committerJeff Law <law@gcc.gnu.org>1998-10-10 18:05:11 -0600
commitfaa765969fa9ce85b27bd20d9a966b0cabba5cdb (patch)
tree2f9de21a1e1e04335878526769ff5fd361b7abd4 /gcc/cppexp.c
parent9265dacf25a26ef02473949bc8feec743e1e5b8c (diff)
downloadgcc-faa765969fa9ce85b27bd20d9a966b0cabba5cdb.zip
gcc-faa765969fa9ce85b27bd20d9a966b0cabba5cdb.tar.gz
gcc-faa765969fa9ce85b27bd20d9a966b0cabba5cdb.tar.bz2
cppexp.c: When forcing unsigned comparisons, cast both sides of the operation.
* cppexp.c: When forcing unsigned comparisons, cast both sides of the operation. * cpphash.h: Move static declaration of hashtab[]... * cpphash.c: ...here. * cpplib.c: Cast difference of two pointers to size_t before comparing it to size_t. Cast signed to unsigned before comparing to size_t. (FIXME: struct argdata should use unsigned buffer sizes.) * cpplib.h (struct cpp_reader): Declare token_buffer_size as unsigned int. (CPP_WRITTEN): Cast return value to size_t. (CPP_RESERVE): Parenthesize N for evaluation order, cast to size_t before comparison. From-SVN: r22980
Diffstat (limited to 'gcc/cppexp.c')
-rw-r--r--gcc/cppexp.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gcc/cppexp.c b/gcc/cppexp.c
index 44f8a66..8fc5f04 100644
--- a/gcc/cppexp.c
+++ b/gcc/cppexp.c
@@ -365,7 +365,7 @@ cpp_lex (pfile, skip_evaluation)
{
c = cpp_parse_escape (pfile, (char **) &ptr);
if (width < HOST_BITS_PER_INT
- && (unsigned) c >= (1 << width))
+ && (unsigned) c >= (unsigned)(1 << width))
cpp_pedwarn (pfile,
"escape sequence out of range for character");
}
@@ -649,7 +649,8 @@ right_shift (pfile, a, unsignedp, b)
#define COMPARE(OP) \
top->unsignedp = 0;\
- top->value = (unsigned1 || unsigned2) ? (unsigned long) v1 OP v2 : (v1 OP v2)
+ top->value = (unsigned1 || unsigned2) \
+ ? (unsigned long) v1 OP (unsigned long) v2 : (v1 OP v2)
/* Parse and evaluate a C expression, reading from PFILE.
Returns the value of the expression. */