From: Joe Perches <joe@perches.com>
To: Josh Triplett <josh@joshtriplett.org>
Cc: Jonathan Corbet <corbet@lwn.net>,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] CodingStyle: Add a chapter on conditional compilation
Date: Mon, 03 Nov 2014 10:39:17 -0800 [thread overview]
Message-ID: <1415039957.17743.29.camel@perches.com> (raw)
In-Reply-To: <20141103180528.GA9026@jtriplet-mobl1>
On Mon, 2014-11-03 at 10:05 -0800, Josh Triplett wrote:
> On Mon, Nov 03, 2014 at 09:47:40AM -0800, Joe Perches wrote:
[]
> "don't put an else after an if condition
> ending with break or return;
Maybe that's a bit _too_ simple.
Yes for a simple if, but not necessarily an else if
if (foo) {
...;
} else if (bar) {
more code...;
return;
} else {
...
}
still needs that last else.
checkpatch isn't very good at that code flow
interpretation so it emits a warning anyway.
> > Another thing that could go is the suggestion to
> > use Lindent.
> >
> > https://lkml.org/lkml/2013/2/11/390
>
> Agreed completely. We might consider coming up with settings for
> clang-format, which seems like a far more capable replacement that
> actually understands C.
Never used it.
It does seem to have a large number of options
(including a trivial linux-kernel style) though.
http://clang.llvm.org/docs/ClangFormatStyleOptions.html
Dunno how much work it would be to create a proper
linux-kernel style for clang-format.
It might work well, it might not.
Anyone have experience with it?
prev parent reply other threads:[~2014-11-03 18:39 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-10-29 18:15 [PATCH] CodingStyle: Add a chapter on conditional compilation Josh Triplett
2014-10-29 19:12 ` Geert Uytterhoeven
2014-10-29 22:20 ` Josh Triplett
2014-10-30 0:35 ` Randy Dunlap
2014-10-30 2:24 ` Josh Triplett
2014-10-30 3:33 ` Martin Kelly
2014-11-03 16:46 ` Jonathan Corbet
2014-11-03 17:47 ` Joe Perches
2014-11-03 18:05 ` Josh Triplett
2014-11-03 18:39 ` Joe Perches [this message]
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=1415039957.17743.29.camel@perches.com \
--to=joe@perches.com \
--cc=corbet@lwn.net \
--cc=josh@joshtriplett.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.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