<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/54264>54264</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Clang-format: Macros which include braces
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
fulcrumEFX
</td>
</tr>
</table>
<pre>
Hey,
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.
For reference, here is my .clang-format file:
`---
BasedOnStyle: LLVM
AlignAfterOpenBracket: Align
AlignConsecutiveAssignments: 'false'
AlignConsecutiveDeclarations: 'false'
AlignConsecutiveMacros: 'Consecutive'
AlignEscapedNewlines: Left
AlignOperands: 'true'
AlignTrailingComments: 'true'
AllowAllArgumentsOnNextLine: 'false'
AllowAllParametersOfDeclarationOnNextLine: 'false'
AllowShortBlocksOnASingleLine: 'Never'
AllowShortCaseLabelsOnASingleLine: 'false'
AllowShortFunctionsOnASingleLine: None
AllowShortIfStatementsOnASingleLine: Never
AllowShortLoopsOnASingleLine: 'false'
AlwaysBreakAfterReturnType: None
AlwaysBreakBeforeMultilineStrings: 'false'
AlwaysBreakTemplateDeclarations: MultiLine
BinPackArguments: 'true'
BinPackParameters: 'true'
BreakBeforeBinaryOperators: None
# BreakBeforeBraces: Attach
BreakBeforeTernaryOperators: 'true'
ColumnLimit: '120'
IndentPPDirectives: AfterHash
IndentWidth: '2'
Language: Cpp
PointerAlignment: Right
ReflowComments: 'true'
SpaceAfterCStyleCast: 'false'
SpaceBeforeAssignmentOperators: 'true'
SpaceBeforeParens: ControlStatements
SpacesInCStyleCastParentheses: 'false'
TabWidth: '2'
UseTab: Never
SortIncludes: false
...`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJyFVl1v4jgU_TXwYjViQoHpAw9ABxWJlqp0dvdt5Tg3H1vHjmynDP9-jx0-QulMBQJin_t17vE1iU730wfa9-JFbzBbsYK_ExOGuKOUcRYJyVV-k2lTcceyUhJzmh0eqz0TOqWIrZjSrhTBojY6kVQxVwDhCjqCdcYqLoy2iMQoyiPWi4cpZaUiy3Jy-OAGlilL4LYbdVeQYo0tVc4SwwXgpQqeW2vvD0hGv3hVS-oNZyjEv8eDUwS23Gz-nc9eWG8yz7T2Jgk3vcm9Bw1mIdwxUVHgwQdB-voLbyNPGvNe2dktO_l90DsmuAI_jqRkF2FAI0hjlQbfLVca7CnaMemLGi7ZKmOHflhdkSs8AbJ8oz8lFH_vlBffdco7spnqtjahjSHh5J5xhb7JMldhnQvspD4WEkKHLTmHJ-u7vCPle2p0kxehA7p2pYadVqxwrraerniJdwgZSfleRdrkWEi1QOeXC7--DJls3V7SpnUQFa6SLGkcOEE50ErXOwRgCGkynbyXurHgQzZ-ywfijT0ZHLXn5VBR1BI1U3tWkKwZFsEhhMbhLfcS98XXNWgovdwPeGTHDGUIqUQQV4heWk_G9XHoCuTm5gY_5txSulGhPOyy9fqvR5-GZ3iWOTKbmtQcQn4j5_fDxhGwQL0kUNw7zazFQgXKPa1o7STj0iKjySfge0Jmhge-vkY_tgexxXXWO-gfVvCa0ifaeTkG7Joyd9xGDQa6Ofpwpukavxpewixf6Kqbfxcl9Q4fM5M3AbFRT_TLrYPyr7Nvwc8oEOeAjN1knXq_NN0W2ri51OINYWZb5CWpA3-idzIf4Qs0cc0Tkp-afBph2SgR-L-yeIKmL6CrbOuguEPlH9Ehny58rXX9dR47vrdzqPotiOyFXGPU676-zOAEmhNETI-NdL5TtHXGH_I_-n0lzFek_VF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