| Issue |
75568
|
| Summary |
The macro formatting results for structure initialization are abnormal.[clang-format]
|
| Labels |
clang-format
|
| Assignees |
|
| Reporter |
Gaochenchang
|
**clang-format --version**
```
Ubuntu clang-format version 18.0.0 (++20231204064238+4d4c30a37c75-1~exp1~20231204184349.1666)
```
**Problem Description**
The macro formatting results for structure initialization are abnormal.
**Format content**
```
#define TEST_CFG_DEFAULT() { \
.type = VIDEO_STREAM_WRITER, \
.transmit_mode = VIDEO_MODE, \
.std_config = { \
.clk_cfg = CLK_DEFAULT_CONFIG(44100), \
.slot_cfg = SLOT_DEFAULT_CONFIG(DATA_BIT_WIDTH_16BIT), \
.gpio_cfg = { \
.invert_flags = { \
.bclk_inv = false, \
.ws_inv = false, \
}, \
}, \
}, \
.chan_cfg = CHAN_TEST_DEFAULT_CONFIG(NUM_0, ROLE_MASTER), \
.use_alc = false, \
.volume = 0, \
}
```
**Desired formatting result**
```
#define TEST_CFG_DEFAULT() { \
.type = VIDEO_STREAM_WRITER, \
.transmit_mode = VIDEO_MODE, \
.std_config = { \
.clk_cfg = CLK_DEFAULT_CONFIG(44100), \
.slot_cfg = SLOT_DEFAULT_CONFIG(DATA_BIT_WIDTH_16BIT), \
.gpio_cfg = { \
.invert_flags = { \
.bclk_inv = false, \
.ws_inv = false, \
}, \
}, \
}, \
.chan_cfg = CHAN_TEST_DEFAULT_CONFIG(NUM_0, ROLE_MASTER), \
.use_alc = false, \
.volume = 0, \
}
```
**Actual formatting results**
```
#define TEST_CFG_DEFAULT() \
{ \
.type = VIDEO_STREAM_WRITER, \
.transmit_mode = VIDEO_MODE, \
.std_config = { \
.clk_cfg = CLK_DEFAULT_CONFIG(44100), \
.slot_cfg = SLOT_DEFAULT_CONFIG(DATA_BIT_WIDTH_16BIT), \
.gpio_cfg = { \
.invert_flags = { \
.bclk_inv = false, \
.ws_inv = false, \
}, \
}, \
}, \
.chan_cfg = CHAN_TEST_DEFAULT_CONFIG(NUM_0, ROLE_MASTER), .use_alc = false, .volume = 0, \
}
```
**.clang-format file content**
```
BasedOnStyle: WebKit
Language: Cpp
IndentWidth: 4
MaxEmptyLinesToKeep: 1
IncludeCategories:
- Regex: '^<.*\.h>'
Priority: 1
- Regex: '^"freertos.*\.h"'
Priority: 2
- Regex: '^"esp_.*\.h"'
Priority: 3
- Regex: '^"audio_.*\.h"'
Priority: 4
SortIncludes: false
InsertBraces: true
PointerAlignment: Right
IndentCaseLabels: true
BraceWrapping:
AfterFunction: true
AfterStruct: false
BreakBeforeBraces: Custom
AlignConsecutiveMacros:
Enabled: true
AcrossComments: true
AcrossEmptyLines: false
AlignConsecutiveAssignments:
Enabled: true
AcrossComments: true
AcrossEmptyLines: false
AlignCompound: false
PadOperators: true
AlignConsecutiveDeclarations:
Enabled: true
AcrossComments: true
AcrossEmptyLines: false
AlignCompound: false
PadOperators: true
AlignTrailingComments:
Kind: Always
OverEmptyLines: 2
AlignAfterOpenBracket: true
IndentPPDirectives: BeforeHash
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs