From 8fa18c06a2977b0ef00c440f5f103f612ce6dc61 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Mon, 17 Oct 2016 19:29:00 +0000 Subject: [PATCH] c-warn.c (find_array_ref_with_const_idx_r): Remove parameter names. * c-warn.c (find_array_ref_with_const_idx_r): Remove parameter names. Return immediately when finding a match. (warn_tautological_cmp): Remove a boolean variable that is no longer needed. From-SVN: r241278 --- gcc/c-family/ChangeLog | 7 +++++++ gcc/c-family/c-warn.c | 13 ++++--------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog index 64eccee3b77..d5e90905fe8 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,3 +1,10 @@ +2016-10-17 Marek Polacek + + * c-warn.c (find_array_ref_with_const_idx_r): Remove parameter names. + Return immediately when finding a match. + (warn_tautological_cmp): Remove a boolean variable that is no longer + needed. + 2016-10-17 Marek Polacek * c-attribs.c: New file. diff --git a/gcc/c-family/c-warn.c b/gcc/c-family/c-warn.c index 88544ce2a92..904f6d3cf4f 100644 --- a/gcc/c-family/c-warn.c +++ b/gcc/c-family/c-warn.c @@ -256,17 +256,14 @@ warn_logical_operator (location_t location, enum tree_code code, tree type, with constant indices. */ static tree -find_array_ref_with_const_idx_r (tree *expr_p, int *walk_subtrees, void *data) +find_array_ref_with_const_idx_r (tree *expr_p, int *, void *) { tree expr = *expr_p; if ((TREE_CODE (expr) == ARRAY_REF || TREE_CODE (expr) == ARRAY_RANGE_REF) && TREE_CODE (TREE_OPERAND (expr, 1)) == INTEGER_CST) - { - *(bool *) data = true; - *walk_subtrees = 0; - } + return integer_type_node; return NULL_TREE; } @@ -312,10 +309,8 @@ warn_tautological_cmp (location_t loc, enum tree_code code, tree lhs, tree rhs) { /* Don't warn about array references with constant indices; these are likely to come from a macro. */ - bool found = false; - walk_tree_without_duplicates (&lhs, find_array_ref_with_const_idx_r, - &found); - if (found) + if (walk_tree_without_duplicates (&lhs, find_array_ref_with_const_idx_r, + NULL)) return; const bool always_true = (code == EQ_EXPR || code == LE_EXPR || code == GE_EXPR || code == UNLE_EXPR -- 2.30.2