When formatting the same file with the clang-format command line tool twice, changes are made both times.
My understanding is that once formatted, attempting to re-format the same file should not yield any changes.
Here's the test I ran:
Input file
$ cat test.c
//********************************************** AAAAAAA BBBB***************************************************//
- First format - Changes made as expected
$ clang-format -i test.c
$ cat test.c
//********************************************** AAAAAAA
//BBBB***************************************************//
- Second format - Unexpected change in line two (extra space was added before
BBBB
)**
$ clang-format -i test.c
$ cat test.c
//********************************************** AAAAAAA
// BBBB***************************************************//
- Third format - finally yields the same results.
The version I'm using is: 10.0.0-++20200323042644+d32170dbd5b-1~exp1~20200323154014.129
on Ubuntu 18.04.2
(note that I managed to reproduce this behavior in clang-format-9
as well)
Is this a bug I ran into, or is my initial assumption incorrect?
Edit: Reproducible in 10.0.1-++20200507062652+bab8d1790a3-1~exp1~20200507163249.158
as well