Do not compare boolean values with false/true, just use them.
authorChristoph Mallon <christoph.mallon@gmx.de>
Thu, 5 May 2011 15:29:41 +0000 (17:29 +0200)
committerChristoph Mallon <christoph.mallon@gmx.de>
Thu, 5 May 2011 15:29:41 +0000 (17:29 +0200)
ast.c
ast2firm.c
main.c

diff --git a/ast.c b/ast.c
index f256e13..af2a2d3 100644 (file)
--- a/ast.c
+++ b/ast.c
@@ -1916,7 +1916,7 @@ expression_classification_t is_constant_expression(const expression_t *expressio
                expression_classification_t const lclass = is_constant_expression(left);
                if (lclass != EXPR_CLASS_CONSTANT)
                        return lclass;
-               if (fold_constant_to_bool(left) == false)
+               if (!fold_constant_to_bool(left))
                        return EXPR_CLASS_CONSTANT;
                return is_constant_expression(expression->binary.right);
        }
@@ -1926,7 +1926,7 @@ expression_classification_t is_constant_expression(const expression_t *expressio
                expression_classification_t const lclass = is_constant_expression(left);
                if (lclass != EXPR_CLASS_CONSTANT)
                        return lclass;
-               if (fold_constant_to_bool(left) == true)
+               if (fold_constant_to_bool(left))
                        return EXPR_CLASS_CONSTANT;
                return is_constant_expression(expression->binary.right);
        }
@@ -1940,7 +1940,7 @@ expression_classification_t is_constant_expression(const expression_t *expressio
                if (cclass != EXPR_CLASS_CONSTANT)
                        return cclass;
 
-               if (fold_constant_to_bool(condition) == true) {
+               if (fold_constant_to_bool(condition)) {
                        expression_t const *const t = expression->conditional.true_expression;
                        return t == NULL ? EXPR_CLASS_CONSTANT : is_constant_expression(t);
                } else {
index 382ca18..7da74d1 100644 (file)
@@ -3711,14 +3711,8 @@ static ir_node *create_condition_evaluation(const expression_t *expression,
        if (is_builtin_expect(expression) && is_Cond(cond)) {
                call_argument_t *argument = expression->call.arguments->next;
                if (is_constant_expression(argument->expression) == EXPR_CLASS_CONSTANT) {
-                       bool             cnst = fold_constant_to_bool(argument->expression);
-                       cond_jmp_predicate pred;
-
-                       if (cnst == false) {
-                               pred = COND_JMP_PRED_FALSE;
-                       } else {
-                               pred = COND_JMP_PRED_TRUE;
-                       }
+                       bool               const cnst = fold_constant_to_bool(argument->expression);
+                       cond_jmp_predicate const pred = cnst ? COND_JMP_PRED_TRUE : COND_JMP_PRED_FALSE;
                        set_Cond_jmp_pred(cond, pred);
                }
        }
diff --git a/main.c b/main.c
index 9d42e52..d39b27f 100644 (file)
--- a/main.c
+++ b/main.c
@@ -883,7 +883,7 @@ int main(int argc, char **argv)
                                                profile_generate = truth_value;
                                        } else if (streq(opt, "profile-use")) {
                                                profile_use = truth_value;
-                                       } else if (truth_value == false &&
+                                       } else if (!truth_value &&
                                                   streq(opt, "asynchronous-unwind-tables")) {
                                            /* nothing todo, a gcc feature which we don't support
                                             * anyway was deactivated */