Clang format: macros which include braces

Viewed 111

I have created a .clang-format file to format my code. I noticed a problem that the format of macros, e.g. #defines gets garbled by clang-format when using braces in the define, for example:

#define FOO_BAR {foo, bar}

clang format changes it to:

#define FOO_BAR \
  { foo, bar }

How can I tell clang format to not move that to a new line? If I have something like

#define FOO_BAR (foo, bar)

clang-format does it correctly and aligns it according to my settings. I went through the options on https://clang.llvm.org/docs/ClangFormatStyleOptions.html but none of the options where an obvious solution/cause of the problem for me.

Any help or hints are greatly appreciated.

EDIT: This is a bug, see https://github.com/llvm/llvm-project/issues/53180

0 Answers
Related