bug-indent
[Top][All Lists]
Advanced

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

indent repeatidly appends "const" at the end of a C++ function implement


From: Nicolas Melot
Subject: indent repeatidly appends "const" at the end of a C++ function implementation header
Date: Wed, 14 May 2014 15:38:29 +0200

Hi,

I would like to report a bug with indent (v. 2.2.9 downloaded from
ftp://ftp.df.lth.se/pub/ftp.gnu.org/pub/gnu/indent/ and compiled on
standard, non-updated Ubuntu 12.04)

I attempt to format a C++ file with indent, and later check if the the
file was set in a correct format. I realized that successive running
several times "indent -st" through a pipe fed by a simple C++ line
always produce some change at each stage of the pipe. Example:

diff <(cat source.cpp | indent -st | indent -st) <(cat
src/MakespanFft.cpp | indent -st | indent -st | indent -st)

produces:

2c2
<      Foo::bar (const xx & yy, const zz & tt) const const const
---
>      Foo::bar (const xx & yy, const zz & tt) const const const const

with the file "source.cpp" attached in this email. I would expect diff
to produce no output at all.

In other words, if I run "cat source.cpp | indent -st"
I get
double
Foo::bar (const xx & yy, const zz & tt) const const
{
}
where I would expect 
double
Foo::bar (const xx & yy, const zz & tt) const
{
}
(only one occurence of const)
If I run "cat source.cpp | indent -st | indent -st", I get:
double
     Foo::bar (const xx & yy, const zz & tt) const const const
     {
     }
and I expect
double
Foo::bar (const xx & yy, const zz & tt) const
{
}
(no tabs expected as there was no tabs after the first run of indent,
and only one occurence of "const" where there are now 3 of them)

If I run "cat source.cpp | indent -st | indent -st | indent -st", I get
double
     Foo::bar (const xx & yy, const zz & tt) const const const const
     {
     }
and I still expect
double
Foo::bar (const xx & yy, const zz & tt) const
{
}
Note that this time, "indent" did not indent a second time all the
lines, but it still added another occurence of const.

Hoping this bug report will be helpful,

Best regards,

Nicolas Melot

-- 

Nicolas Melot
Doktorand
PELAB, Computer sciences department (IDA)
Linköping university
S-58183 Linköping, Sweden

Office : Valla campus, B-Huset, 3B:488 (second floor)
Phone  : +46 1328 2483
Mobile : +46 737 03 3860
Web    : http://www.ida.liu.se/~nicme26

Attachment: source.cpp
Description: Text Data


reply via email to

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