Astyle 3.6.21 is almost perfect, just one tiny regression compared to 3.6.20:
Input for Astyle 3.6.21, but the comment should remain unchanged:
int get()
{
#ifdef ZEN_WIN
return 1;
#else
/* test
#include <blkid/blkid.h> */
return 0;
#endif
}
Unexpected result:
int get()
{
#ifdef ZEN_WIN
return 1;
#else
/* test
#include <blkid/blkid.h> */
return 0;
#endif
}
Thx for your stellar work on Astyle! Wouldn't enjoy programming that much if I had to use clang-format.
Best, Zenju
using
Please test with 3.6.22.
The following example doesn't work in 3.6.22:
Input:
Output (unexpectedly indents before #include)
Probably related, the following comment is also partially indented:
Input:
Output => two spaces were inserted before "abc"
Here's a different example. Its admittedly weird, but it's OpenSSL code, and formatting is causing havok on the code: (didn't happen with previous 3.6.21):
Input:
Output (unexpected indent before "These control")
Last edit: Zenju 2026-11-06
Please test with 3.6.23. First two were old bugs, last one a real regression.
Awesome, this fixes 99% of issues!
One remaining issue with 3.6.23. The following example remains unchanged after format:
Apparently it makes a difference if the block is at the beginning of the file or not:
Also the following issue with 3.6.23:
Input:
Output: (the "** abc" line is shifted to the left and not aligned with the previous "assert")