public inbox for libstdc++@gcc.gnu.org
 help / color / mirror / Atom feed
From: Thomas Rodgers <trodgers@redhat.com>
To: Dimitrij Mijoski <dmjpp@hotmail.com>
Cc: "libstdc++@gcc.gnu.org" <libstdc++@gcc.gnu.org>
Subject: Re: Add clang-format for libstdc++
Date: Tue, 7 Feb 2023 13:01:24 -0800	[thread overview]
Message-ID: <CAMmuTO8cmJzVRb=60qH0LOBZbFFhLhpzX0XpZF_ChOptn5izMg@mail.gmail.com> (raw)
In-Reply-To: <AM0PR04MB5412C1C9BCEE24431D84D1B5ACDB9@AM0PR04MB5412.eurprd04.prod.outlook.com>

[-- Attachment #1: Type: text/plain, Size: 2179 bytes --]

I am potentially interested in this, with an additional twist -

Is it possible to get clang-format to enforce the libstdc++ uglification
rules (probably requires a clang-format plugin though)?

The concrete example I am thinking of here is when we adopt something like
the PSTL. It was a substantial manual effort to do the uglification on that
code in the first place, and despite multiple reviews by myself and
jwakely, we still managed to miss some identifiers. To complicate matters,
the upstream also makes ongoing changes while making a best effort to
preserve the uglifcation. They also miss some uglfications. The main
contributors in this case are shipping the PSTL as part of oneTBB and so
don't have the same requirements to 'get it right' as libstdc++, so this
often goes undetected.

I am looking to rebase libstdc++'s PSTL in the near future so I'd be
willing to try something based on clang-format, if it existed, for this
particular purpose (I'm less interested in enforcing the indentation rules
in this case, as I want to preserve the upstream's formatting).

I also think it is potentially useful to have both the uglification and
indentation combined. The case I'm thinking of is something like the <simd>
contribution (or ranges) which are similarly large and need to get the
uglification checks and in those cases, the correct libstdc++ formatting as
part of the adoption process.



On Tue, Feb 7, 2023 at 12:39 PM Dimitrij Mijoski via Libstdc++ <
libstdc++@gcc.gnu.org> wrote:

> Is there interest to add a clang-format file for libstdc++?
>
> The basic idea is to take the existing clang format located at
> contrib/clang-format,
> copy it to contrib/clang-format-libstdc++, and modify it according to
> libstdc++ rules
> https://gcc.gnu.org/onlinedocs/libstdc++/manual/source_code_style.html .
> Similarly to the first clang-format, it will be optional and it will be
> enabled if the developer
> calls the command:
>
> make clang-format
>
> inside the build tree. That will create the symbolic link
> srcdir/libstdc++-v3/.clang-format .
> Alternatively, it can be put directly where it is required without the
> need for the invocation
> of make.
>
>

  reply	other threads:[~2023-02-07 21:01 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-07 20:38 Dimitrij Mijoski
2023-02-07 21:01 ` Thomas Rodgers [this message]
2023-02-07 21:19   ` Jonathan Wakely
2023-02-07 21:24     ` Thomas Rodgers
2023-02-10 22:05   ` Stephan Bergmann
2023-02-10 23:02     ` Jonathan Wakely
2023-02-13 10:18       ` Stephan Bergmann
2023-02-07 21:17 ` Jonathan Wakely
2023-02-08 20:04   ` Björn Schäpers

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAMmuTO8cmJzVRb=60qH0LOBZbFFhLhpzX0XpZF_ChOptn5izMg@mail.gmail.com' \
    --to=trodgers@redhat.com \
    --cc=dmjpp@hotmail.com \
    --cc=libstdc++@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).