From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5FF0744034; Wed, 15 May 2024 10:28:47 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DF3574025C; Wed, 15 May 2024 10:28:46 +0200 (CEST) Received: from mail-oa1-f42.google.com (mail-oa1-f42.google.com [209.85.160.42]) by mails.dpdk.org (Postfix) with ESMTP id 903464021D for ; Wed, 15 May 2024 10:28:45 +0200 (CEST) Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-23d3d092a1bso3559704fac.1 for ; Wed, 15 May 2024 01:28:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715761724; x=1716366524; darn=dpdk.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=TYuGcobn6vFqI9LZ8htt0QpKVg+wF5eYTzUVKavXLT4=; b=QZgvKp9bq4/gxUQnyRjOUQfa1wfCkfR1Mk/ln7tgM8Kg2viUYXWnODrPiTRkaGoU8Q Pqxt/oUSz3yZnwlFxGFFSFzHSzA3uEV+qnHa0nAHF3elcz25kaM95IHa97CoJnj4+lO1 WsLBB7p7bEPibXOkeVFDsTuuipll6rEeFDlRhYkRRQ78hWokwRG4cTApCE0/wl8j7Cy0 KMbtuRq3pqdnmyaRyUnTZYO2zjVrM3dLbDyVaHYDQviOpXTU4idjhjM46xUrZ7O26iqz b1cZkLd2EQfapxGaUAiG2jqm35V+CUF6oxa4rG+kz6B3lYqYUzFTwbNddVceqBmGOXlR 70AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715761724; x=1716366524; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=TYuGcobn6vFqI9LZ8htt0QpKVg+wF5eYTzUVKavXLT4=; b=CATppHxkQmq2Cnce879LQ/9+b75Ywx9ZbZTe7iU806DLVB/BmdfJUL3WsQrki1Mb8E 4di5SQ0X99FBFCBbA38tFmXOv+nFswXIKmS/lldnpcu1Hw5pWpV7nGaTX+rznLsYuFM2 9gdIcmOFBKigGrrmHPWRlxhWxSRx7gS0dvl/nW4i+M52qiEkvFfxp6gn7CKZwTPN+bxA aEgZFAWe7EIp6mOVTu+tCEqKqP7/8J9opM5yF/Bz9co52oQFAHtvCFh+fNsxY8P++GKb ShNZZcJkMX9PbBmOIWNVAo/PndrAnMDavGIEFVmk+KLM4Igb7EhOSsHr5TfARv9DtIsR O/zw== X-Gm-Message-State: AOJu0YyTcLBiL4hTHHIda4EQGH1DLNUrSSpiTDChK+IN8O6I4LMcqO8m z6yfA7dyPQG5OT6h8YtxdYVXuXNnYrizABbN9QVACeZ3EUw5AuPEminqibBR4BITLNOm1gYHyU5 r8mdhPh/nC2omETW4HeQfOfD7ugkpdooC X-Google-Smtp-Source: AGHT+IHVnHZxQJVmVywJZ0xVFH06rUMflDsA1kNxn/XV8l2HI9xRUgPBb5/abWY/yfI9M2NNqk/Q3Tb5SKD/s9JGlc0= X-Received: by 2002:a05:6870:f61f:b0:22d:fa53:5695 with SMTP id 586e51a60fabf-24172bcb9fcmr18386720fac.25.1715761724558; Wed, 15 May 2024 01:28:44 -0700 (PDT) MIME-Version: 1.0 References: <20240508211934.1143124-1-aomeryamac@gmail.com> In-Reply-To: From: =?UTF-8?B?QWJkdWxsYWggw5ZtZXIgWWFtYcOn?= Date: Wed, 15 May 2024 11:28:33 +0300 Message-ID: Subject: Re: [PATCH v4] devtools: add .clang-format file To: Ferruh Yigit Cc: dev@dpdk.org, stephen@networkplumber.org Content-Type: multipart/alternative; boundary="0000000000001c97de061879e8d7" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org --0000000000001c97de061879e8d7 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I want to update you. On Mon, May 13, 2024 at 4:08=E2=80=AFPM Ferruh Yigit = wrote: > On 5/8/2024 10:19 PM, Abdullah =C3=96mer Yama=C3=A7 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 =C3=96mer Yama=C3=A7 > > > > 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. > > 2. Double tab indentation vs parenthesis align > if (iter->bus !=3D NULL && > - /* not in middle of rte_eth_dev iteration, */ > - iter->class_device =3D=3D NULL) { > + /* not in middle of rte_eth_dev iteration, */ > + iter->class_device =3D=3D 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 > > 3. enum merged into single line > -enum { > - STAT_QMAP_TX =3D 0, > - STAT_QMAP_RX > -}; > +enum { STAT_QMAP_TX =3D 0, STAT_QMAP_RX }; > > This is ok; I will send a new patch for it. > > 4. split message strings > - RTE_ETHDEV_LOG_LINE(ERR, > - "Cannot initialize iterator from NULL device description > string"); > + RTE_ETHDEV_LOG_LINE(ERR, "Cannot initialize iterator from NULL " > + "device description string"); > > > 5. Empty open parenthesis > - RTE_ETHDEV_LOG_LINE(ERR, > - "Cannot get next device from NULL iterator"); > + RTE_ETHDEV_LOG_LINE( > + ERR, "Cannot get next device from NULL iterator"); > > I couldn't find a solution, so I am still working on it. > > 6. space before macro arguments > - RTE_ETH_FOREACH_DEV(p) > + RTE_ETH_FOREACH_DEV (p) > > This is ok. The fix will be in the next patch. > > 7. some lists get merged (this seems similar to 3.) > - RTE_PTYPE_L2_MASK, > - RTE_PTYPE_L3_MASK, > - RTE_PTYPE_L4_MASK, > - RTE_PTYPE_TUNNEL_MASK, > - RTE_PTYPE_INNER_L2_MASK, > - RTE_PTYPE_INNER_L3_MASK, > + RTE_PTYPE_L2_MASK, RTE_PTYPE_L3_MASK, > + RTE_PTYPE_L4_MASK, RTE_PTYPE_TUNNEL_MASK, > + RTE_PTYPE_INNER_L2_MASK, RTE_PTYPE_INNER_L3_MASK, > > I couldn't find a configuration that aligns with array initialization. > > > Thanks, > ferruh > --0000000000001c97de061879e8d7 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I want to update you.=C2=A0

On Mon, May 13= , 2024 at 4:08=E2=80=AFPM Ferruh Yigit <ferruh.yigit@amd.com> wrote:
On 5/8/2024 10:19 PM, Abdullah =C3=96mer Yama= =C3=A7 wrote:
> clang-format is a tool to format C/C++/Objective-C code. It can be use= d
> 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<= br> > 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 =C3=96mer Yama=C3=A7 <aomeryamac@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 d= on't
want to start this discussion.

In=C2=A0the .editorconfig file, 100 is stated as a ma= x_line_length. That's why I prefer 100.=C2=A0

2. Double tab indentation vs parenthesis align
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (iter->bus !=3D NULL &&
=C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0/* not in middle of rte_eth_dev iteration, */
=C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0iter->class_device =3D=3D NULL) {
=C2=A0+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0/* not in middle of rte_eth= _dev iteration, */
=C2=A0+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0iter->class_device =3D= =3D 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=C2=A0

3. enum merged into single line
=C2=A0-enum {
=C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0STAT_QMAP_TX =3D 0,
=C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0STAT_QMAP_RX
=C2=A0-};
=C2=A0+enum { STAT_QMAP_TX =3D 0, STAT_QMAP_RX };

This is ok; I will send a new patch for it.=C2=A0

4. split message strings
=C2=A0- RTE_ETHDEV_LOG_LINE(ERR,
=C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"Cannot initialize iterator f= rom NULL device description
string");
=C2=A0+ RTE_ETHDEV_LOG_LINE(ERR, "Cannot initialize iterator from NULL= "
=C2=A0+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 "device description string");


5. Empty open parenthesis
=C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0RTE_ETHDEV_LOG_LINE(ERR,
=C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0"Cannot = get next device from NULL iterator");
=C2=A0+=C2=A0 =C2=A0 =C2=A0 =C2=A0RTE_ETHDEV_LOG_LINE(
=C2=A0+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0ERR, "Ca= nnot get next device from NULL iterator");

I couldn't find a solution, so I am=C2=A0still wo= rking on it.=C2=A0

6. space before macro arguments
-=C2=A0 =C2=A0 =C2=A0 =C2=A0RTE_ETH_FOREACH_DEV(p)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0RTE_ETH_FOREACH_DEV (p)

This is ok. The fix will be in the next patch.
<= blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-l= eft:1px solid rgb(204,204,204);padding-left:1ex">
7. some lists get merged (this seems similar to 3.)
=C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0RTE_PTYPE_L2_= MASK,
=C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0RTE_PTYPE_L3_= MASK,
=C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0RTE_PTYPE_L4_= MASK,
=C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0RTE_PTYPE_TUN= NEL_MASK,
=C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0RTE_PTYPE_INN= ER_L2_MASK,
=C2=A0-=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0RTE_PTYPE_INN= ER_L3_MASK,
=C2=A0+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0RTE_PTYPE_L2_= MASK,=C2=A0 =C2=A0 =C2=A0 =C2=A0RTE_PTYPE_L3_MASK,
=C2=A0+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0RTE_PTYPE_L4_= MASK,=C2=A0 =C2=A0 =C2=A0 =C2=A0RTE_PTYPE_TUNNEL_MASK,
=C2=A0+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0RTE_PTYPE_INN= ER_L2_MASK, RTE_PTYPE_INNER_L3_MASK,

I couldn't find a configuration that aligns with = array initialization.