Commit b3a77f21 by Marek Polacek Committed by Marek Polacek

re PR c++/70639 (internal compiler error: in guard_tinfo_to_string, at…

re PR c++/70639 (internal compiler error: in guard_tinfo_to_string, at c-family/c-indentation.c:560)

	PR c++/70639
	* c-indentation.c (should_warn_for_misleading_indentation): Bail out
	for switch statements, too.

	* c-c++-common/Wmisleading-indentation-4.c: New test.

From-SVN: r234952
parent 99cd9857
2016-04-13 Marek Polacek <polacek@redhat.com>
PR c++/70639
* c-indentation.c (should_warn_for_misleading_indentation): Bail out
for switch statements, too.
2016-03-28 Jason Merrill <jason@redhat.com> 2016-03-28 Jason Merrill <jason@redhat.com>
* c-cppbuiltin.c (c_cpp_builtins): Update __cpp_range_based_for. * c-cppbuiltin.c (c_cpp_builtins): Update __cpp_range_based_for.
......
...@@ -239,10 +239,11 @@ should_warn_for_misleading_indentation (const token_indent_info &guard_tinfo, ...@@ -239,10 +239,11 @@ 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 /* We can't usefully warn about do-while and switch statements since the
statements are always explicitly delimited at both ends, so control flow is bodies of these statements are always explicitly delimited at both ends,
quite obvious. */ so control flow is quite obvious. */
if (guard_tinfo.keyword == RID_DO) if (guard_tinfo.keyword == RID_DO
|| guard_tinfo.keyword == RID_SWITCH)
return false; 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"
......
2016-04-13 Marek Polacek <polacek@redhat.com> 2016-04-13 Marek Polacek <polacek@redhat.com>
PR c++/70639
* c-c++-common/Wmisleading-indentation-4.c: New test.
2016-04-13 Marek Polacek <polacek@redhat.com>
PR c/70436 PR c/70436
* testsuite/gcc.dg/Wparentheses-12.c: New test. * testsuite/gcc.dg/Wparentheses-12.c: New test.
* testsuite/gcc.dg/Wparentheses-13.c: New test. * testsuite/gcc.dg/Wparentheses-13.c: New test.
......
/* PR c++/70639 */
/* { dg-do compile } */
/* { dg-options "-Wmisleading-indentation" } */
void bar (int);
void
foo (int x)
{
switch (x);
bar (x);
}
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