From: Joe Perches <joe@perches.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>,
Nick Desaulniers <ndesaulniers@google.com>,
Vivien Didelot <vivien.didelot@gmail.com>
Cc: Nathan Chancellor <natechancellor@gmail.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
"Gustavo A. R. Silva" <gustavo@embeddedor.com>,
LKML <linux-kernel@vger.kernel.org>,
clang-built-linux <clang-built-linux@googlegroups.com>
Subject: Re: [PATCH] Makefile: Convert -Wimplicit-fallthrough=3 to just -Wimplicit-fallthrough for clang
Date: Fri, 16 Aug 2019 01:47:46 -0700 [thread overview]
Message-ID: <dc21098f97f864523df808797c49c734e07e1cfb.camel@perches.com> (raw)
In-Reply-To: <128728a0965240aa5b68970d7721d857176ae7cd.camel@perches.com>
(adding Vivien Didelot for vim)
On Wed, 2019-08-14 at 19:44 -0700, Joe Perches wrote:
> On Tue, 2019-08-13 at 14:44 +0200, Miguel Ojeda wrote:
> > Hm... I would go for either __fallthrough as the rest of attributes,
> > or simply fallthrough -- FALLTHROUGH seems wrong. If you want it that
> > way for visibility, then I would choose __fallthrough, since the
> > underscores are quite prominent and anyway IDEs typically highlight
> > macros in a different color than keywords (return etc.).
>
> Just fyi:
>
> I added this line to my .emacs and "fallthrough" is now
> syntax highlighted like every other keyword.
>
> (font-lock-add-keywords 'c-mode
> '(("\\<\\(fallthrough\\)\\>" . font-lock-keyword-face)))
>
> So now my linux-c-mode block is:
>
> (defun linux-c-mode ()
> "C mode with adjusted defaults for use with the Linux kernel."
> (interactive)
> (font-lock-add-keywords 'c-mode
> '(("\\<\\(fallthrough\\)\\>" . font-lock-keyword-face)))
> (c-mode)
> (c-set-style "K&R")
> (setq c-basic-offset 8)
> (setq c-indent-level 8)
> (setq c-brace-imaginary-offset 0)
> (setq c-brace-offset -8)
> (setq c-argdecl-indent 8)
> (setq c-label-offset -8)
> (setq c-continued-statement-offset 8)
> (setq indent-tabs-mode t)
> (setq tab-width 8)
> (setq show-trailing-whitespace t)
> )
>
> I don't know to do that for vim nor any other ide,
> but I trust someone will know and show how it's done.
I investigated vim a bit as I am not a vim user.
If this is the most commonly used vim style,
perhaps a reference to this style could be added
to Documentation/process/coding-style.rst
https://github.com/vivien/vim-linux-coding-style
I had thought that
syn keyword cKeyword fallthrough
would work, but it does not add syntax coloring
syn keyword cStatement fallthrough
does through.
If ~.vim/plugin/linuxsty.vim is commonly used, maybe
---
plugin/linuxsty.vim | 1 +
1 file changed, 1 insertion(+)
diff --git a/plugin/linuxsty.vim b/plugin/linuxsty.vim
index 18b2867..44824b8 100644
--- a/plugin/linuxsty.vim
+++ b/plugin/linuxsty.vim
@@ -69,6 +69,7 @@ function s:LinuxFormatting()
endfunction
function s:LinuxKeywords()
+ syn keyword cStatement fallthrough
syn keyword cOperator likely unlikely
syn keyword cType u8 u16 u32 u64 s8 s16 s32 s64
syn keyword cType __u8 __u16 __u32 __u64 __s8 __s16 __s32 __s64
prev parent reply other threads:[~2019-08-16 8:47 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-05 22:11 Joe Perches
2019-08-05 22:23 ` Nathan Chancellor
2019-08-10 19:32 ` Joe Perches
2019-08-10 19:44 ` Linus Torvalds
2019-08-10 20:18 ` Joe Perches
2019-08-10 20:33 ` Joe Perches
2019-08-16 19:58 ` rfc: treewide scripted patch mechanism? (was: Re: [PATCH] Makefile: Convert -Wimplicit-fallthrough=3 to just -Wimplicit-fallthrough for clang) Joe Perches
2019-08-19 23:24 ` rfc: treewide scripted patch mechanism? (was: Re: [PATCH] Makefile: Convert -Wimplicit-fallthrough=3 to just -Wimplicit-fallthrough for clang)QUILT Stephen Rothwell
2019-08-20 0:08 ` Joe Perches
2019-08-20 23:28 ` Linus Torvalds
2019-08-20 23:37 ` Joe Perches
2019-08-21 0:39 ` Linus Torvalds
2019-08-26 8:58 ` Geert Uytterhoeven
2019-08-21 0:20 ` Joe Perches
2019-08-21 0:43 ` Linus Torvalds
2019-08-21 0:58 ` stracpy Joe Perches
2019-08-21 4:01 ` rfc: treewide scripted patch mechanism? (was: Re: [PATCH] Makefile: Convert -Wimplicit-fallthrough=3 to just -Wimplicit-fallthrough for clang)QUILT Willy Tarreau
2019-08-21 0:33 ` Stephen Rothwell
2019-08-11 2:04 ` [PATCH] Makefile: Convert -Wimplicit-fallthrough=3 to just -Wimplicit-fallthrough for clang Nathan Chancellor
2019-08-11 3:06 ` Joe Perches
2019-08-11 3:17 ` Nathan Chancellor
2019-08-11 3:54 ` Joe Perches
2019-08-12 5:07 ` Joe Perches
2019-08-11 6:50 ` Bernd Petrovitsch
2019-08-12 16:28 ` Nick Desaulniers
2019-08-12 17:42 ` Joe Perches
2019-08-13 12:44 ` Miguel Ojeda
2019-08-15 2:44 ` Joe Perches
2019-08-16 8:47 ` 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=dc21098f97f864523df808797c49c734e07e1cfb.camel@perches.com \
--to=joe@perches.com \
--cc=clang-built-linux@googlegroups.com \
--cc=gustavo@embeddedor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=miguel.ojeda.sandonis@gmail.com \
--cc=natechancellor@gmail.com \
--cc=ndesaulniers@google.com \
--cc=torvalds@linux-foundation.org \
--cc=vivien.didelot@gmail.com \
/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®