<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/56226>56226</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
clang-format: does not respect PointerAlignment with multiple declarations on a single line.
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
kspalaiologos
</td>
</tr>
</table>
<pre>
I use the following `.clang-format` file:
```
---
BasedOnStyle: Google
DerivePointerAlignment: 'false'
PointerAlignment: Middle
...
```
Given the following code:
```c
#include <stdio.h>
int main(void) {
char*x;
float*y;
int*p1,*p2;
}
```
I expected the following output after executing `clang-format -i test.c`:
```c
#include <stdio.h>
int main(void) {
char * x;
float * y;
int * p1, * p2;
}
```
Unfortunately, `PointerAlignment: Middle` is not respected when there are many declarations on a single line:
```c
#include <stdio.h>
int main(void) {
char * x;
float * y;
int *p1, *p2;
}
```
I use `Debian clang-format version 13.0.1-6` on `Linux legendre 5.18.0-2-amd64 #1 SMP PREEMPT_DYNAMIC Debian 5.18.5-1 (2022-06-16) x86_64 GNU/Linux`.
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJy9VEtzmzAQ_jXisgMDwsb4wMGJk0xm6tTTNIeeMgKtQa0seZDw4993wU4ap2mmuYQR0r60j293VFp5KG6hcwi-QVhZre1OmRpYFkeVFqYOV7ZdC088rJRGls5YPGfx057FpzWwYRgeiQvhUH419_4wXIEba2uiBt0cW7XFpVXGYzvTqjZrNL63YnyyEtohnUfTt4wWSsonV8c9iqI3sznuNxTMvKqusvKflVQnnqfKVLqTCCy9dF4qGzUsvXp5h5KDtVCG8XxrlWR8CmxycdQBfVUjWsZne5a-EK60JTj57HAmJVck2ySMX_Ynf1ayyfyd4m4B9xusPMpXFdrObzoPYkXwkQ1WnT-19WVXIVTg0fmo6v1-DiDU5Rm8Ackg_wuUQTrAcqT-F5gHQxX6zgiP-jDczuJ3pommWzkw1kOL7gTorjnOTYsg6F8LcwCJBF8rvLLGgTUgwBGsGkEr81kT9XEAn_H7wFz1TwIJ51gqYeBsaLbYOgIAkjSKoyTMevSIpeOLMt0eNNZoJEE2jpI8ikMeirXMRpRAmsD9YgnLb1dXi-X3x_mPu9ni9hJOQQbzcZiQYc5jzsM4C5Osx2CfZ4_k4ObugfHrIUj_PgWySOU0nYrAK6-xOHuvqLfS4llP4fUAwE75Btad9mpDPXy3uVHQtbpovN-4vs_8mlZN17syquyaGK23T0e4ae1PCkiscq5DR8Q44zwLmkKMZSJGJVY5fTLLqzwZTacrKVNejlFOAy1K1K5g4wvGucEdDC6IZuN5oIoemDjjWTxJcz6NMJMTHGEyKuVU5MjZKEYaIB31eUS2rYO2GFIqu9qRUivn3R-lcI6wQBzCkX_R-ca2xS-3EVooq21tXTAkUAwF_AZRSsmL">