aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family/c.opt
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2015-10-02 12:56:17 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2015-10-02 12:56:17 +0000
commit3e3b8d63e54773e0f5add898ad55acf1be22d950 (patch)
tree2068f8ebdec3daf3c4cd446ea0c01a7dfe75c37d /gcc/c-family/c.opt
parent0f6ca79c15711e28ea7a6330fc9ac017077fbaad (diff)
downloadgcc-3e3b8d63e54773e0f5add898ad55acf1be22d950.zip
gcc-3e3b8d63e54773e0f5add898ad55acf1be22d950.tar.gz
gcc-3e3b8d63e54773e0f5add898ad55acf1be22d950.tar.bz2
re PR c/64249 (Missing warning for if (A) else if (A))
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. From-SVN: r228388
Diffstat (limited to 'gcc/c-family/c.opt')
-rw-r--r--gcc/c-family/c.opt4
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/c-family/c.opt b/gcc/c-family/c.opt
index b79c143..a79b9f1 100644
--- a/gcc/c-family/c.opt
+++ b/gcc/c-family/c.opt
@@ -406,6 +406,10 @@ Wdiv-by-zero
C ObjC C++ ObjC++ Var(warn_div_by_zero) Init(1) Warning
Warn about compile-time integer division by zero
+Wduplicated-cond
+C ObjC C++ ObjC++ Var(warn_duplicated_cond) Warning LangEnabledBy(C ObjC C++ ObjC++,Wall)
+Warn about duplicated conditions in an if-else-if chain
+
Weffc++
C++ ObjC++ Var(warn_ecpp) Warning
Warn about violations of Effective C++ style rules