An option to disable formatting for macro definitions (original) (raw)
September 28, 2023, 11:34am 1
Hi!
So far I haven’t found a way to tell clang-format to not touch macro definitions. I’ve run into two cases where I think clang-format is doing the wrong thing:
First:
#define A(x) x:
will be formatted as:
#define A(x) \
x:
and second case:
#define A A is deprecated. Use B instead.
will become:
#define A A is deprecated.Use B instead.
A flag like IncludeMacroDefintions set to false should be a pretty straightforward solution.
That would be a nice blanket option yes. In the meantime, you can use /* clang-format off */ and /* clang-format on */ comments.
Thank you for the reply!
I’ll create a feature request on github for it.
Opened a PR with a proposal for such option