ref: 8022f78f34e2b0532f880d2d64d363bb1e20531d
parent: e6183c2b047fec411a87bcb04ccc3833ec846b20
author: Roberto E. Vargas Caballero <[email protected]>
date: Sat Jul 18 06:31:19 EDT 2015
Rewrite clever expressions in cpp.c These expressions were too much clever and obscure. Using an intermediate variable helps to understand them.
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
@@ -447,9 +447,11 @@
{
Symbol *sym;
unsigned n;
+ int status;
if (cppctx == NR_COND-1)
error("too much nesting levels of conditional inclusion");
+
n = cppctx++;
if (yytoken != IDEN) {
error("no macro name given in #%s directive",
@@ -458,7 +460,10 @@
sym = lookup(NS_CPP);
next();
- if (!(ifstatus[n] = (sym->flags & ISDEFINED) != 0 == isdef))
+
+ status = (sym->flags & ISDEFINED) != 0 == isdef;
+
+ if (!(ifstatus[n] = status))
++cppoff;
}
@@ -486,10 +491,13 @@
static void
elseclause(void)
{
+ int status;
+
if (cppctx == 0)
error("#else without #ifdef/ifndef");
- cppoff += (ifstatus[cppctx-1] ^= 1) ? -1 : 1;
+ status = (ifstatus[cppctx-1] ^= 1);
+ cppoff += (status) ? -1 : 1;
}
static void