[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dc21098f97f864523df808797c49c734e07e1cfb.camel@perches.com>
Date: Fri, 16 Aug 2019 01:47:46 -0700
From: Joe Perches <joe@...ches.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Vivien Didelot <vivien.didelot@...il.com>
Cc: Nathan Chancellor <natechancellor@...il.com>,
Linus Torvalds <torvalds@...ux-foundation.org>,
"Gustavo A. R. Silva" <gustavo@...eddedor.com>,
LKML <linux-kernel@...r.kernel.org>,
clang-built-linux <clang-built-linux@...glegroups.com>
Subject: Re: [PATCH] Makefile: Convert -Wimplicit-fallthrough=3 to just
-Wimplicit-fallthrough for clang
(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
Powered by blists - more mailing lists