| Issue |
61603
|
| Summary |
[clang-format] Parenthesized macro argument gets treated as type cast
|
| Labels |
clang-format
|
| Assignees |
|
| Reporter |
eywdck2l
|
Take for example this line in [this file](https://github.com/torvalds/linux/blob/a1effab7a3a3/drivers/net/wireless/realtek/rtw89/sar.c#L54):
```
#define RTW89_SAR_6GHZ_SPAN_IDX(center_freq) \
((((int)(center_freq) - RTW89_SAR_6GHZ_SPAN_HEAD) / 5) / 2)
```
`clang-format` removes the spaces around the `-`.
```
#define RTW89_SAR_6GHZ_SPAN_IDX(center_freq) \
((((int)(center_freq)-RTW89_SAR_6GHZ_SPAN_HEAD) / 5) / 2)
```
The cause of this problem is 76f98f8047de. The program would treat
`(int)(center_freq)` as 2 type casts. The commit comes with this test:
```
verifyFormat("my_int a = (my_int)(my_int)-1;");
```
I failed to come up with a good way to fix the problem while having the
aforementioned unit test still pass. So I am submitting a bug report
instead of a patch.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs