All of lore.kernel.org
 help / color / mirror / Atom feed
From: "René Scharfe" <l.s.r@web.de>
To: Ramkumar Ramachandra <artagnon@gmail.com>,
	Git List <git@vger.kernel.org>
Cc: Junio C Hamano <gitster@pobox.com>
Subject: Re: [PATCH] .clang-format: introduce the use of clang-format
Date: Sun, 18 Jan 2015 12:31:18 +0100	[thread overview]
Message-ID: <54BB9986.2040706@web.de> (raw)
In-Reply-To: <1421530221-39306-1-git-send-email-artagnon@gmail.com>

Am 17.01.2015 um 22:30 schrieb Ramkumar Ramachandra:
> Instead of manually eyeballing style in reviews, just ask all
> contributors to run their patches through [git-]clang-format.
>
> Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
> ---
>   The idea is to introduce the community to this new toy I found called
>   clang-format. Whether or not it's actually going to be used doesn't
>   bother me too much.
>
>   I'm not 100% sure of the style, but I'll leave you to tweak that
>   using http://clang.llvm.org/docs/ClangFormatStyleOptions.html
>
>   The current code isn't terribly conformant, but I suppose that'll
>   change with time.
>
>   .clang-format | 7 +++++++
>   1 file changed, 7 insertions(+)
>   create mode 100644 .clang-format
>
> diff --git a/.clang-format b/.clang-format
> new file mode 100644
> index 0000000..63a53e0
> --- /dev/null
> +++ b/.clang-format
> @@ -0,0 +1,7 @@
> +BasedOnStyle: LLVM
> +IndentWidth: 8
> +UseTab: Always
> +BreakBeforeBraces: Linux
> +AllowShortBlocksOnASingleLine: false
> +AllowShortIfStatementsOnASingleLine: false
> +IndentCaseLabels: false
> \ No newline at end of file

Why no newline on the last line?

These one would be needed as well to match our style, I think:

	AllowShortFunctionsOnASingleLine: None
	ContinuationIndentWidth: 8

And probably this one:

	Cpp11BracedListStyle: false

However, even then 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.

And this one helps get rid of the added line break between struct a and 
the following brace:

	BreakBeforeBraces: Stroustrup

  reply	other threads:[~2015-01-18 11:32 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 [this message]
2015-01-21 17:06   ` Ramkumar Ramachandra
2015-01-21 17:01 ` [PATCH v2] " Ramkumar Ramachandra
2015-01-21 20:45   ` 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

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

  git send-email \
    --in-reply-to=54BB9986.2040706@web.de \
    --to=l.s.r@web.de \
    --cc=artagnon@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.