Best to illustrate with an example. This:
struct Bits
{
unsigned int field1 : 8; // comment
unsigned int field2 : FIELD2_BITS;
unsigned int field3 : FIELD3_BITS; // comment
unsigned int field4 : 9;
};
becomes this:
struct Bits
{
unsigned int field1 : 8; // comment
unsigned int field2 :
FIELD2_BITS;
unsigned int field3 :
FIELD3_BITS; // comment
unsigned int field4 : 9;
};
The desired behavior is that astyle do nothing to the above struct such that "after" matches "before". However, as you can see, lines with bit sizes set using variables (FIELD2_BITS, FIELD3_BITS) are reformatted (clobbered) while bit sizes set by literal values (8, 9) are correctly left untouched.
I experience a similar problemusing this line:
It works with this struct:
But when I add volatile to the individual fields, astyle screws it up:
Just saw that the issue has been fixed in astyle v3.01.
Thanks a lot! :-)
Fixed in 3.2.1