Indent modifies file forever for function with function pointer argument

Eric Li via "GNU indent discussion, bug reports, suggestions." <[email protected]> Tue, 15 Feb 2022 22:10:02 -0500
Newsgroups gmane.comp.gnu.indent.bugs
Message-ID <CAD+y9MFcX1JjL7EnA+YscLR0-0SUmTAu_S1Gs+qe=5-K8n009A@mail.gmail.com>
--000000000000000a4805d819fd8e
Content-Type: text/plain; charset="UTF-8"

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

--000000000000000a4805d819fd8e
Content-Type: text/x-csrc; charset="US-ASCII"; name="a.c"
Content-Disposition: attachment; filename="a.c"
Content-Transfer-Encoding: base64
Content-ID: <f_kzoyz3pj0>
X-Attachment-Id: f_kzoyz3pj0

dm9pZCBhKHZvaWQgKCpiKSh2b2lkKSkKewoJaWYgKGIpIHsKCQlyZXR1cm47Cgl9Cn0KCmludCBt
YWluKCkKewoJcmV0dXJuIDA7Cn0K
--000000000000000a4805d819fd8e--