On Wed, May 15, 2024 at 01:19:50PM +0300, Abdullah Ömer Yamaç wrote:
>    On Wed, May 15, 2024 at 11:43 AM Bruce Richardson
>    <[1]bruce.richard...@intel.com> wrote:
> 
>      On Wed, May 15, 2024 at 11:28:33AM +0300, Abdullah Ömer Yamaç wrote:
>      >    I want to update you.
>      >    On Mon, May 13, 2024 at 4:08 PM Ferruh Yigit
>      <[1][2]ferruh.yi...@amd.com>
>      >    wrote:
>      >
>      >      On 5/8/2024 10:19 PM, Abdullah Ömer Yamaç wrote:
>      >      > clang-format is a tool to format C/C++/Objective-C code. It
>      can be
>      >      used
>      >      > to reformat code to match a given coding style, or to
>      ensure that
>      >      code
>      >      > adheres to a specific coding style. It helps to maintain a
>      >      consistent
>      >      > coding style across the DPDK codebase.
>      >      >
>      >      > .clang-format file overrides the default style options
>      provided by
>      >      > clang-format and large set of IDEs and text editors support
>      it.
>      >      >
>      >      > Signed-off-by: Abdullah Ömer Yamaç
>      <[2][3]aomerya...@gmail.com>
>      >      >
>      >      Hi Omer,
>      >      I tried on ethdev.c (clang-format -i
>      ./lib/ethdev/rte_ethdev.c), I
>      >      will
>      >      highlight a few issues below (not all of them), I hope it is
>      OK to
>      >      continue step by step, fixing these issues.
>      >      1. clang format failed for following options, not sure why,
>      am I
>      >      using a
>      >      wrong version:
>      >      LineEnding: LF
>      >      InsertNewlineAtEOF: true
>      >      I commented them out to continue the test.
>      >      And for 'ColumnLimit', I prefer default 80 with the
>      flexibility to
>      >      go
>      >      100 when makes sense, so I will got with 'ColumnLimit: 80';
>      but I
>      >      don't
>      >      want to start this discussion.
>      >
>      >    In the .editorconfig file, 100 is stated as a max_line_length.
>      That's
>      >    why I prefer 100.
>      >
>      +1 for keeping as 100
>      >      2. Double tab indentation vs parenthesis align
>      >               if (iter->bus != NULL &&
>      >       -                       /* not in middle of rte_eth_dev
>      iteration,
>      >      */
>      >       -                       iter->class_device == NULL) {
>      >       +           /* not in middle of rte_eth_dev iteration, */
>      >       +           iter->class_device == NULL) {
>      >      DPDK coding guide suggests double tab, but also accepts
>      alignment by
>      >      spaces. But as far as I can see most of code has double tab.
>      >      Majority of the diff caused because of this rule.
>      >
>      >    Still, some discussions are going on
>      >
>      This is one where I don't think we will were reach a consensus, and
>      even if
>      we did, it would mean massive churn to DPDK. Can we have
>      clang-format NOT
>      adjust line-continuations in a file?
> 
>    I am not an expert on clang, but it seems we don't have such a
>    configuration.
>    There is an option called "AlignAfterOpenBracket" which horizontally
>    aligns arguments after an open bracket.
>    if I set it to "DontAlign" then "ContinuationIndentWidth" will be
>    active. Depending on the value of ContinuationIndentWidth, two tabs,
>    single tabs, or spaces will be acceptable.
> 

Is there any way to specify per-file the style to be used, e.g. via a
header in the file or a macro to override? While the whole DPDK project is
inconsistent, we should look for consistency within files.

In the absence of that, given the number of strong opinions already
expressed, I'd suggest defaulting the align value to DontAlign for now.

/Bruce

Reply via email to