kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: greg@kroah.com (Greg KH)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Linux Coding style template
Date: Sun, 7 Aug 2016 06:39:48 +0200	[thread overview]
Message-ID: <20160807043948.GA7711@kroah.com> (raw)
In-Reply-To: <CAA6eV_ThVicvXa_c+EKH_gVMrm57OEKoKeAK65J5Z7d=+WykkQ@mail.gmail.com>

On Sun, Aug 07, 2016 at 12:22:03AM +0300, Charls D. Chap wrote:
> I want to transform some C source files. following Linux kernel coding style.
> 
> - Does script/Lindent STRICTLY follows all linux kernel coding style rules?
> - What scripts/templates do you use/suggest for elegant code style
> with the fact that
>   we are talking about Linux Kernel Coding?
> 
> 
> The GNU guys suggest indent with the following parameters:
> -nbad -bap -nbc -bbo -hnl -br -brs -c33 -cd33 -ncdb -ce -ci4
> -cli0 -d0 -di1 -nfc1 -i8 -ip0 -l80 -lp -npcs -nprs -npsl -sai
> -saf -saw -ncs -nsc -sob -nfca -cp33 -ss -ts8 -il1
> 
> On the other hand:
> Linux/script/Lindent contains:
> -npro -kr -i8 -ts8 -sob -l80 -ss -ncs -cp1
> 
> Differences so far:
> 1)
> indent with gnu parameters inserts a space on labels eg.
>  err: vs
> err:
> 
> 2)
> indent with gnu parameters inserts 26 spaces
> #endif                                                        /*
> something like this*/
> 
> 
> So probably gnu site is outdated?

Probably, start with running Lindent, and then fix up the mess it leaves
by hand.  Shouldn't take more than a day to do it.

good luck!

greg k-h

  reply	other threads:[~2016-08-07  4:39 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-06 21:22 Linux Coding style template Charls D. Chap
2016-08-07  4:39 ` Greg KH [this message]
2016-08-07 14:53   ` Charls D. Chap
2016-08-08  7:01     ` Greg KH
2016-08-08 10:14       ` Charls D. Chap

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=20160807043948.GA7711@kroah.com \
    --to=greg@kroah.com \
    --cc=kernelnewbies@lists.kernelnewbies.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;
as well as URLs for NNTP newsgroup(s).