aboutsummaryrefslogtreecommitdiff
path: root/gcc/cppexp.c
diff options
context:
space:
mode:
authorZack Weinberg <zack@wolery.cumb.org>2000-07-12 19:41:30 +0000
committerZack Weinberg <zack@gcc.gnu.org>2000-07-12 19:41:30 +0000
commit0080e8929257ca9c0cceeb61e4d30c425b5c9c4b (patch)
tree230a45b12a0aeb61272c4410e2c6679f2e10e469 /gcc/cppexp.c
parent50ceaae014a3f4259a1d084b6ca720a8954010e8 (diff)
downloadgcc-0080e8929257ca9c0cceeb61e4d30c425b5c9c4b.zip
gcc-0080e8929257ca9c0cceeb61e4d30c425b5c9c4b.tar.gz
gcc-0080e8929257ca9c0cceeb61e4d30c425b5c9c4b.tar.bz2
cppexp.c (LOGICAL): Delete macro.
* cppexp.c (LOGICAL): Delete macro. (_cpp_parse_expr): Do not use UNARY for unary +. Implement || and && directly. * cpphash.c (HASHSIZE): Increase to 4096. (struct hashdummy): Add hash field. (eq_HASHNODE): Compare unreduced hashes, then lengths, then the string values using memcmp. (cpp_lookup): Set dummy.hash. From-SVN: r34994
Diffstat (limited to 'gcc/cppexp.c')
-rw-r--r--gcc/cppexp.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/gcc/cppexp.c b/gcc/cppexp.c
index e8ee20e..5f141e2 100644
--- a/gcc/cppexp.c
+++ b/gcc/cppexp.c
@@ -706,10 +706,6 @@ op_to_prio[] =
top->value = OP v2; \
top->unsignedp = unsigned2; \
top->flags |= HAVE_VALUE;
-#define LOGICAL(OP, NEG) \
- top->value = v1 OP v2; \
- top->unsignedp = 0; \
- if (NEG v1) skip_evaluation--;
#define SHIFT(PSH, MSH) \
if (skip_evaluation) \
break; \
@@ -834,15 +830,18 @@ _cpp_parse_expr (pfile)
case CPP_AND: BITWISE(&); break;
case CPP_XOR: BITWISE(^); break;
case CPP_OR: BITWISE(|); break;
- case CPP_AND_AND: LOGICAL(&&,!); break;
- case CPP_OR_OR: LOGICAL(||,); break;
case CPP_LSHIFT: SHIFT(left_shift, right_shift); break;
case CPP_RSHIFT: SHIFT(right_shift, left_shift); break;
case CPP_PLUS:
if (!(top->flags & HAVE_VALUE))
{
- UNARY(/* + */); /* K+R C doesn't like unary + */
+ /* Can't use UNARY(+) because K+R C did not have unary
+ plus. Can't use UNARY() because some compilers object
+ to the empty argument. */
+ top->value = v2;
+ top->unsignedp = unsigned2;
+ top->flags |= HAVE_VALUE;
}
else
{
@@ -908,6 +907,16 @@ _cpp_parse_expr (pfile)
}
break;
+ case CPP_OR_OR:
+ top->value = v1 || v2;
+ top->unsignedp = 0;
+ if (v1) skip_evaluation--;
+ break;
+ case CPP_AND_AND:
+ top->value = v1 && v2;
+ top->unsignedp = 0;
+ if (!v1) skip_evaluation--;
+ break;
case CPP_COMMA:
if (CPP_PEDANTIC (pfile))
cpp_pedwarn (pfile, "comma operator in operand of #if");