-
Notifications
You must be signed in to change notification settings - Fork 13.4k
clang-format: Wrong spacing in macro with C-style cast and address-of operator #83400
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
Comments
This change was made in 7a4cdbe (https://reviews.llvm.org/D153745) |
C-style casts to user-defined types can be handled by the |
While I agree that the patch linked below is a good improvement to the clang-format heuristics, I agree with @zygoloid's comments in the linked PR that |
@arichardson patches are welcome! |
We noticed a regression in clang-format when moving from clang-format 16 to 17 in godotengine/godot: godotengine/godot#88959
The following test case reproduces the issue with the default clang-format config:
This is formatted as is by clang-format 16, but running clang-format 17 generates the following diff:
It seems to treat
&
as a bitwise operator instead of address-of operator.Here's a reproduction project with this test case, and a config for
pre-commit
to run both clang-format 16 and 17 in turns. You can set it up with:clang_format_operator_spacing.zip
Real life examples found in Godot:
But you can also see in the same PR godotengine/godot#88959 that other cases where
&
is a bitwise operator were fixed by clang-format. I'm not sure there's any easy way for clang-format to know which is which, if so I understand if this is considered a "won't fix".The text was updated successfully, but these errors were encountered: