RESOLVED FIXED 35717
check-webkit-style: false positive for empty loop
https://bugs.webkit.org/show_bug.cgi?id=35717
Summary check-webkit-style: false positive for empty loop
Shinichiro Hamaji
Reported 2010-03-03 22:01:56 PST
For loops like "for (...) {}", check-webkit-style thinks the opened brace isn't closed and produces a false alarm for the close brace in two lines below. void foo() { for (int i = 0; i < 100; i++) { } return; } // check-webkit-style thinks this close brace corresponds to the open brace after "for (...)" . test.cpp:5: One line control clauses should not use braces. [whitespace/braces] [4] Total errors found: 1 in 1 files See Bug 35557 for a real example.
Attachments
Patch v1 (2.60 KB, patch)
2010-03-03 22:02 PST, Shinichiro Hamaji
no flags
Patch v2 (2.55 KB, patch)
2010-03-04 18:58 PST, Shinichiro Hamaji
eric: review+
Shinichiro Hamaji
Comment 1 2010-03-03 22:02:54 PST
Created attachment 49984 [details] Patch v1
Eric Seidel (no email)
Comment 2 2010-03-04 14:03:26 PST
Comment on attachment 49984 [details] Patch v1 I'm not sure I understand. Why would one ever want if (foo) {}? Can you point to the style guide as to where this is documented? Or maybe the tests just need to be changed to use for or while.
Shinichiro Hamaji
Comment 3 2010-03-04 18:58:13 PST
Created attachment 50080 [details] Patch v2
Shinichiro Hamaji
Comment 4 2010-03-04 18:59:55 PST
> Can you point to the style guide as to where this is documented? Or maybe the > tests just need to be changed to use for or while. Oops! Yes, we need to use for or while to make the tests reasonable. Thanks for catching this.
Eric Seidel (no email)
Comment 5 2010-03-05 13:18:46 PST
Comment on attachment 50080 [details] Patch v2 OK. "while (condition)" would still be better with a real example of a useful "condition", but this looks OK.
WebKit Commit Bot
Comment 6 2010-03-05 14:05:11 PST
Attachment 50080 [details] was posted by a committer and has review+, assigning to Shinichiro Hamaji for commit.
Shinichiro Hamaji
Comment 7 2010-03-07 22:56:09 PST
Note You need to log in before you can comment on or make changes to this bug.