We would like to make our C++ brace style more consistent. Right now, our code contains a mix of:
if (cond)
{
// ...
}
else
{
// ...
}
...and:
if (cond) {
// ...
} else {
// ...
}
We want to use the latter style exclusively.
However, we don't want to change the indentation of our code. I've tried using astyle, bcpp, GNU indent and Uncrustify (and I've looked at the command-line options for GreatCode). Unfortunately, each of these tools insists on reindenting our code, and most of them mangle C++ constructor initializer lists and preprocessor macros pretty badly.
Are there any C++ code beautifiers which can fix braces while leaving indentation alone? It doesn't have to be a pre-existing tool--if you know how to do this using some crazy Perl one-liner, that's also good. Thank you!
Update: Yes, we aware that this will make it hard to read diffs against older code. This is a long-postponed code cleanup, and we've decided that the day-to-day advantages of consistent formatting outweigh any version-control difficulties.