bug-indent
[Top][All Lists]
Advanced

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

Indent destroys multiline macros


From: rolf . freitag
Subject: Indent destroys multiline macros
Date: Tue, 2 Jun 2015 22:42:56 +0200

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



reply via email to

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