From: Joe Perches <joe@perches.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>
Cc: Randy Dunlap <rdunlap@infradead.org>,
Robo Bot <apw@canonical.com>, Jonathan Corbet <corbet@lwn.net>,
linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] clang-format: add configuration file
Date: Tue, 13 Mar 2018 15:29:23 -0700 [thread overview]
Message-ID: <1520980163.2049.54.camel@perches.com> (raw)
In-Reply-To: <CANiq72nKXXV7SDTmCwvizWA3ubdczNZV8qT2-PoGAQnDfX9qtg@mail.gmail.com>
On Tue, 2018-03-13 at 22:52 +0100, Miguel Ojeda wrote:
> On Tue, Mar 13, 2018 at 10:00 PM, Andrew Morton <akpm@linux-foundation.org> wrote:
> > On Tue, 13 Mar 2018 00:39:52 +0100 Miguel Ojeda <miguel.ojeda.sandonis@gmail.com> wrote:
> > > --- a/Documentation/process/4.Coding.rst
> > > +++ b/Documentation/process/4.Coding.rst
> > > @@ -58,6 +58,12 @@ can never be transgressed. If there is a good reason to go against the
> > > style (a line which becomes far less readable if split to fit within the
> > > 80-column limit, for example), just do it.
> > >
> > > +Note that you can use the clang-format tool to help you with these rules
> > > +and to quickly re-format parts of your code automatically. It is specially
> > > +useful for new files/code and to spot coding style mistakes. It is also
> > > +useful to sort #includes, to align variables or comments, to reflow text
> > > +and other similar tasks.
> >
> > It would be rather helpful to tell people how to invoke clang-format.
clang-format has its drawbacks but at least it is
likely to be improved more in the future.
That is a lot better than Lindent/indent.
Some not kernel-style compliant oddities:
o placements of braces for definitions is like:
static const struct pci_device_id e100_id_table[]
= { INTEL_8255X_ETHERNET_DEVICE(0x1029, 0),
o alignment of block #defines
o alignment of function arguments
o logical tests continuations moved to BOL not EOL
o misalignment of per-line comments
o location of struct/union/enum braces
etc...
After applying Miguel's patch, try it with something like:
$ git ls-files -- "drivers/net/ethernet/intel/*.[ch]" | \
while read file ; do clang-format -i $file ; done
and look at the diff (I used clang-format-5.0.0-3)
next prev parent reply other threads:[~2018-03-13 22:29 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-12 23:39 Miguel Ojeda
2018-03-12 23:45 ` Joe Perches
2018-03-13 21:00 ` Andrew Morton
2018-03-13 21:52 ` Miguel Ojeda
2018-03-13 22:29 ` Joe Perches [this message]
2018-03-14 0:18 ` Miguel Ojeda
2018-03-14 0:56 ` Miguel Ojeda
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=1520980163.2049.54.camel@perches.com \
--to=joe@perches.com \
--cc=akpm@linux-foundation.org \
--cc=apw@canonical.com \
--cc=corbet@lwn.net \
--cc=linux-kernel@vger.kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=rdunlap@infradead.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
all inboxes | Powered by JetHome®