Commit 21efdd80 by Patrick Palka

Fix -Wmisleading indentation false-positive for do-while statement

gcc/c-family/ChangeLog:

	PR c++/69029
	* c-indentation.c (should_warn_for_misleading_indentation):
	Don't warn about do-while statements.

gcc/testsuite/ChangeLog:

	PR c++/69029
	* c-c++-common/Wisleading-indentation.c: Augment test.

From-SVN: r232202
parent fd42eed8
gcc/c-family/ChangeLog: 2016-01-10 Patrick Palka <ppalka@gcc.gnu.org>
PR c++/69029
* c-indentation.c (should_warn_for_misleading_indentation):
Don't warn about do-while statements.
2016-01-07 Martin Sebor <msebor@redhat.com> 2016-01-07 Martin Sebor <msebor@redhat.com>
PR c/68966 PR c/68966
......
...@@ -202,6 +202,12 @@ should_warn_for_misleading_indentation (const token_indent_info &guard_tinfo, ...@@ -202,6 +202,12 @@ should_warn_for_misleading_indentation (const token_indent_info &guard_tinfo,
if (line_table->seen_line_directive) if (line_table->seen_line_directive)
return false; return false;
/* We can't usefully warn about do-while statements since the bodies of these
statements are always explicitly delimited at both ends, so control flow is
quite obvious. */
if (guard_tinfo.keyword == RID_DO)
return false;
/* If the token following the body is a close brace or an "else" /* If the token following the body is a close brace or an "else"
then while indentation may be sloppy, there is not much ambiguity then while indentation may be sloppy, there is not much ambiguity
about control flow, e.g. about control flow, e.g.
......
2016-01-10 Patrick Palka <ppalka@gcc.gnu.org>
PR c++/69029
* c-c++-common/Wisleading-indentation.c: Augment test.
2016-01-10 Thomas Koenig <tkoenig@gcc.gnu.org> 2016-01-10 Thomas Koenig <tkoenig@gcc.gnu.org>
PR fortran/69154 PR fortran/69154
......
...@@ -890,6 +890,8 @@ fn_39 (void) ...@@ -890,6 +890,8 @@ fn_39 (void)
i < 10; i < 10;
i++); i++);
foo (i); foo (i);
do foo (0); while (flagA);
} }
/* We shouldn't complain about the following function. */ /* We shouldn't complain about the following function. */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment