[hackers] [scc] Remove comparision in constant conditions || Roberto E. Vargas Caballero

From: <git_AT_suckless.org>
Date: Sat, 15 Aug 2015 23:27:07 +0200 (CEST)

commit a993e8c13722106027d20e89369be1cc02753083
Author: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
AuthorDate: Sat Aug 15 11:03:12 2015 +0200
Commit: Roberto E. Vargas Caballero <k0ga_AT_shike2.com>
CommitDate: Sat Aug 15 11:03:12 2015 +0200

    Remove comparision in constant conditions
    
    This was a very idea because it is easier to detect
    a zero or an one than a comparision

diff --git a/cc1/expr.c b/cc1/expr.c
index 310c3d6..ebde5b1 100644
--- a/cc1/expr.c
+++ b/cc1/expr.c
_AT_@ -1161,7 +1161,7 @@ condition(void)
         expect('(');
         np = exp2cond(expr(), 0);
         if (np->constant)
- np = node(ONE, inttype, np, constnode(zero));
+ warn("conditional expression is constant");
         expect(')');
 
         return np;
diff --git a/cc1/tests/test006.c b/cc1/tests/test006.c
index 4f67fbb..529f135 100644
--- a/cc1/tests/test006.c
+++ b/cc1/tests/test006.c
_AT_@ -2,19 +2,22 @@
 name: TEST006
 description: Basic test for if
 output:
+test006.c:42: warning: conditional expression is constant
+test006.c:44: warning: conditional expression is constant
+test006.c:47: warning: conditional expression is constant
 G1 M c
 F1
 X2 F1 main
 G2 F1 main {
 -
- j L2 #I0 #I0 =I
+ j L2 #I0
         yI #I1
         j L3
 L2
- j L4 #I0 #I0 =I
+ j L4 #I0
         j L5
 L4
- j L6 #I1 #I0 =I
+ j L6 #I1
         j L7 G1 MI #I0 =I
         yI #I1
         j L8
_AT_@ -52,4 +55,3 @@ main()
         }
         return 1;
 }
-
Received on Sat Aug 15 2015 - 23:27:07 CEST

This archive was generated by hypermail 2.3.0 : Sat Aug 15 2015 - 23:36:12 CEST