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 B13E14403C; Wed, 15 May 2024 22:32:16 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 363B84029E; Wed, 15 May 2024 22:32:16 +0200 (CEST) Received: from mail-oo1-f53.google.com (mail-oo1-f53.google.com [209.85.161.53]) by mails.dpdk.org (Postfix) with ESMTP id 4108C4021D for ; Wed, 15 May 2024 22:32:14 +0200 (CEST) Received: by mail-oo1-f53.google.com with SMTP id 006d021491bc7-5b1bbff09f8so3377824eaf.1 for ; Wed, 15 May 2024 13:32:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1715805133; x=1716409933; 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=Go2n10eqWseUjVWSmEqNZEg5zMG80fTLOtr+cZbYlPw=; b=lliOrG0l8qpj0SgQlCpv2aMbistwMW+ihY+Timc4R1cniW1IC0ckPKjjvQ8Xcxpzzl lGsooy1bu4qWj0HjLaIpqOBfFlEoCKFD6W8Fkl7ijnCPQhJkw7tgyrWlpiJUJmlqLzrv xOPeqEEI8QGTowid7XEB4FKy6079x2veG8Q4CV49fzKbtx9FKy0gklt3rH2ni9evuoXg DiUG7Jc0Y5FbLnI1xHnxw3M67UjeBsgzN6z6OGfpSuK5/6D4IYYWw2nYwGfSc8+smsYT KT5PFe62U8qT9uNUr2mJBHO8p0rSFkM6OM1MS9ZTFIAn0pYTBN0WknlBJCN2PUxb81iG SA3w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715805133; x=1716409933; 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=Go2n10eqWseUjVWSmEqNZEg5zMG80fTLOtr+cZbYlPw=; b=RdPEpEhn17zJd/VK2J+u9qo92P9Lvr6YX+4ERiHUa0QBHE4BFsnjdqqIfUtLOUKBd8 JansvR+5fKQD4dN3+far6huZC0NeLU//P9Bl5tCU4CyziVCXKDr74wbN77lwO8ulu8zE PPrlpDj2tCH+i5qEL383F7dSRuOg0wY7f/vYI0UQSd84Gan92n77/RkJ6FebajCHNdhB qcg2DtrmiCHM+Rnd9+KJePjh5pHxjlAkTLk7MpNxZOxFcLDLsuuzAdu/5tnQ4U7x9tTC jsUXHqAkcbh2ru6pIapBccMFTRpt7Q3iByWP5wWIfiIZ2fp+HDfR1VxBv4koFiY5amNb HL2Q== X-Forwarded-Encrypted: i=1; AJvYcCWYxhwm41GFaJtaH7qqPvZ1gf8KU1E6zSByF+ZeWqsacNwt6cbzShVq4/RrUPOa0/m5lKQOYNzhZ9332X8= X-Gm-Message-State: AOJu0YySQO83omB2jT2MjeJl5Yf1aSzzOdYG2kbsoujLle6S92gpWKNP NS+rotN1L+3NVRvdECLVzLbWeovdTA9uqtbF3W9aSZUaOSAMxFX31SxRqpsqKviGLZcvPTG4U/h FWt9xflxxUB9qdunEc/w0Xmx6aS0= X-Google-Smtp-Source: AGHT+IFbxJd6uEvSSY35yyoPtIUZ/aK6KpBX3pNIlA8ZAebP6ujw4vm7vHnDpPdOoFVg4C3PgcI0tWkwO0HxyoOs82k= X-Received: by 2002:a05:6871:711:b0:23c:253c:283c with SMTP id 586e51a60fabf-24171e0f27amr8459404fac.20.1715805133217; Wed, 15 May 2024 13:32:13 -0700 (PDT) MIME-Version: 1.0 References: <20240508211934.1143124-1-aomeryamac@gmail.com> <20240515080719.6964bf8a@hermes.local> In-Reply-To: <20240515080719.6964bf8a@hermes.local> From: =?UTF-8?B?QWJkdWxsYWggw5ZtZXIgWWFtYcOn?= Date: Wed, 15 May 2024 23:32:03 +0300 Message-ID: Subject: Re: [PATCH v4] devtools: add .clang-format file To: Stephen Hemminger Cc: Bruce Richardson , Ferruh Yigit , dev@dpdk.org Content-Type: multipart/alternative; boundary="00000000000078271406188403f3" 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 --00000000000078271406188403f3 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Wed, May 15, 2024 at 6:07=E2=80=AFPM Stephen Hemminger < stephen@networkplumber.org> wrote: > On Wed, 15 May 2024 09:43:22 +0100 > Bruce Richardson wrote: > > > On Wed, May 15, 2024 at 11:28:33AM +0300, Abdullah =C3=96mer Yama=C3=A7= wrote: > > > I want to update you. > > > On Mon, May 13, 2024 at 4:08=E2=80=AFPM Ferruh Yigit <[1] > 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 ca= n > 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 provide= d > by > > > > clang-format and large set of IDEs and text editors support it= . > > > > > > > > Signed-off-by: Abdullah =C3=96mer Yama=C3=A7 <[2]aomeryamac@gm= ail.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 alignmen= t > 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 eve= n > if > > we did, it would mean massive churn to DPDK. Can we have clang-format N= OT > > adjust line-continuations in a file? > > > Clang format is useful on new and seriously broken code. > Do not want to do it automatically or accept patches across all the > current code. > > For indentation, can we get some setting that matches what DPDK double ta= b > does? > It seems possible. If there is no objection, I will send a new patch with the previous notes Ferruh stated. > If not is there something close. Often useful to look at the other clang > format > pre-set styles in source. > --00000000000078271406188403f3 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable


