<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/104415>104415</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-format]: The new 19 breaks pointer type alignment in macros
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
oerdnj
</td>
</tr>
</table>
<pre>
After upgrading from clang-format-18 to clang-format-19, the following has happened:
```patch
diff --git a/lib/dns/hmac_link.c b/lib/dns/hmac_link.c
index 4361fb73bf..8de785e804 100644
--- a/lib/dns/hmac_link.c
+++ b/lib/dns/hmac_link.c
@@ -53,22 +53,22 @@
#define ISC_MD_sha512 ISC_MD_SHA512
#define hmac_register_algorithm(alg) \
- static isc_result_t hmac##alg##_createctx(dst_key_t *key, \
- dst_context_t *dctx) { \
+ static isc_result_t hmac##alg##_createctx(dst_key_t * key, \
+ dst_context_t * dctx) { \
return (hmac_createctx(ISC_MD_##alg, key, dctx)); \
} \
- static void hmac##alg##_destroyctx(dst_context_t *dctx) { \
+ static void hmac##alg##_destroyctx(dst_context_t * dctx) { \
hmac_destroyctx(dctx); \
} \
- static isc_result_t hmac##alg##_adddata(dst_context_t *dctx, \
+ static isc_result_t hmac##alg##_adddata(dst_context_t * dctx, \
const isc_region_t *data) { \
return (hmac_adddata(dctx, data)); \
} \
- static isc_result_t hmac##alg##_sign(dst_context_t *dctx, \
- isc_buffer_t *sig) { \
+ static isc_result_t hmac##alg##_sign(dst_context_t * dctx, \
+ isc_buffer_t * sig) { \
return (hmac_sign(dctx, sig)); \
} \
- static isc_result_t hmac##alg##_verify(dst_context_t *dctx, \
+ static isc_result_t hmac##alg##_verify(dst_context_t * dctx, \
const isc_region_t *sig) { \
return (hmac_verify(dctx, sig)); \
} \
```
And the configuration we use for formatting C files is:
```
BasedOnStyle: LLVM
IndentWidth: 8
UseTab: Always
BreakBeforeBraces: Custom
BraceWrapping:
AfterClass: false
AfterEnum: false
AfterStruct: false
AfterUnion: false
AfterControlStatement: MultiLine
AfterFunction: false # should also be MultiLine, but not yet supported
AfterExternBlock: false
BeforeElse: false
BeforeWhile: false
IndentBraces: false
SplitEmptyFunction: true
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
AlwaysBreakAfterReturnType: All
Cpp11BracedListStyle: false
ColumnLimit: 80
AlignAfterOpenBracket: Align
AlignConsecutiveBitFields: true
AlignConsecutiveDeclarations: false
AlignConsecutiveMacros: true
AlignTrailingComments: true
AllowAllArgumentsOnNextLine: true
AlwaysBreakBeforeMultilineStrings: false
BreakBeforeBinaryOperators: None
BreakBeforeTernaryOperators: true
AlignEscapedNewlines: Left
DerivePointerAlignment: false
PointerAlignment: Right
PointerBindsToType: false
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '^<(urcu\.h|urcu/urcu-|urcu-)'
Priority: 2
- Regex: '^<urcu/'
Priority: 3
- Regex: '^<isc/'
Priority: 5
- Regex: '^<(pk11|pkcs11)/'
Priority: 10
- Regex: '^<dns/'
Priority: 15
- Regex: '^<dst/'
Priority: 20
- Regex: '^<isccc/'
Priority: 25
- Regex: '^<isccfg/'
Priority: 30
- Regex: '^<ns/'
Priority: 35
- Regex: '^<irs/'
Priority: 40
- Regex: '^<(dig|named|rndc|confgen|dlz)/'
Priority: 50
- Regex: '^<dlz_'
Priority: 55
- Regex: '^".*"'
Priority: 99
- Regex: '^<tests/'
Priority: 100
- Regex: '<openssl/'
Priority: 4
- Regex: '<(mysql|protobuf-c)/'
Priority: 4
- Regex: '.*'
Priority: 0
IndentExternBlock: NoIndent
KeepEmptyLinesAtTheStartOfBlocks: false
MaxEmptyLinesToKeep: 1
PenaltyBreakAssignment: 30
PenaltyBreakComment: 10
PenaltyBreakFirstLessLess: 0
PenaltyBreakString: 80
PenaltyExcessCharacter: 100
Standard: Cpp11
ContinuationIndentWidth: 8
ForEachMacros: [ 'cds_lfs_for_each', 'cds_lfs_for_each_safe', 'cds_list_for_each_entry_safe', 'ISC_LIST_FOREACH', 'ISC_LIST_FOREACH_SAFE', 'ISC_LIST_FOREACH_REV', 'ISC_LIST_FOREACH_REV_SAFE' ]
```
It feels like `PointerAlignment: Right` is not applied, or the code is misunderstood for some reason here.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0WFFz4jgS_jXKi4qULewADzyAE2pTl5lsDdndR0pIbVsbIfkkORP2119JNmDAEO52z8VMwN39dffXLaltaq0oFMAUpXOUPt7R2pXaTDUYrv68W2u-nc5yBwbXVWEoF6rAudEbzCRVxSDXZkPdIB5jp09uTRDJsCsB51pK_dMbltTiklYVKOBoOEPRI4p2_z9EzaeijpXNPS7yHA8GhXCYIrKQYo3IgiuLyKLcULaSQr3fM7y-LGtwhOLwiZPhQ5yvR8N1fn8_5jAapzCOEhxH0UOSNIqDweCapzZSMm8-XztGSYSSCA_SISIZIRiR-f5rEDVqGJEhh1wowM_LbPXtcWVLmsZk92v5yyyNSZetjkVwaqAQ1oFZUVloI1y5QWRMZYHIBKM0a7PDzWUddYJhYb2draVbuYCCyBCRYbDyX1bMAHXA3CciY27d6h22K4cRmb3D1tf2DPj2y8MxrRx8ugaSBzcTjEbzVmWP7pn-hwLHbeTd68jPWVz4LLC9PjbgaqMwIuNQg67XtnCdwLKd7xbQf4Zz3B8KRqPHi3X70IL3ps3BOqO3h7wvMnyZ2_8R_Jyms5ROrkDZMWhLzHB-bnWNjy_bgXLOqaOXSckutcM_5gefOTqkyLSyrkUvhFZtZAFpT-jFrus4bV20lv8XKv1RcRuP3ZgHAXhd5zmYRt-Koq9b_g77l0I7p_7Uz2lw-EJ0F2uwc906asz7FnjPddua_zL7DzAi314rzd-g9jJ4D7kXV_wXV_8yOC3FRfSTkhxC_u-Lcn3J7AeV7nk8UzyMOkyrXBS1oU5ohX8Crq2ffwxuhiLnh6AM50KCxcIeRqBjzDm1wF_V0m0loOEMv7z8_q2RPCsOyv0huCu9YNzc_c3CG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