https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64249

--- Comment #4 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
Author: mpolacek
Date: Fri Oct  2 12:56:17 2015
New Revision: 228388

URL: https://gcc.gnu.org/viewcvs?rev=228388&root=gcc&view=rev
Log:
        PR c/64249
        * c-common.c (warn_duplicated_cond_add_or_warn): New function.
        * c-common.h (warn_duplicated_cond_add_or_warn): Declare.
        * c.opt (Wduplicated-cond): New option.

        * c-parser.c (c_parser_statement_after_labels): Add CHAIN parameter
        and pass it down to c_parser_if_statement.
        (c_parser_else_body): Add CHAIN parameter and pass it down to
        c_parser_statement_after_labels.
        (c_parser_if_statement): Add CHAIN parameter.  Add code to warn about
        duplicated if-else-if conditions.

        * parser.c (cp_parser_statement): Add CHAIN parameter and pass it
        down to cp_parser_selection_statement.
        (cp_parser_selection_statement): Add CHAIN parameter.  Add code to
        warn about duplicated if-else-if conditions.
        (cp_parser_implicitly_scoped_statement): Add CHAIN parameter and pass
        it down to cp_parser_statement.

        * doc/invoke.texi: Document -Wduplicated-cond.
        * Makefile.in (insn-latencytab.o): Use -Wno-duplicated-cond.
        (insn-dfatab.o): Likewise.
        * genemit.c (gen_exp): Rewrite condition to avoid -Wduplicated-cond
        warning.

        * c-c++-common/Wduplicated-cond-1.c: New test.
        * c-c++-common/Wduplicated-cond-2.c: New test.
        * c-c++-common/Wduplicated-cond-3.c: New test.
        * c-c++-common/Wduplicated-cond-4.c: New test.
        * c-c++-common/Wmisleading-indentation.c (fn_37): Avoid
        -Wduplicated-cond warning.

Added:
    trunk/gcc/testsuite/c-c++-common/Wduplicated-cond-1.c
    trunk/gcc/testsuite/c-c++-common/Wduplicated-cond-2.c
    trunk/gcc/testsuite/c-c++-common/Wduplicated-cond-3.c
    trunk/gcc/testsuite/c-c++-common/Wduplicated-cond-4.c
Modified:
    trunk/gcc/ChangeLog
    trunk/gcc/Makefile.in
    trunk/gcc/c-family/ChangeLog
    trunk/gcc/c-family/c-common.c
    trunk/gcc/c-family/c-common.h
    trunk/gcc/c-family/c.opt
    trunk/gcc/c/ChangeLog
    trunk/gcc/c/c-parser.c
    trunk/gcc/cp/ChangeLog
    trunk/gcc/cp/parser.c
    trunk/gcc/doc/invoke.texi
    trunk/gcc/genemit.c
    trunk/gcc/testsuite/ChangeLog
    trunk/gcc/testsuite/c-c++-common/Wmisleading-indentation.c

Reply via email to