Re: Expected behavior for -cs and -ncs
david ingamells <[email protected]>
| Newsgroups | gmane.comp.gnu.indent.bugs |
|---|---|
| Message-ID | <[email protected]> |
John E Hein wrote:
> david ingamells wrote at 19:42 +0200 on Jul 23, 2008:
> > This works in 2.2.10:
> >
> > $ indent -npro -ncs
> >
> > unsigned char *cp = (unsigned char *)ptr;
> > int
> > foo ()
> > {
> > return (int)n;
> > }
> >
> > $ indent -npro -cs
> >
> > unsigned char *cp = (unsigned char *) ptr;
> > int
> > foo ()
> > {
> > return (int) n;
> > }
> >
> >
> > I know of no update that fixed this in 2.2.10, so I am surprised that it
> > doesn't work in 2.2.9.
> > I have added this to the regression test now, so it will be checked in
> > the future.
>
> Seems okay in my local test here on 2.2.9, too...
>
>
> echo '(unsigned char *)ptr;' | gindent -npro -cs
> (unsigned char *) ptr;
>
> echo '(unsigned char *)ptr;' | gindent -npro -ncs
> (unsigned char *)ptr;
>
> However, --no-space-after-cast fails:
>
>
> echo '(unsigned char *)ptr;' | gindent -npro --space-after-cast
> (unsigned char *) ptr;
>
> echo '(unsigned char *)ptr;' | gindent -npro --no-space-after-cast
> indent: unknown option "no-space-after-cast"
>
>
>
A quick check in the code explains why:
{"no-space-after-casts", "ncs"},
And the manual says the same. I think what is best is that I update the
manual to remove the trailing "s" and recognise both forms in the code.
That way users will move over to the right one and existing users won't
get a nasty surprise.