[hackers] [scc] Rewrite clever expressions in cpp.c || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Sat, 18 Jul 2015 10:56:27 +0200 (CEST)

commit 8022f78f34e2b0532f880d2d64d363bb1e20531d
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Sat Jul 18 10:31:19 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Sat Jul 18 10:31:19 2015 +0200

    Rewrite clever expressions in cpp.c
    
    These expressions were too much clever and obscure. Using
    an intermediate variable helps to understand them.

diff --git a/cc1/cpp.c b/cc1/cpp.c
index 65808f2..b3015b5 100644
--- a/cc1/cpp.c
+++ b/cc1/cpp.c
_AT_@ -447,9 +447,11 @@ ifclause(int isdef)
 {
         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",
_AT_@ -458,7 +460,10 @@ ifclause(int isdef)
 
         sym = lookup(NS_CPP);
         next();
- if (!(ifstatus[n] = (sym->flags & ISDEFINED) != 0 == isdef))
+
+ status = (sym->flags & ISDEFINED) != 0 == isdef;
+
+ if (!(ifstatus[n] = status))
                 ++cppoff;
 }
 
_AT_@ -486,10 +491,13 @@ endif(void)
 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
Received on Sat Jul 18 2015 - 10:56:27 CEST

This archive was generated by hypermail 2.3.0 : Sat Jul 18 2015 - 11:00:12 CEST