lkml.org 
[lkml]   [2019]   [Aug]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] Makefile: Convert -Wimplicit-fallthrough=3 to just -Wimplicit-fallthrough for clang
From
Date
(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

\
 
 \ /
  Last update: 2019-08-16 10:48    [W:0.365 / U:0.104 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site