[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOdm+u9ijMdfPQVZYU3tQCuhMePsvmKXA_kyyAaQUu2y5gA@mail.gmail.com>
Date: Wed, 9 Oct 2019 15:37:42 -0700
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Joe Perches <joe@...ches.com>,
Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>,
Kees Cook <keescook@...omium.org>,
Borislav Petkov <bp@...en8.de>,
"H . Peter Anvin" <hpa@...or.com>,
Thomas Gleixner <tglx@...utronix.de>,
Pavel Machek <pavel@....cz>,
"Gustavo A . R . Silva" <gustavo@...eddedor.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Kan Liang <kan.liang@...ux.intel.com>,
Namhyung Kim <namhyung@...nel.org>,
Jiri Olsa <jolsa@...hat.com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Shawn Landden <shawn@....icu>,
"maintainer:X86 ARCHITECTURE (32-BIT AND 64-BIT)" <x86@...nel.org>,
Nathan Chancellor <natechancellor@...il.com>,
Andrew Morton <akpm@...ux-foundation.org>,
David Miller <davem@...emloft.net>,
clang-built-linux <clang-built-linux@...glegroups.com>
Subject: Re: [PATCH 4/4] scripts/cvt_style.pl: Tool to reformat sources in
various ways
On Sat, Oct 5, 2019 at 9:47 AM Joe Perches <joe@...ches.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
Powered by blists - more mailing lists