code-formattingclang-format

Broken BraceWrapping in clang-format in presence of an empty macro


I have the following code

enum MyFlag SOME_EMPTY_MACRO( ARG ) 
{
  MyEnumValue = 1 << 1 //!< ...
};

In my clang-format, I have BraceWrapping.AfterEnum: true

This always get transformed to (opening brace going on the line before)

enum MyFlag SOME_EMPTY_MACRO( ARG ) {
  MyEnumValue = 1 << 1 //!< ...
};

Is there anything I can do to avoid this?


Solution

  • By defining the macros (since version 17), it worked as expected:

    Macros:
      - SOME_EMPTY_MACRO(x)=x