Hi,
I am recently using indent to format my C program. However, I found that
indent changes a file forever by adding and removing a space.
The C file I am using is attached as a.c, its base64 is:
dm9pZCBhKHZvaWQgKCpiKSh2b2lkKSkKewoJaWYg
KGIpIHsKCQlyZXR1cm47Cgl9Cn0KCmludCBtYWlu
KCkKewoJcmV0dXJuIDA7Cn0K
The indent profile I am using is `-linux`. My indent version is
2.2.12.Please see the following example (I have to change tabs to 8 spaces,
because my email client does not allow me to paste tabs into emails):
$ cat a.c
void a(void (*b)(void))
{
if (b) {
return;
}
}
int main()
{
return 0;
}
$ indent -linux a.c
$ diff a.c a.c~
3c3
< if(b) {
---
> if (b) {
$ indent -linux a.c
$ diff a.c a.c~
3c3
< if (b) {
---
> if(b) {
$ indent --version
GNU indent 2.2.12
$
As you can see, the space after if is removed and then added forever.
The main characteristic of my program is that the function's argument
contains a function pointer, and the first line in the body of the function
is an if statement.
I think this is a bug because indent should change a file the second time
when invoked with the same profile. Could you please fix this bug?
Thank you,
ercli
void a(void (*b)(void))
{
if (b) {
return;
}
}
int main()
{
return 0;
}