On Sat, 2008-01-05 at 13:05 +0200, Tsantilas Christos wrote:
> I spend some time to run the astyle-1.21 on squid3 code. I tried to run
> it with the following parameters:
> --mode=c -s4 -O --break-blocks -l
>
> I am only seeing the following two problems:
>
> 1) The --break-blocks and -l option.
> Using these options the code:
> #ifdef SOME
> {
> ....
> }
>
> Converted to:
>
> #ifdef SOME {
> ....
> }
>
> Maybe we can omit these options ....
I suggest removing break-blocks both because of the above bug and
because it is trying to detect "unrelated blocks, classes, etc." which
smells too much like AI to me.
The --brackets=linux (-l) option is useful though. Can you check whether
there is another --brackets option that works without the above bug and
does the subset of what --brackets=linux does?
> 2) Bit fields in structs are not formated well.
> struct
> {
> unsigned int open:1;
> unsigned int close_request:1;
> unsigned int write_daemon:1;
> .......
> }
>
> Converted to:
> struct
> {
> unsigned int open:
> 1;
> unsigned int close_request:
> 1;
> unsigned int write_daemon:
> 1;
> ...........
> }
This cannot be disabled, right? If all bit-fields are "unsigned int",
perhaps we can run a simple pre-processor that will convert
unsigned int foo : 1;
into
unsigned int foo__FORASTYLE__1;
and then post-process the sources to undo the conversion?
Finally, please consider reporting the above bugs to astyle if nobody
has done that already.
Thank you,
Alex.