Package: indent
Version: 2.2.10-1
Severity: normal
Steps to reproduce:
1) cat > svg.cc <<EOF
void Svg::write(std::ostream &st, const Graph &g) const { }
EOF
2) indent -o svg.cc.indent svg.cc
Expected results:
2) svg.cc.indent and svg.cc differ only in whitespace
Actual results:
2) svg.cc.indent has extra const keyword:
void
Svg::write (std::ostream & st, const Graph & g) const const
{
}
More info:
1) If I run indent again to the output file it adds yet another const
keyword. This means that indent is not idempotent and can not be used
to check whether a file already has correct indentation or not.
2) The bug also occurs with indent 2.2.9-7 in debian stable.
3) It seems that the first const is written by handle_token_decl() and
the second const is written by copy_id():
case decl:
/* we have a declaration type (int, register, etc.) */
handle_token_decl(dec_ind, file_exit_value,
pbreak_line);
copy_id(type_code, force_nl, file_exit_value, can_break);
Maybe this could be fixed by just not writing const from
handle_token_decl?
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]