I'm using c-style X macros to create two way enums like this:
namespace ns
{
#define CFG_INT_TABLE \
X(CFG_1, "cfg_1", invalid_int_value), \
X(CFG_2, "cfg_2", invalid_int_value), \
X(CFG_3, "cfg_3", 10)
#define X(a,b,c) a
enum class IntegerConfigs : int
{
CFG_INT_TABLE,
TOTAL_ELEMENTS
}
#undef X
#define X(a,b,c) b
array ...
#undef X
[...]
}
however when running clang-format, It indents the lines like this:
#define CFG_INT_TABLE \
X(CFG_1, "cfg_1", invalid_int_value), \
X(CFG_2, "cfg_2", invalid_int_value), \
X(CFG_3, "cfg_3", 10)
I couldn't understand from clang-format's options how to indent the code properly, I prefer a fix that only changes .clang-format
file and not the code itself if possible.
this is my .clang-format
file:
BasedOnStyle: GNU
AccessModifierOffset: -2
ColumnLimit: 100
IndentWidth: 4
AlwaysBreakAfterDefinitionReturnType: None
AlwaysBreakAfterReturnType: None
FixNamespaceComments: true
SpaceBeforeParens: ControlStatements
AllowShortFunctionsOnASingleLine: Empty
NamespaceIndentation: All
BreakConstructorInitializers: AfterColon
ReferenceAlignment: Left
BreakBeforeBraces: Custom
Standard: c++20
AlwaysBreakTemplateDeclarations: Yes
BinPackArguments: false
BinPackParameters: false
BraceWrapping:
AfterClass: true
AfterControlStatement: false
AfterEnum: true
AfterFunction: true
AfterNamespace: true
AfterStruct: true
AfterUnion: true
BeforeCatch: false
BeforeElse: false
IndentBraces: false
Thank you!