<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/114408>114408</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[clang-format] bug in c formatting when "switch" appears as a token
</td>
</tr>
<tr>
<th>Labels</th>
<td>
clang-format
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
mtfurlan
</td>
</tr>
</table>
<pre>
This is a c file that is correctly formatted according to clang-format 18, but not according to clang-format 19
`clang-format --dry-run --Werror --style="{BasedOnStyle: llvm, BreakBeforeBraces: Linux}" test.c`
```
FOOBAR(switch); // if we use a word that isn't "switch" everything is fine
// if we do use "switch", the "BreakBeforeBraces: Linux" isn't respected and it
// tries to do "void foo(void) {"
void foo(void)
{
int i = 5;
printf("foo: %d\n", i);
}
```
I bisected it to `236b3e1aad45e2bab8ede0da6397b7b01f9cc9d8 [clang-format] Handle Java switch expressions (#91112)`
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJx8U12P6yYQ_TXkZeQIBn8--GF9o6itKq3UVuozhnFMrwMR4OzNv6-ws7e7vVUly8bDzBzOcI6K0V4cUc-qgVWng1rT7EN_TdMaFuUOozeP_o_ZRrARFGiY7EKQZpVyQPsQSKflAZMPV5USGVBa-2Csu0DyoBflLsW-CaJl-AXGNYHz6UPej4kd4yfGX1jNP8WLwoRHEVYHRfEnheADFEVMj4WYPDFE1gyDimRe3e978AWW5X7NqEMg9XWgyQcagtIU8-av1q3fWJNLIVFMR81q_h36-Wy_59fX4eU3hm18s0nPDDsmB2B4ZngGO8EbwRoJFLz5YN7H4xg2CRjiexEC3Sk80pxZ2wiTdfSE-9jJ-K3Zx8JMIc1b7H-YIH5HDRRvpLf7cAZs-gSTgqWYp2587nj31sDkPcM2Lxl2wJoho-5F2_vHpOduM8C-ArAugQUmT1AxObxHb8G6NDFsGWJuIF-AYWVY9cU9mdl9nu8NT_95BT_DaONOyaZ8eFZzlPUoSShlyopwVGNLhrhRteyasRm5mDqtO9MCq4aPSmLVCX5SziwEv6i7gn3OQN9ugWK03kXYzis7IQTm09X8YHppOtmpA_WikVy2spLiMPe1LrlA3kgpUIqm7bSSdc6YalPVtTjYHjmWgkshSl5JcdRoDJelqap2NCg4KzldlV2OWa1HHy4HG-NKvRBlydvDokZa4uZQxE80ELNnQ5_rinG9RFbyxcYU_-mUbFo2d_-b_7hewLrs6N26WZNvM7nPglW3G6kQQWX3J_-V3GENSz-ndMvC2wV1sWlex6P2V4bn3XHbp7gF_xfpxPC8EYoMz09O9x7_DgAA__-kMVzd">