-
Notifications
You must be signed in to change notification settings - Fork 13.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent first value of header guards from being aligned (and more generally not be re-formatted) #52982
Comments
out of interest most header guards are written as
why the need for |
It is true that I've just been accustomed to always defining macros to something, which can then be tested in |
To be honest I slightly feel that if we were going to do this we'd have to add yet another option, I'm not convinced this is worth it, I mean you set it to AcrossCommentsEmptyLines and that's what you got. Lets add it as an enhancement for now but as you have a workaround My feeling is it will just sit here not getting done (unless you'd like to contibute a fix yourself) |
Why not just make header guards special and do not apply them any formatting? (like |
If I understand correctly I don't think to my knowledge that we assume anything about header guards, I've marked it as an enhancement, but honestly I can't really see it being a priority (at least for me). I just want to be clear of the expectation, That said you are free to submit patches if this is painful to you. (but it will need to be peer reviewed) I can't see it just being something that is blanket everyone wouldn't want it to align. My advice honestly, is to change your style when it comes to header guards, I know that seems super harsh but there is so much code out there like the following that people WOULD want Aligned that I fear it would be way too easy for us to miss interpret an
|
What is new is the I think the example for Header guards are explicitly excluded from indentation, and are handled by clang-format (I've for instance seen https://reviews.llvm.org/D42035). |
That's a very good point, definitely we should consider it and that's good evidence as to why we might. To be honest most changes like this need someone to champion them. |
Hi! This issue may be a good introductory issue for people new to working on LLVM. If you would like to work on this issue, your first steps are:
For more instructions on how to submit a patch to LLVM, see our documentation. If you have any further questions about this issue, don't hesitate to ask via a comment on this Github issue. @llvm/issue-subscribers-good-first-issue |
When
AcrossEmptyLinesAndComments
is used forAlignConsecutiveMacros
, alignment is done like this:Couldn't the value of the first line of the header guard not be aligned?
The text was updated successfully, but these errors were encountered: