diff options
author | Marek Polacek <polacek@redhat.com> | 2016-10-17 19:29:00 +0000 |
---|---|---|
committer | Marek Polacek <mpolacek@gcc.gnu.org> | 2016-10-17 19:29:00 +0000 |
commit | 8fa18c06a2977b0ef00c440f5f103f612ce6dc61 (patch) | |
tree | 07e0f94fbad6ec0f3f5f4718640fc4a5bb1db808 /gcc | |
parent | 1d30acf68750f2617c3779176781a26b0b50cfa8 (diff) | |
download | gcc-8fa18c06a2977b0ef00c440f5f103f612ce6dc61.zip gcc-8fa18c06a2977b0ef00c440f5f103f612ce6dc61.tar.gz gcc-8fa18c06a2977b0ef00c440f5f103f612ce6dc61.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/c-family/ChangeLog | 7 | ||||
-rw-r--r-- | 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 64eccee..d5e9090 100644 --- a/gcc/c-family/ChangeLog +++ b/gcc/c-family/ChangeLog @@ -1,5 +1,12 @@ 2016-10-17 Marek Polacek <polacek@redhat.com> + * 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 <polacek@redhat.com> + * c-attribs.c: New file. * c-common.c: Move attributes handling to c-attribs.c. (get_nonnull_operand): No longer static. diff --git a/gcc/c-family/c-warn.c b/gcc/c-family/c-warn.c index 88544ce..904f6d3 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 |