=
On Wed, May 15, 2024 at 6:07=E2=80=AF= PM Stephen Hemminger <step= hen@networkplumber.org> wrote:
On Wed, 15 May 2024 09:43:22 +0100
Bruce Richardson <bruce.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.yi= git@amd.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 =C2=A0 > clang-format is a tool to format C/C++/O= bjective-C code. It can be=C2=A0
> >=C2=A0 =C2=A0 =C2=A0 used=C2=A0
> >=C2=A0 =C2=A0 =C2=A0 > to reformat code to match a given coding= style, or to ensure that=C2=A0
> >=C2=A0 =C2=A0 =C2=A0 code=C2=A0
> >=C2=A0 =C2=A0 =C2=A0 > adheres to a specific coding style. It h= elps to maintain a=C2=A0
> >=C2=A0 =C2=A0 =C2=A0 consistent=C2=A0
> >=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= style options provided by
> >=C2=A0 =C2=A0 =C2=A0 > clang-format and large set of IDEs and t= ext editors support it.
> >=C2=A0 =C2=A0 =C2=A0 >
> >=C2=A0 =C2=A0 =C2=A0 > Signed-off-by: Abdullah =C3=96mer Yama= =C3=A7 <[2]aom= eryamac@gmail.com>
> >=C2=A0 =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/et= hdev/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 defau= lt 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 '= ;ColumnLimit: 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_li= ne_length. That's
> >=C2=A0 =C2=A0 why I prefer 100.
> >=C2=A0 =C2=A0
>
> +1 for keeping as 100
>
> >=C2=A0 =C2=A0 =C2=A0 2. Double tab indentation vs parenthesis alig= n
> >=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0if (iter-&g= t;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_de= v 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= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0iter->class_device =3D=3D N= ULL) {
> >=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= =A0iter->class_device =3D=3D NULL) {
> >=C2=A0 =C2=A0 =C2=A0 DPDK coding guide suggests double tab, but al= so accepts alignment by
> >=C2=A0 =C2=A0 =C2=A0 spaces. But as far as I can see most of code = has double tab.
> >=C2=A0 =C2=A0 =C2=A0 Majority of the diff caused because of this r= ule.
> >
> >=C2=A0 =C2=A0 Still, some discussions are going on
> >=C2=A0 =C2=A0
>
> This is one where I don't think we will were reach a consensus, an= d even if
> we did, it would mean massive churn to DPDK. Can we have clang-format = NOT
> adjust line-continuations in a file?


Clang format is useful on new and seriously broken code.
Do not want to do it automatically or accept patches across all the current= code.

For indentation, can we get some setting that matches what DPDK double tab = does?
It seems possible. If there is no objection, I w= ill send a new patch with the previous notes Ferruh stated.=C2=A0=C2=A0
If not is there something close. Often useful to look at the other clang fo= rmat
pre-set styles in source.
--00000000000078271406188403f3--