Issue |
126959
|
Summary |
[clang-format] Different runs produce different formatting for the same code
|
Labels |
clang-format
|
Assignees |
|
Reporter |
pskrgag
|
I've observed odd clang-format behavior on some proprietary code base. Clang format reformats the same line each run. Below code is MRE, but not something real
```c
#define STRINGIFY(s)
__asm__("ccccccc " STRINGIFY(AAAAAAAAAAAAAAAAAAA) "bbbbb aaaaaaaaaaaaaaa");
````
Reduced config file
```
---
BreakStringLiterals: false
...
```
And here is what clang-format produces
```bash
/tmp
paskripkin > clang-format test.c > test1.c
/tmp
paskripkin > cat test.c
───────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ File: test.c
───────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ #define STRINGIFY(s)
2 │
3 │ __asm__("ccccccc " STRINGIFY(AAAAAAAAAAAAAAAAAAA) "bbbbb aaaaaaaaaaaaaaa");
───────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
/0.0s
/tmp
paskripkin > clang-format test.c > test1.c
/0.0s
/tmp
paskripkin > cat test1.c
───────┬─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
│ File: test1.c
───────┼─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
1 │ #define STRINGIFY(s)
2 │
3 │ __asm__(
4 │ "ccccccc " STRINGIFY(AAAAAAAAAAAAAAAAAAA) "bbbbb aaaaaaaaaaaaaaa");
───────┴─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
/0.0s
/tmp
paskripkin > clang-format test1.c
#define STRINGIFY(s)
__asm__("ccccccc " STRINGIFY(AAAAAAAAAAAAAAAAAAA) "bbbbb aaaaaaaaaaaaaaa");
/0.0s
/tmp
paskripkin >
```
Tested on stock 19.1.0-1.fc41 in fedora and trunk on commit 2cd8207b26ea4269630feba661f68554d7ae3c15
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs