Issue 104415
Summary [clang-format]: The new 19 breaks pointer type alignment in macros
Labels clang-format
Assignees
Reporter oerdnj
    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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to