Re: automated coding style tool

Luis Machado via Gdb
2025-01-14T17:16:04Z

On 1/14/25 17:11, Tom Tromey wrote:
>>>>>> Aktemur, Tankut Baris via Gdb <gdb@sourceware.org> writes:
>
>> Regarding the automated coding style tool: is there any active attempt
>> to pursue this goal?
>
> Every year or two I take another look at clang-format.
> The discussion is here:
>
> https://sourceware.org/bugzilla/show_bug.cgi?id=30098
>
>> Tom mentioned his t/clang-format branch in that email thread. I checked
>> the branch. The clang-format config file has
>> # BasedOnStyle: GNU
>> Is the GDB coding style so off from the built-in GNU style
>> that it cannot be reused?
>
> I don't recall why I commented this out. Anyway clang-format doesn't
> come very close to GNU style. I'd be ok with ignoring most of the
> little differences (i.e., I don't care about goto label placement), but
> the bin packing output is just super ugly some of the time.
>
> Tom

I'd go for a tool, even if it is slightly to moderately different from what
we tend to use. It's not like the GNU style has been updated to cope with
the more recent C++ syntax, so we have some stuff that isn't properly
documented.

The tool would simplify that.

Also, the style of comment we use (/* */) doesn't go well with clang-format
from what I recall. But we can just drop options that deal with comments.