[RFC 1/2] Add clang format file
Bruce Richardson
bruce.richardson at intel.com
Fri Mar 24 16:53:25 CET 2023
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 at 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
More information about the dev
mailing list