diff options
author | ppalka <ppalka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-01-10 16:39:39 +0000 |
---|---|---|
committer | ppalka <ppalka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2016-01-10 16:39:39 +0000 |
commit | b933e5117ab860e7cf5835e7b8563d47bb202787 (patch) | |
tree | b44f1ee9713bcf26b829d8fcfa922bd4b40a40e4 /gcc/c-family/c-indentation.c | |
parent | efb73de1032a3fad134e8171227ae3e669b41132 (diff) | |
download | gcc-b933e5117ab860e7cf5835e7b8563d47bb202787.tar.gz |
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.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@232202 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/c-family/c-indentation.c')
-rw-r--r-- | gcc/c-family/c-indentation.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/gcc/c-family/c-indentation.c b/gcc/c-family/c-indentation.c index 3c09336d15a..cd9637dc3fe 100644 --- a/gcc/c-family/c-indentation.c +++ b/gcc/c-family/c-indentation.c @@ -202,6 +202,12 @@ 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) + return false; + /* If the token following the body is a close brace or an "else" then while indentation may be sloppy, there is not much ambiguity about control flow, e.g. |