* Indent issus in kernel module development @ 2015-12-19 2:07 chunguang qu 2015-12-19 2:26 ` Randy Dunlap 0 siblings, 1 reply; 6+ messages in thread From: chunguang qu @ 2015-12-19 2:07 UTC (permalink / raw) To: linux-kernel `indent -linux` sometimes made my code totally a mess. I know it most likely a bug of GNU INDENT. And this is not a bug report. I only want to know other kernel developers how to deal with this problem. Since GUN INDENT is recommend in kernel's CodingStyle, I think surely someone here encounter this problem either. CMD LANG=C indent -linux FROM http://paste.ubuntu.com/14093393/ TO http://paste.ubuntu.com/14093405/ Thanks. -- [Kevin Q (ChunGuang Qu)](mailto:quchunguang@gmail.com) [public key](http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x5B06DCA77BEF043B) @sdu.edu.cn @gnu.org @mit.edu ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Indent issus in kernel module development 2015-12-19 2:07 Indent issus in kernel module development chunguang qu @ 2015-12-19 2:26 ` Randy Dunlap 2015-12-19 5:50 ` chunguang qu 0 siblings, 1 reply; 6+ messages in thread From: Randy Dunlap @ 2015-12-19 2:26 UTC (permalink / raw) To: chunguang qu, linux-kernel On 12/18/15 18:07, chunguang qu wrote: > `indent -linux` sometimes made my code totally a mess. > I know it most likely a bug of GNU INDENT. And this is not a bug report. > I only want to know other kernel developers how to deal with this problem. > Since GUN INDENT is recommend in kernel's CodingStyle, I think surely > someone here encounter this problem either. Huh? CodingStyle says: Now, again, GNU indent has the same brain-dead settings that GNU emacs has, which is why you need to give it a few command line options. It also says try using scripts/Lindent. Have you tried it? It won't be perfect either, AFAI recall, but it might help. or you could try emacs (as indicated in CodingStyle). Good luck with that. > CMD > LANG=C indent -linux > > FROM > http://paste.ubuntu.com/14093393/ > > TO > http://paste.ubuntu.com/14093405/ > > Thanks. -- ~Randy ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Indent issus in kernel module development 2015-12-19 2:26 ` Randy Dunlap @ 2015-12-19 5:50 ` chunguang qu 2015-12-19 6:16 ` Joe Perches 0 siblings, 1 reply; 6+ messages in thread From: chunguang qu @ 2015-12-19 5:50 UTC (permalink / raw) To: Randy Dunlap, linux-kernel Yes, I just tried `scripts/Lindent` and it has the same problem. I had compared the source of `Lindent` with `-linux` option of `indent` long time ago, there's seems no major difference. So i used `indent -linux <file>` above. Thanks for your advice about `emace`, but `vi` is my only editor for dozens of years. 2015-12-19 10:26 GMT+08:00 Randy Dunlap <rdunlap@infradead.org>: > On 12/18/15 18:07, chunguang qu wrote: >> `indent -linux` sometimes made my code totally a mess. >> I know it most likely a bug of GNU INDENT. And this is not a bug report. >> I only want to know other kernel developers how to deal with this problem. >> Since GUN INDENT is recommend in kernel's CodingStyle, I think surely >> someone here encounter this problem either. > > Huh? > > CodingStyle says: > > Now, again, GNU indent has the same brain-dead settings that GNU emacs > has, which is why you need to give it a few command line options. > > It also says try using scripts/Lindent. Have you tried it? > It won't be perfect either, AFAI recall, but it might help. > > or you could try emacs (as indicated in CodingStyle). Good luck with that. > > > >> CMD >> LANG=C indent -linux >> >> FROM >> http://paste.ubuntu.com/14093393/ >> >> TO >> http://paste.ubuntu.com/14093405/ >> >> Thanks. > > > > > -- > ~Randy -- [Kevin Q (ChunGuang Qu)](mailto:quchunguang@gmail.com) [public key](http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x5B06DCA77BEF043B) @sdu.edu.cn @gnu.org @mit.edu @grazestar.com @jolijolie.cn ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Indent issus in kernel module development 2015-12-19 5:50 ` chunguang qu @ 2015-12-19 6:16 ` Joe Perches 2015-12-20 12:52 ` chunguang qu 0 siblings, 1 reply; 6+ messages in thread From: Joe Perches @ 2015-12-19 6:16 UTC (permalink / raw) To: chunguang qu, Randy Dunlap, linux-kernel On Sat, 2015-12-19 at 13:50 +0800, chunguang qu wrote: > Yes, I just tried `scripts/Lindent` and it has the same problem. > > I had compared the source of `Lindent` with `-linux` option of > `indent` long time ago, there's seems no major difference. > So i used `indent -linux <file>` above. > > Thanks for your advice about `emace`, but `vi` is my only editor for > dozens of years. Try: $ ./scripts/checkpatch.pl --fix --types=spacing <file> ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Indent issus in kernel module development 2015-12-19 6:16 ` Joe Perches @ 2015-12-20 12:52 ` chunguang qu 2015-12-21 15:13 ` Austin S. Hemmelgarn 0 siblings, 1 reply; 6+ messages in thread From: chunguang qu @ 2015-12-20 12:52 UTC (permalink / raw) To: Joe Perches, linux-kernel I tried it. Not worked unfortunately,. ```bash $ ~/share/linux/scripts/checkpatch.pl --fix --types=spacing testcompletion.c total: 0 errors, 0 warnings, 0 lines checked testcompletion.c has no obvious style problems and is ready for submission. NOTE: Used message types: SPACING ``` 2015-12-19 14:16 GMT+08:00 Joe Perches <joe@perches.com>: > On Sat, 2015-12-19 at 13:50 +0800, chunguang qu wrote: >> Yes, I just tried `scripts/Lindent` and it has the same problem. >> >> I had compared the source of `Lindent` with `-linux` option of >> `indent` long time ago, there's seems no major difference. >> So i used `indent -linux <file>` above. >> >> Thanks for your advice about `emace`, but `vi` is my only editor for >> dozens of years. > > Try: > > $ ./scripts/checkpatch.pl --fix --types=spacing <file> > -- [Kevin Q (ChunGuang Qu)](mailto:quchunguang@gmail.com) [public key](http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x5B06DCA77BEF043B) @sdu.edu.cn @gnu.org @mit.edu @grazestar.com @jolijolie.cn ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Indent issus in kernel module development 2015-12-20 12:52 ` chunguang qu @ 2015-12-21 15:13 ` Austin S. Hemmelgarn 0 siblings, 0 replies; 6+ messages in thread From: Austin S. Hemmelgarn @ 2015-12-21 15:13 UTC (permalink / raw) To: chunguang qu, Joe Perches, linux-kernel On 2015-12-20 07:52, chunguang qu wrote: > I tried it. Not worked unfortunately,. > > ```bash > $ ~/share/linux/scripts/checkpatch.pl --fix --types=spacing testcompletion.c > total: 0 errors, 0 warnings, 0 lines checked > > testcompletion.c has no obvious style problems and is ready for submission. > > NOTE: Used message types: SPACING > ``` You might try something with clang-format. It doesn't have a built-in style option for the kernel (probably because the kernel can't currently be compiled with Clang/LLVM, but Linux does qualify for the first two criteria for having a new style default added, so if someone wants to actually work on it, they could probably get it included), but something like this for the config should get you pretty close: BasedOnStyle: LLVM IndentWidth: 8 UseTab: Always BreakBeforeBraces: Linux AllowShortIfStatementOnASingleLine: false IndentCaseLabels: false I'm pretty certain that this doesn't cover everything from CodingStyle, but it should cover most things, and most of the other stuff should be relatively easily scriptable using regex based replacements. > > 2015-12-19 14:16 GMT+08:00 Joe Perches <joe@perches.com>: >> On Sat, 2015-12-19 at 13:50 +0800, chunguang qu wrote: >>> Yes, I just tried `scripts/Lindent` and it has the same problem. >>> >>> I had compared the source of `Lindent` with `-linux` option of >>> `indent` long time ago, there's seems no major difference. >>> So i used `indent -linux <file>` above. >>> >>> Thanks for your advice about `emace`, but `vi` is my only editor for >>> dozens of years. >> >> Try: >> >> $ ./scripts/checkpatch.pl --fix --types=spacing <file> >> ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2015-12-21 15:13 UTC | newest] Thread overview: 6+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2015-12-19 2:07 Indent issus in kernel module development chunguang qu 2015-12-19 2:26 ` Randy Dunlap 2015-12-19 5:50 ` chunguang qu 2015-12-19 6:16 ` Joe Perches 2015-12-20 12:52 ` chunguang qu 2015-12-21 15:13 ` Austin S. Hemmelgarn
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox