git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: git@vger.kernel.org
Cc: "brian m . carlson" <sandals@crustytoothpaste.net>,
	"Junio C Hamano" <gitster@pobox.com>,
	rsbecker@nexbridge.com,
	"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [RFC PATCH 2/4] .clang-format: Add a BitFieldColonSpacing=None rule
Date: Mon, 11 Jul 2022 13:37:26 +0200	[thread overview]
Message-ID: <RFC-patch-2.4-cb69bfa0d0d-20220711T110019Z-avarab@gmail.com> (raw)
In-Reply-To: <RFC-cover-0.4-00000000000-20220711T110019Z-avarab@gmail.com>

Formatting bitfield as "unsigned foo:1" is the usual style in this
project, not "unsigned foo : 1", which clang-format will use by
default.

Before & after this change running "make style-all-diff-apply" will
yield:

	582 files changed, 32029 insertions(+), 29794 deletions(-)
	579 files changed, 32065 insertions(+), 29818 deletions(-)

However this highlights a major limitation in this approach, because
clang-format v12 or newer is required for this rule, but that version
was only released in April 2021.

This change therefore cuts off anyone using an older clang-format. We
could decide to dynamically detect the version, and only supply this
as a --style="" rule on the command-line for older versions, but then
users on older versions would get different results.

So what do we do about that? Declare that "make style" is what mortal
users should run, but that we're going to run "make style-all-diff-ok"
on some blessed version of clang-format?

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 .clang-format | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/.clang-format b/.clang-format
index 3f536c49f24..87398d24d4f 100644
--- a/.clang-format
+++ b/.clang-format
@@ -144,6 +144,10 @@ SpacesInParentheses: false
 # int a[5];    not    int a[ 5 ];
 SpacesInSquareBrackets: false
 
+# Use "unsigned bf:2;", not "bf : 2" or whatever. Requires
+# clang-format 12.
+BitFieldColonSpacing: None
+
 # Insert a space after '{' and before '}' in struct initializers
 Cpp11BracedListStyle: false
 
-- 
2.37.0.913.g189dca38629


  parent reply	other threads:[~2022-07-11 11:43 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-10 21:50 Automatic code formatting brian m. carlson
2022-07-10 22:08 ` Junio C Hamano
2022-07-10 22:13 ` rsbecker
2022-07-11  0:58   ` brian m. carlson
2022-07-11  1:28     ` rsbecker
2022-07-11 16:53       ` Elijah Newren
2022-07-11 20:15         ` Ævar Arnfjörð Bjarmason
2022-07-11 21:19           ` Elijah Newren
2022-07-11 11:37 ` [RFC PATCH 0/4] make headway towards a clean "clang-format" Ævar Arnfjörð Bjarmason
2022-07-11 11:37   ` [RFC PATCH 1/4] Makefile: add a style-all targets for .clang-format testing Ævar Arnfjörð Bjarmason
2022-07-11 11:37   ` Ævar Arnfjörð Bjarmason [this message]
2022-07-11 22:42     ` [RFC PATCH 2/4] .clang-format: Add a BitFieldColonSpacing=None rule brian m. carlson
2022-07-11 22:52       ` Junio C Hamano
2022-07-12  6:56       ` Ævar Arnfjörð Bjarmason
2022-07-11 11:37   ` [RFC PATCH 3/4] .clang-format: do not enforce a ColumnLimit Ævar Arnfjörð Bjarmason
2022-07-11 21:37     ` Junio C Hamano
2022-07-12  7:03       ` Ævar Arnfjörð Bjarmason
2022-07-11 22:39     ` brian m. carlson
2022-07-11 22:46       ` Junio C Hamano
2022-07-11 23:05         ` Eric Sunshine
2022-07-11 23:30           ` Junio C Hamano
2022-07-11 11:37   ` [RFC PATCH 4/4] .clang-format: don't indent "goto" labels Ævar Arnfjörð Bjarmason
2022-07-11 21:04     ` Junio C Hamano
2022-07-12  6:55       ` Ævar Arnfjörð Bjarmason
2022-07-11 13:17 ` Automatic code formatting Phillip Wood
2022-07-11 13:21   ` Ævar Arnfjörð Bjarmason

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=RFC-patch-2.4-cb69bfa0d0d-20220711T110019Z-avarab@gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=rsbecker@nexbridge.com \
    --cc=sandals@crustytoothpaste.net \
    /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 NNTP newsgroup(s).