<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/62978>62978</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-format] C if() and #if () preprocessor cannot be treated differently with spaces
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
sotten
</td>
</tr>
</table>
<pre>
Used clang-format version: 16.0.4
I have the following C code:
```
int main() {
int var = 0;
if (var == 3) {
var = 2;
}
#if (foo == 3)
var = 1;
#endif
return var;
}
```
desired clang-format output:
```
int main() {
int var = 0;
if(var == 3) {
var = 2;
}
#if (foo == 3)
var = 1;
#endif
return var;
}
```
I can only configure clang-format so that either
```
if(...)
#if(...)
```
or
```
if (...)
#if (...)
```
but not the desired behavior:
```
if(...)
#if (...)
```
I also tried to create a macro vector `IfMacros: ["#if"]`, but the # is ignored.
Am I doing something wrong?
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy0VMuOqzgQ_RqzKTUidiCwYJHuKFIWs5wPMLgAj8AV2UWi_vuRyavTjxld6V6EBNTjuM6pKnQItneItchfRb5L9MwD-ToQM7qkIfNe_x3QQDtq17905CfNcEIfLDmhtrAq0ixdi2wnsu0BBn1C4AGho3Gks3U9vEFLBoXaXmJEkV3v5dM6hklbJ2QpZAVi83qxAwBE30l7EGoHmVAfPR0IWV590a2-JMfrliyfksVmdy1FqgtQR_QR6BF6A1jdAYRU6IztHjEeefYuhj6C7ic8kzUYrP-sJc18nPl36_Of8vx5XX5BlAO02gG58R1acp3tZ4_PCgUCHjQDWh7Qfy9TJJym6b3KhcNn23MO_QQF32F9MT5nNTODI15m_9bmBgd9suR_7O23Rf_PQTfR9Bhl8RYNMEHrUTOChkm3nuCELZMHUWSH7q9oCXFV44ZLeVVGinwXQeUbxNpj3UIqsAFs78ijSS8nbSc4gKG4yYEm5CG-nT25Xqh9YmplKlXpBOtVUeYqU1Umk6E2VVZWWKjGrAqtTdmVpltjpQvZbMqqahNby0yqLJflqspLKdM8azdN3qzNqiqkKguxznDSdkzH8TSl5PvEhjBjXchqUyajbnAM9YWRwzMszgurxNcx56WZ-yDW2WgDhwcKWx6Xn93HERP5Dt4uWxM3RTsD915Ew9Hj0VOLIZCP4xo73SDworoBY7sOPToe3-FseYBw1C2GZPZjPTAfo_pC7oXc95aHuUlbmoTcx5quj5ejp3-wZSH3C5Mg5H5h-m8AAAD__3W4h8M">