I'm seeing the following behavior on the latest (and a few older) versions of astyle where using a #define object as a bit field width causes unexpected line break and indentation.
This format is held:
typedef struct {
uint32_t member_1 : 16;
uint32_t member_2 : 16;
bool (*func)(void);
}
So I would expect this to be valid
#define MY_BITFIELD_WIDTH
typedef struct {
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func)(void);
}
Instead it is re-formated:
#define MY_BITFIELD_WIDTH
typedef struct {
uint32_t member_1 :
MY_BITFIELD_WIDTH;
uint32_t member_2 :
MY_BITFIELD_WIDTH;
bool (*func)(void);
}
I can at least keep valid C using --keep-one-line-statements, but this is still misindented
#define MY_BITFIELD_WIDTH
typedef struct {
uint32_t member_1 : MY_BITFIELD_WIDTH;
uint32_t member_2 : MY_BITFIELD_WIDTH;
bool (*func)(void);
}
Other notes:
1) This does not seem to be impacted by any options, but I am running in otbs style.
2) All availiable --indent-... options have no effect (with or without --keep-one-line-statements)
Fixed in 3.2 beta