aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family/c-indentation.c
diff options
context:
space:
mode:
authorMarek Polacek <polacek@redhat.com>2016-04-13 16:28:46 +0000
committerMarek Polacek <mpolacek@gcc.gnu.org>2016-04-13 16:28:46 +0000
commitb3a77f2137ef26d4d74cc40af7a42be7901ac98d (patch)
treeaf4aa61b9b882456a43642bc3e92952010b2e8ac /gcc/c-family/c-indentation.c
parent99cd9857c01234bb5b6cbff54e1bd2a400c04179 (diff)
downloadgcc-b3a77f2137ef26d4d74cc40af7a42be7901ac98d.zip
gcc-b3a77f2137ef26d4d74cc40af7a42be7901ac98d.tar.gz
gcc-b3a77f2137ef26d4d74cc40af7a42be7901ac98d.tar.bz2
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
Diffstat (limited to 'gcc/c-family/c-indentation.c')
-rw-r--r--gcc/c-family/c-indentation.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gcc/c-family/c-indentation.c b/gcc/c-family/c-indentation.c
index 1da3f68..8c33686 100644
--- a/gcc/c-family/c-indentation.c
+++ b/gcc/c-family/c-indentation.c
@@ -239,10 +239,11 @@ should_warn_for_misleading_indentation (const token_indent_info &guard_tinfo,
if (line_table->seen_line_directive)
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)
+ /* We can't usefully warn about do-while and switch 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
+ || guard_tinfo.keyword == RID_SWITCH)
return false;
/* If the token following the body is a close brace or an "else"