Hi all, I wrote a small perl script which fixes (some of) the astyle problems.
Before use it, you must adjust the $ASTYLE_BIN variable at the beggining of the formatter.pl file. I am running it using the following command: # find . -name "*.cc" -exec formater.pl \{\} \; but it can take multiple files as arguments. I used it with astyle versions 1.18 and 1.21. I did not do extensive tests, so I am sure it contains bugs :-). Please use it with caution. I tried to implement Alex suggestions. For the problem discussion look at the thread: http://www.squid-cache.org/mail-archive/squid-dev/200801/0019.html This script starts the astyle and attach one filter in its input and one in its output, using pipes. The input filter search for "unsigned int XXXXX:1;" cases and convert them to "unsigned int XXXXX__FORASTYLE__1;". The output filter search for "unsigned int XXXXX__FORASTYLE__1;" patterns and convert them back to the original text. Also it search for the cases "#preprocessor directive {" or "{ #preprocessor_directive" and fix them. Do we need something like that? Any comments/suggestions? Any testers? Regards, Christos
formater.pl
Description: Perl program