arithy / packcc

A parser generator for C
Other
349 stars 29 forks source link

Uncrustify #23

Closed dolik-rce closed 3 years ago

dolik-rce commented 3 years ago

I have found that clang-format is not easy to configure to fit a custom code style used in PackCC (as discussed in #22). Therefore, I abandoned the attempts to use clang-format and I tried to achieve the goal using uncrustify.

It turns out, that it's configuration is much more flexible. For many options it allows to either select correct behaviour or to ignore the property altogether. It was quite easy to figure out configuration, for which the current code passes the check, with only few minor whitespace changes.

I have also slightly modified the code generation to trim trailing spaces, which was the only problem preventing the generated code to pass the check as well.

dolik-rce commented 3 years ago

The configuration should be quite forgiving in its current form. It will however catch my most common mistakes (like char* str vs. char *str). If you notice more common errors in future, it should be easy to configure uncrustify to check for those as well.

arithy commented 3 years ago

Thanks for your quick and wonderful work!