Created
November 29, 2017 10:13
-
-
Save clemensg/7665cec5a020680cffa06bfcad6fc809 to your computer and use it in GitHub Desktop.
Bug 34649 - clang-format messes up comment indentations - Problem 2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main(void) | |
{ | |
int a = 1; | |
/* FOO begins */ | |
#ifndef FOO | |
if (a) | |
{ | |
return; | |
} | |
#endif | |
/* FOO ends */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
clang-format 9.0.0 changes it to:
I think it should stay as it was, instead..
Usecase for these comments at the beginning and end of very long ifdef blocks is to tell the reader what the ifdef was about.
Example:
I personally don't use this style (I'd rather add the comment in the line of the endif or just in the git commit message) but we have a large legacy codebase with thousands of such comments we'd like to reformat but can't because this kind of comment indentation makes it even less readable than it is right now.
.clang-format
being used is https://gist.github.com/clemensg/be1dc3f2c4442a995cba3d8068917848