bug-indent
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Doubling keywords


From: Trevor Blackwell
Subject: Doubling keywords
Date: Fri, 01 Sep 2006 12:24:31 -0700

I _know_ that indent isn't supported for C++, but the following bug in
formating C++ code seems like it might represent a more general latent
bug:

$ echo 'int foo::test() const { return 7; }' | gindent

int
foo::test() const const
{
        return 7;
}

Note that the 'const' token gets output twice. It only does it with
'const' and not with other tokens:

$ echo 'int foo::test() _const { return 7; }' | gindent
int
foo::test()
    _const
{
        return 7;
}

$ echo 'int foo::test() volatile { return 7; }' | gindent
int
foo::test()
        volatile {
                return 7;
        }

I can't get it to happen without any C++isms

$ echo 'int foo_test() const { return 7; }' | gindent
int
foo_test()
        const {
                return 7;
        }

but it seems like it shouldn't duplicate tokens under any circumstances.

If there's a line break in the right place it will concatenate the
tokens:

$ (echo 'int foo::test()' ; echo 'const { return 7; }' ) | gindent
int
foo::test()
     constconst
{
        return 7;
}

Version info:

$ gindent --version
GNU indent 2.2.9

-- 
Trevor Blackwell              650 776 7870           address@hidden





reply via email to

[Prev in Thread] Current Thread [Next in Thread]