linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nick Desaulniers <ndesaulniers@google.com>
To: Joe Perches <joe@perches.com>,
	Miguel Ojeda <miguel.ojeda.sandonis@gmail.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
	LKML <linux-kernel@vger.kernel.org>,
	Kees Cook <keescook@chromium.org>, Borislav Petkov <bp@alien8.de>,
	"H . Peter Anvin" <hpa@zytor.com>,
	Thomas Gleixner <tglx@linutronix.de>, Pavel Machek <pavel@ucw.cz>,
	"Gustavo A . R . Silva" <gustavo@embeddedor.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Kan Liang <kan.liang@linux.intel.com>,
	Namhyung Kim <namhyung@kernel.org>, Jiri Olsa <jolsa@redhat.com>,
	Alexander Shishkin <alexander.shishkin@linux.intel.com>,
	Shawn Landden <shawn@git.icu>,
	"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)"
	<x86@kernel.org>, Nathan Chancellor <natechancellor@gmail.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	David Miller <davem@davemloft.net>,
	clang-built-linux <clang-built-linux@googlegroups.com>
Subject: Re: [PATCH 4/4] scripts/cvt_style.pl: Tool to reformat sources in various ways
Date: Wed, 9 Oct 2019 15:37:42 -0700	[thread overview]
Message-ID: <CAKwvOdm+u9ijMdfPQVZYU3tQCuhMePsvmKXA_kyyAaQUu2y5gA@mail.gmail.com> (raw)
In-Reply-To: <4a904777303fbaea75fe0875b7984c33824f4b68.1570292505.git.joe@perches.com>

On Sat, Oct 5, 2019 at 9:47 AM Joe Perches <joe@perches.com> wrote:
>
> Trivial tool to reformat source code in various ways.
>
> This is an old tool that was recently updated to convert /* fallthrough */
> style comments to the new pseudo-keyword fallthrough;
>
> Typical command line use is:
>     $ perl scripts/cvt_style --convert=fallthrough <file list>

It would be cool to include the treewide onliner from your cover sheet
in this commit message, as I find myself flipping between that and
this, otherwise the recommended onliner will be lost to LKML (instead
of being lost to git log). Or in the usage comment at the top of the
script.

>
> Available conversions:
>         all
>         printk_to_pr_level
>         printk_KERN_DEBUG_to_pr_debug
>         dev_printk_to_dev_level
>         dev_printk_KERN_DEBUG_to_dev_dbg
>         sdev_printk_to_sdev_level
>         sdev_printk_KERN_DEBUG_to_sdev_dbg
>         coalesce_formats
>         cuddle_open_brace
>         cuddle_else

I think some of these could use examples of what they do. I can't read
perl (as we've previously established :P) and I'm not sure what it
means to cuddle open braces or elses, though they do sound nice.

>         deparenthesize_returns
>         space_after_KERN_level
>         space_after_if_while_for_switch
>         space_after_for_semicolons
>         space_after_comma
>         space_before_pointer
>         space_around_trigraph
>         leading_spaces_to_tabs
>         coalesce_semicolons
>         remove_trailing_whitespace
>         remove_whitespace_before_quoted_newline
>         remove_whitespace_before_trailing_semicolon
>         remove_whitespace_before_bracket
>         remove_parenthesis_whitespace
>         remove_single_statement_braces
>         remove_whitespace_after_cast
>         hoist_assigns_from_if
>         convert_c99_comments
>         remove_private_data_casts
>         remove_static_initializations_to_0
>         remove_true_false_comparisons
>         remove_NULL_comparisons
>         remove_trailing_if_semicolons

To Miguel's comment about clang-format, it looks like you can do:

Use -style="{key: value, ...}" to set specific
                              parameters, e.g.:
                                -style="{BasedOnStyle: llvm, IndentWidth: 8}"

via: https://clang.llvm.org/docs/ClangFormat.html
which might make some nice one liners for some of these.


>         network_comments
>         remove_switchforwhileif_semicolons
>         detab_else_return
>         remove_while_while
>         fallthrough
> Additional conversions which may not work well:
>         (enable individually or with --convert=all --broken)
>         move_labels_to_column_1
>         space_around_logical_tests
>         space_around_assign
>         space_around_arithmetic
>         CamelCase_to_camel_case

s/camel_case/snake_case/

I'll give the script a run later this week and report back if I can
find any errors in the resulting build, as in the previous patch
series. Thanks for the work on this.
-- 
Thanks,
~Nick Desaulniers

  parent reply	other threads:[~2019-10-09 22:38 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-05 16:46 [PATCH 0/4] treewide: Add 'fallthrough' pseudo-keyword Joe Perches
2019-10-05 16:46 ` [PATCH 1/4] net: sctp: Rename fallthrough label to unhandled Joe Perches
2019-10-07 18:08   ` Nick Desaulniers
2019-10-10 20:34   ` Kees Cook
2019-10-11 12:20   ` Neil Horman
2019-10-05 16:46 ` [PATCH 2/4] compiler_attributes.h: Add 'fallthrough' pseudo keyword for switch/case use Joe Perches
2019-10-05 17:17   ` Miguel Ojeda
2019-10-07 18:14     ` Nick Desaulniers
2019-10-07 18:28       ` Joe Perches
2019-10-10 20:37     ` Kees Cook
2019-10-11 22:25       ` Miguel Ojeda
2019-10-05 16:46 ` [PATCH 3/4] Documentation/process: Add fallthrough pseudo-keyword Joe Perches
2019-10-05 17:47   ` Miguel Ojeda
2019-10-09 21:51     ` Nick Desaulniers
2019-10-05 16:46 ` [PATCH 4/4] scripts/cvt_style.pl: Tool to reformat sources in various ways Joe Perches
2019-10-05 17:31   ` Miguel Ojeda
2019-10-06  6:35     ` Joe Perches
2019-10-10 20:39       ` Kees Cook
2019-10-10 20:48         ` Joe Perches
2019-10-09 22:37   ` Nick Desaulniers [this message]
2019-10-11 16:29 ` [PATCH 0/4] treewide: Add 'fallthrough' pseudo-keyword Linus Torvalds
2019-10-11 17:43   ` Joe Perches
2019-10-11 17:46     ` Linus Torvalds
2019-10-12  2:14       ` Joe Perches
2019-10-11 18:01   ` Miguel Ojeda
2019-10-11 22:07     ` Kees Cook
2019-10-11 22:26       ` Miguel Ojeda

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=CAKwvOdm+u9ijMdfPQVZYU3tQCuhMePsvmKXA_kyyAaQUu2y5gA@mail.gmail.com \
    --to=ndesaulniers@google.com \
    --cc=acme@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=alexander.shishkin@linux.intel.com \
    --cc=bp@alien8.de \
    --cc=clang-built-linux@googlegroups.com \
    --cc=davem@davemloft.net \
    --cc=gustavo@embeddedor.com \
    --cc=hpa@zytor.com \
    --cc=joe@perches.com \
    --cc=jolsa@redhat.com \
    --cc=kan.liang@linux.intel.com \
    --cc=keescook@chromium.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=miguel.ojeda.sandonis@gmail.com \
    --cc=namhyung@kernel.org \
    --cc=natechancellor@gmail.com \
    --cc=pavel@ucw.cz \
    --cc=shawn@git.icu \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=x86@kernel.org \
    --subject='Re: [PATCH 4/4] scripts/cvt_style.pl: Tool to reformat sources in various ways' \
    /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

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).