summaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authormpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>2016-05-04 16:00:33 +0000
committermpolacek <mpolacek@138bc75d-0d04-0410-961f-82ee72b054a4>2016-05-04 16:00:33 +0000
commit1d52c456bf6b516767799042d378d0cc36733d60 (patch)
tree8b890b5273bda4aece838374284c4c95a65d2d0c /gcc/c
parentdc5815737294a00a461e7c67dee6a5b9b596ee96 (diff)
downloadgcc-1d52c456bf6b516767799042d378d0cc36733d60.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@235885 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/ChangeLog5
-rw-r--r--gcc/c/c-parser.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/gcc/c/ChangeLog b/gcc/c/ChangeLog
index 517a8c6c02e..1e77ef5e40f 100644
--- a/gcc/c/ChangeLog
+++ b/gcc/c/ChangeLog
@@ -1,5 +1,10 @@
2016-05-04 Marek Polacek <polacek@redhat.com>
+ * c-parser.c (c_parser_if_statement): Replace OPT_Wparentheses with
+ OPT_Wdangling_else.
+
+2016-05-04 Marek Polacek <polacek@redhat.com>
+
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 701ab45ff89..d275f8ef594 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<tree> *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 %<else%>");
if (warn_duplicated_cond)