<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/61603>61603</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-format] Parenthesized macro argument gets treated as type cast
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
eywdck2l
</td>
</tr>
</table>
<pre>
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.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VE1v4zYQ_TXUZWCDpj4sHXRI6qoboCgWmwAtejFG4lBiQ4kqSdlxf31BKUmx6DbooTUI83PevHkzGvRe9xNRzfJ7lp8SXMJgXU23q-yehUlaK2_1Ez4TKOuAXnCcDUEYtAejJwI9Acvv173Shlh-YqIcQpg9S--YaJhoeh2Gpd13dmSiCdZd0EjPRGP0tLww0bTGtkw0eCClsD1iiikTjXT6Qi6-mygw0Vy1I0M-HjhCE-g5rsK1rJhoPLp9x0T6Y54xUUXP_MT423_BX8e2FakkFbl_efq5rM6Pd1_OxQ-ffj0_fr776fxw-oWJsqMpkDsrR78zUQHLv9ts4fXHRPk-9BSiz78Z7b6J_-n7u9MKKRrI3xYiAnyT69thZ3Dqd8q6EQMrODga7YU8hIHAz9iRB3R2meR6wgq-YwXf_18q_Ivwd_9V8E8DQYeLJ7Bqq7vZ2dbQCNrDsVBVqUqeHSXtAeLb2dne4QhXuxgJwRGGv9D_kW7UFD0ICLc5-vPBv-J1dhx1iBN5uOowbCQC-fBxnV3IaXVrtpRFqcR4O-spAAJLT1HDbb_ReV_vDiy9Z2JVJb3_QJgHUKgNSQh2ZQfLvPFD6K2VcMVbvFL6Za2JN9WugzYEA1701MeLDQyVdTTSFLSdSMIy6bCGCD5oY2BGH_V4tPAAOIJf2lGHEBEQ2qUHR7N1rzrryQdCGdOFMGPohn0i61RWaYUJ1YfiWGU5z4ssGepStVJyxUV6PKZdnqmDFFR2eZGpY5VRmehacJHyVAguuMiy_YEIK16IQ57KLFecZZxG1GZvzGXcW9cn2vuF6uJQ8DQx2JLxa28T4qtvSIjY7VwdzXbt0nuWcaNj2t-Bgg5m7YtfGeYn-IyOpjCQ13-QhBE7ZwFdv0T9oKfgt7IjGUvqvaCSxZn6g84Y_b5Ou9nZ36iLbW-NJja9NaA_AwAA__-qMLY5">