From deef71132774618d06d571e935d10753f92d8ad9 Mon Sep 17 00:00:00 2001 From: Marek Polacek Date: Wed, 4 May 2016 16:00:33 +0000 Subject: c.opt (Wdangling-else): New option. * c.opt (Wdangling-else): New option. * c-parser.c (c_parser_if_statement): Replace OPT_Wparentheses with OPT_Wdangling_else. * parser.c (cp_parser_selection_statement): Replace OPT_Wparentheses with OPT_Wdangling_else. * doc/invoke.texi: Document -Wdangling-else. * c-c++-common/Wdangling-else-1.c: New test. * c-c++-common/Wdangling-else-2.c: New test. * c-c++-common/Wdangling-else-3.c: New test. From-SVN: r235885 --- gcc/c/ChangeLog | 5 +++++ gcc/c/c-parser.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'gcc/c') diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog index 517a8c6..1e77ef5e 100644 --- a/gcc/c/ChangeLog +++ b/gcc/c/ChangeLog @@ -1,5 +1,10 @@ 2016-05-04 Marek Polacek + * c-parser.c (c_parser_if_statement): Replace OPT_Wparentheses with + OPT_Wdangling_else. + +2016-05-04 Marek Polacek + PR c/48778 * c-typeck.c (build_binary_op): Don't issue -Waddress warnings for macro expansions. diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c index 701ab45..d275f8e 100644 --- a/gcc/c/c-parser.c +++ b/gcc/c/c-parser.c @@ -5542,7 +5542,7 @@ c_parser_if_statement (c_parser *parser, bool *if_p, vec *chain) /* Diagnose an ambiguous else if if-then-else is nested inside if-then. */ if (nested_if) - warning_at (loc, OPT_Wparentheses, + warning_at (loc, OPT_Wdangling_else, "suggest explicit braces to avoid ambiguous %"); if (warn_duplicated_cond) -- cgit v1.1