clang-format quality problem: 3 spaces following #else |
|||
Issue description
clang-format produced code that (choose all that apply):
- Doesn't match Chromium style
- Riles my finely honed stylistic dander
clang-format uses 3 spaces between #else and an end-of-line comment.
From the style guide: "end-of-line comments should be separated from the code by 2 spaces"
Here's the code before formatting:
#if BUILDFLAG(ENABLE_FOO)
DoFoo();
#else // !BUILDFLAG(ENABLE_FOO) <-- 2 spaces before comment
DoBar();
#endif // BUILDFLAG(ENABLE_FOO)
Here's the code after formatting:
#if BUILDFLAG(ENABLE_FOO)
DoFoo();
#else // !BUILDFLAG(ENABLE_FOO) <-- 3 spaces before comment
DoBar();
#endif // BUILDFLAG(ENABLE_FOO)
Here's how it ought to look:
(The code before formatting.)
Code review link for full files/context:
This was noticed in https://codereview.chromium.org/2874833002/diff/20001/chrome/browser/ui/tab_contents/core_tab_helper.cc
,
May 15 2017
But if there's only 1 or 2 lines in between the #else I think you should just omit the comment; it adds more noise than it helps with readability.
,
May 15 2017
Without the #endif comment, it produces the correct spacing for the #else. So, yeah, it's probably alignment.
,
Oct 26 2017
,
Nov 27
|
|||
►
Sign in to add a comment |
|||
Comment 1 by thakis@chromium.org
, May 15 2017