DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: Stephen Hemminger <stephen@networkplumber.org>
Cc: <dev@dpdk.org>
Subject: Re: [RFC 1/2] Add clang format file
Date: Fri, 24 Mar 2023 15:53:25 +0000	[thread overview]
Message-ID: <ZB3HdV1URPUFgXgB@bricha3-MOBL.ger.corp.intel.com> (raw)
In-Reply-To: <20230322170655.45166-2-stephen@networkplumber.org>

On Wed, Mar 22, 2023 at 10:06:54AM -0700, Stephen Hemminger wrote:
> Based off of Linux kernel style with some local modifications
> and DPDK foreach macros.
> 
> A couple of open questions to be resolved befor merging.
> Is GPL license ok for config file (inherited from Linux here)?
> Do we want to have per-driver files for some drivers (like MLX5)?
> 
> Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
> ---
>  .clang-format | 181 ++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 file changed, 181 insertions(+)
>  create mode 100644 .clang-format
> 
> diff --git a/.clang-format b/.clang-format
> new file mode 100644
> index 000000000000..ad4d30520253
> --- /dev/null
> +++ b/.clang-format
> @@ -0,0 +1,181 @@
> +# SPDX-License-Identifier: GPL-2.0
> +#
> +# clang-format configuration file. Intended for clang-format >= 11.
> +#
> +# For more information, see:
> +#
> +#   Documentation/process/clang-format.rst
> +#   https://clang.llvm.org/docs/ClangFormat.html
> +#   https://clang.llvm.org/docs/ClangFormatStyleOptions.html
> +#
> +---
> +AccessModifierOffset: -4
> +AlignAfterOpenBracket: Align

This may be partially a matter of personal preference, but I disagree with
using this setting. This sets up line continuations with varaible widths,
and leads to:
* continuation lines being very short if the function name in a wrapped
  call is long
* indentation using a mix of tabs and spaces as it tries to line up exactly
  on a column with brackets

I think a better option for this setting, which is also aligned with our
coding rules, is for this to be set to "DontAlign" and the
"ContinuationIndentWidth" set to 16, leading to double-tab continuations
(at least in my testing).

/Bruce

  reply	other threads:[~2023-03-24 15:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-22 17:06 [RFC 0/2] add clang-format infrastructure Stephen Hemminger
2023-03-22 17:06 ` [RFC 1/2] Add clang format file Stephen Hemminger
2023-03-24 15:53   ` Bruce Richardson [this message]
2023-03-24 19:24     ` Tyler Retzlaff
2023-03-22 17:06 ` [RFC 2/2] doc: add clang-format documentation Stephen Hemminger

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=ZB3HdV1URPUFgXgB@bricha3-MOBL.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=stephen@networkplumber.org \
    /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;
as well as URLs for NNTP newsgroup(s).