Put null statement on separate line

Mattias Märka <[email protected]> Mon, 02 Nov 2020 11:56:03 +0000
Newsgroups gmane.comp.gnu.indent.bugs
Message-ID <KZHahFfRObb0btPRhSTmwgKCk2_uxBWn4J2qbFI09DiTU56BaS8joEdlIBzsQCgT_Lyl9ECIkh-b_eTkeVcBgxIxSq-xO1vExPU99LGHzGA=@marka.ee>
Hello,

I skimmed through the manual, but I didn't find what I was looking
for, so I thought I would ask.

There does not seem to an option to put the null statement on a
separate line. Is this right? Also, shouldn't the -kr style be using
this option?

Consider the following code fragment:

     1=09#include <ctype.h>
     2
     3=09int getch(void);
     4=09void ungetch(int);
     5
     6=09void skipwc(void)
     7=09{
     8=09=09int c;
     9=09=09while (isspace(c =3D getch()))
    10=09=09=09;
    11=09=09ungetch(c);
    12=09}

Running this through

    indent -kr -i8

I would expect to get the same exact output back. What I get instead
is:

     1=09#include <ctype.h>
     2
     3=09int getch(void);
     4=09void ungetch(int);
     5
     6=09void skipwc(void)
     7=09{
     8=09=09int c;
     9=09=09while (isspace(c =3D getch()));
    10=09=09ungetch(c);
    11=09}

The null statement is joined with the while loop (the -nss
flag). AFAIK, the actual K&R books does not do this. See page 18 of
the 2nd edition for example.

Interestingly, if there's a comment between the while and the null
statement

     1=09#include <ctype.h>
     2
     3=09int getch(void);
     4=09void ungetch(int);
     5
     6=09void skipwc(void)
     7=09{
     8=09=09int c;
     9=09=09while (isspace(c =3D getch()))=09/* skip whitespace */
    10=09=09=09;
    11=09=09ungetch(c);
    12=09}

I get the same exact output back. No issues there.

I'm using GNU indent 2.2.12 on Debian.

Apologies if I'm missing something here. I don't think I am though.

Best regards,
Mattias M=C3=A4rka