git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Ramkumar Ramachandra <artagnon@gmail.com>
To: Git List <git@vger.kernel.org>
Cc: "Junio C Hamano" <gitster@pobox.com>, "René Scharfe" <l.s.r@web.de>
Subject: [PATCH v2] .clang-format: introduce the use of clang-format
Date: Wed, 21 Jan 2015 12:01:27 -0500	[thread overview]
Message-ID: <1421859687-27216-1-git-send-email-artagnon@gmail.com> (raw)
In-Reply-To: <1421530221-39306-1-git-send-email-artagnon@gmail.com>

Instead of manually eyeballing style in reviews, just ask all
contributors to run their patches through [git-]clang-format.

However, struct declarations that are combined with variable
declaration and initialization get mangled:

        struct a {
                int n;
                const char *s;
        } arr[] = {
                { 1, "one" },
                { 2, "two" }
        };

becomes:

        struct a {
                int n;
                const char *s;
        } arr[] = { { 1, "one" }, { 2, "two" } };

It gets formatted better if arr is declared separately.

Helped-by: René Scharfe <l.s.r@web.de>
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
 .clang-format | 11 +++++++++++
 1 file changed, 11 insertions(+)
 create mode 100644 .clang-format

diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..a336438
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,11 @@
+BasedOnStyle: LLVM
+IndentWidth: 8
+UseTab: Always
+BreakBeforeBraces: Linux
+AllowShortBlocksOnASingleLine: false
+AllowShortIfStatementsOnASingleLine: false
+IndentCaseLabels: false
+AllowShortFunctionsOnASingleLine: None
+ContinuationIndentWidth: 8
+Cpp11BracedListStyle: false
+BreakBeforeBraces: Stroustrup
-- 
2.2.1

  parent reply	other threads:[~2015-01-21 17:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-17 21:30 [PATCH] .clang-format: introduce the use of clang-format Ramkumar Ramachandra
2015-01-18 11:31 ` René Scharfe
2015-01-21 17:06   ` Ramkumar Ramachandra
2015-01-21 17:01 ` Ramkumar Ramachandra [this message]
2015-01-21 20:45   ` [PATCH v2] " Jeff King
2015-01-21 21:28     ` Ramkumar Ramachandra
2015-01-21 22:09       ` Jeff King

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

  List information: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to=1421859687-27216-1-git-send-email-artagnon@gmail.com \
    --to=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=l.s.r@web.de \
    /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.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

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).