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 EABBF44035; Wed, 15 May 2024 12:20:04 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 5D86C4025C; Wed, 15 May 2024 12:20:04 +0200 (CEST) Received: from mail-oa1-f49.google.com (mail-oa1-f49.google.com [209.85.160.49]) by mails.dpdk.org (Postfix) with ESMTP id A3C2B4021D for ; Wed, 15 May 2024 12:20:02 +0200 (CEST) Received: by mail-oa1-f49.google.com with SMTP id 586e51a60fabf-23dd4dca5dbso2060515fac.0 for ; Wed, 15 May 2024 03:20:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715768402; x=1716373202; 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=DPX+RjDDlxoQKHRyJx2sxJsRxMXeuvt0AUjNuWIM0jI=; b=HoYl+0KgPcHahvNmi0hogmRRz371bdivWHlVegrOkbMLK3lxuxpdhwgVv1HochCY8P REe3RFGNFHhIjVAcF2xogAOlpwFe6RSgy4ljAoRSmWOKh1NHriRQZUCQzz3UNvCbbI9x vgymJhmjuIse2kWnN19LIA9NvtYdAj9YSGNDkNUlA7KDYJpiS2s+QYnepPeID6/jAkwa 68IQUnElEMTgOY5ep2yJYbASTuwhHtexG2bqeT5ZPUduXw5GPBKEieij6UPRjUYRxk7g Yg2fJT3+FkA6II3im69Q46j6MlSg2wOBLDSXacil3y3r+1og9kIJgb7Rm5es6+3I3e67 2iQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715768402; x=1716373202; 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=DPX+RjDDlxoQKHRyJx2sxJsRxMXeuvt0AUjNuWIM0jI=; b=tCgAnMHPuV7CoGq4HD9KI3rqaJsPbQziWn8oCDp1TGuw+iJ4RisGQG0NSMeUK+Az7y 2dnZ/TznctQrOBdmHQjbDf53jEYYTpKNtsLPL3gKX6CxmI+0rZegFS0WNvfaGzs229bo 6alb6JOfL1FC0lMkmeKOMAK/djnRTenDyn00JBcZpyRmRyOZXzNLlAO65l8aaAs6iv5v k3vZc3FLcXhDMs5NbwqFWpOEDQ8xAJy/3fZWIay+ufJm74PjmBYOrrdgw6X1M2cjr/b/ jH47pD1gHiPu+1hKetw2tjIWWEQPg8UQPW5+1hT16TmvvoIRiSjGsl5z0md9uiZmr5rt ZABg== X-Forwarded-Encrypted: i=1; AJvYcCVdCfHI73wjVh4x9yue8aAPpfXcS4T24S7CeW63m1BE9GNdRhtT9qvg5vsQtB9uc5Ng/l8Xv7VRfO9MyUg= X-Gm-Message-State: AOJu0YzLwprZJu0UT7NNGetgQJQN06CCDo8+O1OT6vf2aYOHNGYhEfsf t+d7o6g5HaRktztoZYKTn7hEYSrmj0wQCLk0BFzku/hiUi8OTAG2+ZXM2xqwEYcTuvQAOBB8Hd4 m0zjqWZI3dgrgq0D1aqCDl2nURn0= X-Google-Smtp-Source: AGHT+IGBnHfehZm/FAyDUHgoxuNkVD5QxFbCUnElmMzOO1+66t3ORdLyTWmiiwlypX1nN4g/qTOTwptnYkEBq6jSHF8= X-Received: by 2002:a05:6870:93c7:b0:22a:6a92:a83c with SMTP id 586e51a60fabf-241127188afmr8716272fac.25.1715768401762; Wed, 15 May 2024 03:20:01 -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 13:19:50 +0300 Message-ID: Subject: Re: [PATCH v4] devtools: add .clang-format file To: Bruce Richardson Cc: Ferruh Yigit , dev@dpdk.org, stephen@networkplumber.org Content-Type: multipart/alternative; boundary="0000000000001aa2fb06187b7630" 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 --0000000000001aa2fb06187b7630 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, May 15, 2024 at 11:43=E2=80=AFAM Bruce Richardson < bruce.richardson@intel.com> wrote: > On Wed, May 15, 2024 at 11:28:33AM +0300, Abdullah =C3=96mer Yama=C3=A7 w= rote: > > I want to update you. > > On Mon, May 13, 2024 at 4:08=E2=80=AFPM Ferruh Yigit <[1]ferruh.yigi= t@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 > > used > > > to reformat code to match a given coding style, or to ensure tha= t > > 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 <[2]aomeryamac@gmai= l.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 !=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 > > > > 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. > Thanks, > /Bruce > --0000000000001aa2fb06187b7630 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Wed, May 15, 2024 at 11:43=E2=80= =AFAM Bruce Richardson <br= uce.richardson@intel.com> wrote:
On Wed, May 15, 2024 at 11:28:33AM +0300, Abdullah = =C3=96mer Yama=C3=A7 wrote:
>=C2=A0 =C2=A0 I want to update you.
>=C2=A0 =C2=A0 On Mon, May 13, 2024 at 4:08=E2=80=AFPM Ferruh Yigit <= [1]ferruh.yigit@a= md.com>
>=C2=A0 =C2=A0 wrote:
>
>=C2=A0 =C2=A0 =C2=A0 On 5/8/2024 10:19 PM, Abdullah =C3=96mer Yama=C3= =A7 wrote:
>=C2=A0 =C2=A0 =C2=A0 > clang-format is a tool to format C/C++/Object= ive-C code. It can be
>=C2=A0 =C2=A0 =C2=A0 used
>=C2=A0 =C2=A0 =C2=A0 > to reformat code to match a given coding styl= e, or to ensure that
>=C2=A0 =C2=A0 =C2=A0 code
>=C2=A0 =C2=A0 =C2=A0 > adheres to a specific coding style. It helps = to maintain a
>=C2=A0 =C2=A0 =C2=A0 consistent
>=C2=A0 =C2=A0 =C2=A0 > coding style across the DPDK codebase.
>=C2=A0 =C2=A0 =C2=A0 >
>=C2=A0 =C2=A0 =C2=A0 > .clang-format file overrides the default styl= e options provided by
>=C2=A0 =C2=A0 =C2=A0 > clang-format and large set of IDEs and text e= ditors support it.
>=C2=A0 =C2=A0 =C2=A0 >
>=C2=A0 =C2=A0 =C2=A0 > Signed-off-by: Abdullah =C3=96mer Yama=C3=A7 = <[2]aomeryamac= @gmail.com>
>=C2=A0 =C2=A0 =C2=A0 >
>=C2=A0 =C2=A0 =C2=A0 Hi Omer,
>=C2=A0 =C2=A0 =C2=A0 I tried on ethdev.c (clang-format -i ./lib/ethdev/= rte_ethdev.c), I
>=C2=A0 =C2=A0 =C2=A0 will
>=C2=A0 =C2=A0 =C2=A0 highlight a few issues below (not all of them), I = hope it is OK to
>=C2=A0 =C2=A0 =C2=A0 continue step by step, fixing these issues.
>=C2=A0 =C2=A0 =C2=A0 1. clang format failed for following options, not = sure why, am I
>=C2=A0 =C2=A0 =C2=A0 using a
>=C2=A0 =C2=A0 =C2=A0 wrong version:
>=C2=A0 =C2=A0 =C2=A0 LineEnding: LF
>=C2=A0 =C2=A0 =C2=A0 InsertNewlineAtEOF: true
>=C2=A0 =C2=A0 =C2=A0 I commented them out to continue the test.
>=C2=A0 =C2=A0 =C2=A0 And for 'ColumnLimit', I prefer default 80= with the flexibility to
>=C2=A0 =C2=A0 =C2=A0 go
>=C2=A0 =C2=A0 =C2=A0 100 when makes sense, so I will got with 'Colu= mnLimit: 80'; but I
>=C2=A0 =C2=A0 =C2=A0 don't
>=C2=A0 =C2=A0 =C2=A0 want to start this discussion.
>
>=C2=A0 =C2=A0 In the .editorconfig file, 100 is stated as a max_line_le= ngth. That's
>=C2=A0 =C2=A0 why I prefer 100.
>

+1 for keeping as 100

>=C2=A0 =C2=A0 =C2=A0 2. Double tab indentation vs parenthesis align
>=C2=A0 =C2=A0 =C2=A0 =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 =C2=A0 =C2=A0 =C2=A0/* not in middle of rte_eth_dev it= eration,
>=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 =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 =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=A0it= er->class_device =3D=3D NULL) {
>=C2=A0 =C2=A0 =C2=A0 DPDK coding guide suggests double tab, but also ac= cepts alignment by
>=C2=A0 =C2=A0 =C2=A0 spaces. But as far as I can see most of code has d= ouble tab.
>=C2=A0 =C2=A0 =C2=A0 Majority of the diff caused because of this rule.<= br> >
>=C2=A0 =C2=A0 Still, some discussions are going on
>

This is one where I don't think we will were reach a consensus, and eve= n 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.=C2=A0
There is an option called "Align= AfterOpenBracket" which horizontally aligns arguments after an open br= acket.
if I set it to "DontAlign"=C2=A0then "Continuation= IndentWidth" will be active. Depending on the value of ContinuationInd= entWidth, two tabs, single tabs, or spaces will be acceptable.
Thanks,
/Bruce
--0000000000001aa2fb06187b7630--