Indent destroys multiline macros
[email protected] Tue, 2 Jun 2015 22:42:56 +0200
| Newsgroups | gmane.comp.gnu.indent.bugs |
|---|---|
| Message-ID | <trinity-588eb018-a228-415e-a0af-0864eadcf98f-1433277776710@3capp-webde-bs28> |
Hi,
i'm using GNU indent: 2.2.11 on 64 bit Ubuntu and found a bug, on my notebook and on my PC, which makes code non-compilable.
I'm using indent with the options
--blank-lines-after-procedures --line-length160 --continue-at-parentheses --dont-cuddle-else
--brace-indent0 --space-after-cast --blank-before-sizeof --dont-format-comments
--space-after-procedure-calls --tab-size8 --no-tabs --case-indentation2 -ppi 2
and usually indent works fine with this options, but not at some macros.
A macro in one line is no problem, e. g.
#define mc_SWAP_ITEMS(a, b, c, i_size) { memcpy (&(c), &(a), (i_size)); memcpy (&(a), &(b), (i_size)); memcpy (&(b), &(c), (i_size)); }
Indent does not change it. That is correct.
But the manually pretty-printed version with three lines,
#define mc_SWAP_ITEMS(a, b, c, i_size) { memcpy (&(c), &(a), (i_size));\
memcpy (&(a), &(b), (i_size));\
memcpy (&(b), &(c), (i_size)); }
gets converted to
#define mc_SWAP_ITEMS(a, b, c, i_size) { memcpy (&(c), &(a), (i_size));\
memcpy (&(a), &(b), (i_size));
\Mmemcpy (&(b), &(c), (i_size));
}
So this is invalid code, the second backslash is moved to the next line and a carriage return is added after it!
Kind regards,
Rolf Freitag