Skip to content
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

[clang-format] Using Macros breaks before argument in preprocessor conditionals #92367

Open
Tamaranch opened this issue May 16, 2024 · 3 comments

Comments

@Tamaranch
Copy link

With

Macros:
  - MY_MACRO(x)=x

this code

#if SOMETHING
MY_MACRO(var);
#endif

is formatted as

#if SOMETHING
MY_MACRO(
var);
#endif

which is probably unexpected.

@Tamaranch Tamaranch changed the title Using Macros breaks before argument in preprocessor conditionals [clang-format] Using Macros breaks before argument in preprocessor conditionals May 16, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented May 16, 2024

@llvm/issue-subscribers-clang-format

Author: Gaël Bonithon (Tamaranch)

With ```yaml Macros: - MY_MACRO(x)=x ``` this code ```c #if SOMETHING MY_MACRO(var); #endif ``` is formatted as ```c #if SOMETHING MY_MACRO( var); #endif ``` which is probably unexpected.

@rymiel
Copy link
Member

rymiel commented May 16, 2024

Cannot reproduce with any version. Please provide more info, like clang-format version and other config options if they are used.

@Tamaranch
Copy link
Author

Oh sorry, I forgot the version this time: it's 17.0.6.
No additional option is needed to reproduce it, however I realize now that you need an #if-#else-#endif above in the test file, even empty:

#if
#else
#endif

#if SOMETHING
MY_MACRO(var);
#endif

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants