lkml.org 
[lkml]   [2014]   [Nov]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [PATCH] CodingStyle: Add a chapter on conditional compilation
From
Date
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?




\
 
 \ /
  Last update: 2014-11-03 20:21    [W:0.033 / U:0.224 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site