re PR c/64279 (Warning missing for "(cond) ? A : A" / if(cond) expr1; else expr1; // same expression in if and else branch) PR c/64279 * c-common.h (do_warn_duplicated_branches_r): Declare. * c-gimplify.c (c_genericize): Walk the function tree calling do_warn_duplicated_branches_r. * c-warn.c (expr_from_macro_expansion_r): New. (do_warn_duplicated_branches): New. (do_warn_duplicated_branches_r): New. * c.opt (Wduplicated-branches): New option. * c-typeck.c (build_conditional_expr): Warn about duplicated branches. * call.c (build_conditional_expr_1): Warn about duplicated branches. * semantics.c (finish_expr_stmt): Build statement using the proper location. * doc/invoke.texi: Document -Wduplicated-branches. * fold-const.c (operand_equal_p): Handle MODIFY_EXPR, INIT_EXPR, COMPOUND_EXPR, PREDECREMENT_EXPR, PREINCREMENT_EXPR, POSTDECREMENT_EXPR, POSTINCREMENT_EXPR, CLEANUP_POINT_EXPR, EXPR_STMT, STATEMENT_LIST, and RETURN_EXPR. For non-pure non-const functions return 0 only when not OEP_LEXICOGRAPHIC. (fold_build_cleanup_point_expr): Use the expression location when building CLEANUP_POINT_EXPR. * tree-core.h (enum operand_equal_flag): Add OEP_LEXICOGRAPHIC. * tree.c (add_expr): Handle error_mark_node. * c-c++-common/Wduplicated-branches-1.c: New test. * c-c++-common/Wduplicated-branches-10.c: New test. * c-c++-common/Wduplicated-branches-11.c: New test. * c-c++-common/Wduplicated-branches-12.c: New test. * c-c++-common/Wduplicated-branches-2.c: New test. * c-c++-common/Wduplicated-branches-3.c: New test. * c-c++-common/Wduplicated-branches-4.c: New test. * c-c++-common/Wduplicated-branches-5.c: New test. * c-c++-common/Wduplicated-branches-6.c: New test. * c-c++-common/Wduplicated-branches-7.c: New test. * c-c++-common/Wduplicated-branches-8.c: New test. * c-c++-common/Wduplicated-branches-9.c: New test. * c-c++-common/Wimplicit-fallthrough-7.c: Coalesce dg-warning. * g++.dg/cpp0x/lambda/lambda-switch.C: Move dg-warning. * g++.dg/ext/builtin-object-size3.C: Likewise. * g++.dg/gomp/loop-1.C: Likewise. * g++.dg/warn/Wduplicated-branches1.C: New test. * g++.dg/warn/Wduplicated-branches2.C: New test. From-SVN: r244705
| Name |
Last commit
|
Last update |
|---|---|---|
| .. | ||
| lambda-50220.C | Loading commit data... | |
| lambda-58566.C | Loading commit data... | |
| lambda-59483.C | Loading commit data... | |
| lambda-61148.C | Loading commit data... | |
| lambda-62155.C | Loading commit data... | |
| lambda-70218.C | Loading commit data... | |
| lambda-77791.C | Loading commit data... | |
| lambda-98.C | Loading commit data... | |
| lambda-__func__.C | Loading commit data... | |
| lambda-anon1.C | Loading commit data... | |
| lambda-array.C | Loading commit data... | |
| lambda-array2.C | Loading commit data... | |
| lambda-auto1.C | Loading commit data... | |
| lambda-auto2.C | Loading commit data... | |
| lambda-auto3.C | Loading commit data... | |
| lambda-capture-const-ref-neg.C | Loading commit data... | |
| lambda-capture-const-ref.C | Loading commit data... | |
| lambda-capture-neg.C | Loading commit data... | |
| lambda-capture-redundancy.C | Loading commit data... | |
| lambda-cast1.C | Loading commit data... | |
| lambda-const-neg.C | Loading commit data... | |
| lambda-const-this.C | Loading commit data... | |
| lambda-const.C | Loading commit data... | |
| lambda-const2.C | Loading commit data... | |
| lambda-const3.C | Loading commit data... | |
| lambda-const4.C | Loading commit data... | |
| lambda-const5.C | Loading commit data... | |
| lambda-conv.C | Loading commit data... | |
| lambda-conv10.C | Loading commit data... | |
| lambda-conv11.C | Loading commit data... | |
| lambda-conv2.C | Loading commit data... | |
| lambda-conv3.C | Loading commit data... | |
| lambda-conv4.C | Loading commit data... | |
| lambda-conv5.C | Loading commit data... | |
| lambda-conv6.C | Loading commit data... | |
| lambda-conv7.C | Loading commit data... | |
| lambda-conv8.C | Loading commit data... | |
| lambda-conv9.C | Loading commit data... | |
| lambda-copy-default-neg.C | Loading commit data... | |
| lambda-copy-default.C | Loading commit data... | |
| lambda-copy-neg.C | Loading commit data... | |
| lambda-copy.C | Loading commit data... | |
| lambda-ctor-neg.C | Loading commit data... | |
| lambda-ctors.C | Loading commit data... | |
| lambda-debug.C | Loading commit data... | |
| lambda-decltype1.C | Loading commit data... | |
| lambda-decltype2.C | Loading commit data... | |
| lambda-deduce-ext-neg.C | Loading commit data... | |
| lambda-deduce-ext-neg2.C | Loading commit data... | |
| lambda-deduce-neg.C | Loading commit data... | |
| lambda-deduce.C | Loading commit data... | |
| lambda-deduce2.C | Loading commit data... | |
| lambda-deduce3.C | Loading commit data... | |
| lambda-defarg.C | Loading commit data... | |
| lambda-defarg2.C | Loading commit data... | |
| lambda-defarg3.C | Loading commit data... | |
| lambda-defarg4.C | Loading commit data... | |
| lambda-defarg5.C | Loading commit data... | |
| lambda-defarg6.C | Loading commit data... | |
| lambda-diag1.C | Loading commit data... | |
| lambda-direct-init.C | Loading commit data... | |
| lambda-eh.C | Loading commit data... | |
| lambda-eh2.C | Loading commit data... | |
| lambda-eh3.C | Loading commit data... | |
| lambda-err1.C | Loading commit data... | |
| lambda-err2.C | Loading commit data... | |
| lambda-err3.C | Loading commit data... | |
| lambda-errloc.C | Loading commit data... | |
| lambda-errloc2.C | Loading commit data... | |
| lambda-field-names.C | Loading commit data... | |
| lambda-for.C | Loading commit data... | |
| lambda-ice1.C | Loading commit data... | |
| lambda-ice10.C | Loading commit data... | |
| lambda-ice11.C | Loading commit data... | |
| lambda-ice12.C | Loading commit data... | |
| lambda-ice13.C | Loading commit data... | |
| lambda-ice14.C | Loading commit data... | |
| lambda-ice15.C | Loading commit data... | |
| lambda-ice16.C | Loading commit data... | |
| lambda-ice2.C | Loading commit data... | |
| lambda-ice3.C | Loading commit data... | |
| lambda-ice4.C | Loading commit data... | |
| lambda-ice5.C | Loading commit data... | |
| lambda-ice6.C | Loading commit data... | |
| lambda-ice7.C | Loading commit data... | |
| lambda-ice8.C | Loading commit data... | |
| lambda-ice9.C | Loading commit data... | |
| lambda-in-class-neg.C | Loading commit data... | |
| lambda-in-class.C | Loading commit data... | |
| lambda-initlist1.C | Loading commit data... | |
| lambda-initlist2.C | Loading commit data... | |
| lambda-initlist3.C | Loading commit data... | |
| lambda-intname.C | Loading commit data... | |
| lambda-lookup-neg.C | Loading commit data... | |
| lambda-mangle.C | Loading commit data... | |
| lambda-mangle2.C | Loading commit data... | |
| lambda-mangle3.C | Loading commit data... | |
| lambda-mangle4.C | Loading commit data... | |
| lambda-mixed.C | Loading commit data... | |
| lambda-mutable.C | Loading commit data... | |
| lambda-mutable2.C | Loading commit data... | |
| lambda-names1.C | Loading commit data... | |
| lambda-nested.C | Loading commit data... | |
| lambda-nested2.C | Loading commit data... | |
| lambda-nested3.C | Loading commit data... | |
| lambda-nested4.C | Loading commit data... | |
| lambda-nested5.C | Loading commit data... | |
| lambda-non-const.C | Loading commit data... | |
| lambda-nop.C | Loading commit data... | |
| lambda-ns-scope.C | Loading commit data... | |
| lambda-nsdmi1.C | Loading commit data... | |
| lambda-nsdmi2.C | Loading commit data... | |
| lambda-nsdmi3.C | Loading commit data... | |
| lambda-nsdmi4.C | Loading commit data... | |
| lambda-nsdmi5.C | Loading commit data... | |
| lambda-nsdmi6.C | Loading commit data... | |
| lambda-nsdmi7.C | Loading commit data... | |
| lambda-nsdmi8.C | Loading commit data... | |
| lambda-nullptr.C | Loading commit data... | |
| lambda-pass.C | Loading commit data... | |
| lambda-qualified.C | Loading commit data... | |
| lambda-recursive.C | Loading commit data... | |
| lambda-ref-default.C | Loading commit data... | |
| lambda-ref.C | Loading commit data... | |
| lambda-ref2.C | Loading commit data... | |
| lambda-rep1.C | Loading commit data... | |
| lambda-return1.C | Loading commit data... | |
| lambda-sfinae1.C | Loading commit data... | |
| lambda-shadow1.C | Loading commit data... | |
| lambda-shadow2.C | Loading commit data... | |
| lambda-std-function.C | Loading commit data... | |
| lambda-switch.C | Loading commit data... | |
| lambda-syntax1.C | Loading commit data... | |
| lambda-template.C | Loading commit data... | |
| lambda-template10.C | Loading commit data... | |
| lambda-template11.C | Loading commit data... | |
| lambda-template12.C | Loading commit data... | |
| lambda-template13.C | Loading commit data... | |
| lambda-template14.C | Loading commit data... | |
| lambda-template2.C | Loading commit data... | |
| lambda-template3.C | Loading commit data... | |
| lambda-template4.C | Loading commit data... | |
| lambda-template5.C | Loading commit data... | |
| lambda-template6.C | Loading commit data... | |
| lambda-template7.C | Loading commit data... | |
| lambda-template8.C | Loading commit data... | |
| lambda-template9.C | Loading commit data... | |
| lambda-this.C | Loading commit data... | |
| lambda-this10.C | Loading commit data... | |
| lambda-this11.C | Loading commit data... | |
| lambda-this12.C | Loading commit data... | |
| lambda-this13.C | Loading commit data... | |
| lambda-this14.C | Loading commit data... | |
| lambda-this15.C | Loading commit data... | |
| lambda-this16.C | Loading commit data... | |
| lambda-this17.C | Loading commit data... | |
| lambda-this18.C | Loading commit data... | |
| lambda-this19.C | Loading commit data... | |
| lambda-this2.C | Loading commit data... | |
| lambda-this20.C | Loading commit data... | |
| lambda-this3.C | Loading commit data... | |
| lambda-this4.C | Loading commit data... | |
| lambda-this5.C | Loading commit data... | |
| lambda-this6.C | Loading commit data... | |
| lambda-this7.C | Loading commit data... | |
| lambda-this8.C | Loading commit data... | |
| lambda-this9.C | Loading commit data... | |
| lambda-type.C | Loading commit data... | |
| lambda-typedef.C | Loading commit data... | |
| lambda-uneval.C | Loading commit data... | |
| lambda-uneval2.C | Loading commit data... | |
| lambda-use.C | Loading commit data... | |
| lambda-use2.C | Loading commit data... | |
| lambda-variadic1.C | Loading commit data... | |
| lambda-variadic2.C | Loading commit data... | |
| lambda-variadic3.C | Loading commit data... | |
| lambda-warn1.C | Loading commit data... | |
| lambda-warn2.C | Loading commit data... | |
| lambda-warn3.C | Loading commit data... | |
| lambda-warn4.C | Loading commit data... |