[PATCH v2] Add .clang-format

Simon Marchi simark@simark.ca
Tue Sep 23 14:34:22 GMT 2025


On 9/23/25 6:26 AM, Andrew C Aitchison wrote:
> 
> This is a reply to
>   https://sourceware.org/pipermail/binutils/2025-September/143986.html
> - since I wasn't signed up to the list I don't think this will
> thread with Simon's email.
> 
>> I suggest to ask the binutils folks if they would be fine with having it
>> at the top-level, it would simplify things.  Adding binutils@.
>>
>> Binutils people, some of us GDB people would like to add a .clang-format
>> file in the tree.  This file represents the best approximation we have
>> of our style that we are able to do with clang-format.  The intent, for
>> now, is just to allow people to use git-clang-format, or formatting
>> portions of code in IDEs, to get reasonably close to the correct
>> formatting, keeping in mind that the output might need some manual
>> adjustments.
>>
>> Are you ok with having this file at the top-level?  Just adding this
>> file shouldn't alter anybody's workflow.
>>
>> Simon
> 
> I am new to binutils and sourceware.org, so my view may count little.

Hi Andrew,

Experience from newcomers is important.  It's easy to overlook these
details when you already know how things work.

> I made my first submission this month (September) and it has been
> approved, but follow up submissions are stuck in formatting, even
> after two two complete writes.
> 
> I'm new to git-format-patch and git-send-email; have found with no
> (human or computer) format/style guide, my editor is set to destroy the binutils' tabbing preferences (since they are different from the other projects I've worked on) and two reviewers have made explict
> requests for changes to spacing.

What is your editor?  It's possible to configure most of them to at
least handle indentation (the mix of tabs + spaces that confuse many
people) correctly.  We also have a .editorconfig file at the top of the
tree.  If your editor understands that (perhaps via a plugin), it can
configure itself automatically.  That doesn't handle other aspects of
formatting, of course, but it's a good start.

> Until I see formatting instructions; either a config like
> .clang-format or something a human can follow, I do not expect to
> continue with this patch submission.

Are you struggling with the indentation specifically, or other aspects
of the formatting?

> So, yes please, I vote for a .clang-format file at the top level.

I would also vote for merging it.  The chances of this file breaking
anything are very low.

Simon


More information about the Binutils mailing list