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 D6C1343F47; Mon, 29 Apr 2024 17:44:00 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 718BE402A3; Mon, 29 Apr 2024 17:44:00 +0200 (CEST) Received: from mail-pl1-f180.google.com (mail-pl1-f180.google.com [209.85.214.180]) by mails.dpdk.org (Postfix) with ESMTP id 3B7D64029C for ; Mon, 29 Apr 2024 17:43:59 +0200 (CEST) Received: by mail-pl1-f180.google.com with SMTP id d9443c01a7336-1e3c9300c65so38084485ad.0 for ; Mon, 29 Apr 2024 08:43:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1714405438; x=1715010238; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=rFRiUfACCZhQwAfK3onSWIJbh+K4hzt2KNI2HTG0bgo=; b=L/+ml3EfKWdisoLxkZiblErnoi9HVCzmRgk6FUcqpEIKab76i1SN3/tvUEy3kpZk3l Ww5AUZ5H/7hH9pISK9AVaRIl7WY1TSfqYiSCWj7f7ibNk0ySkvUAcx90MMGwFzAw7P6c 7XxQlFYj9NO7/BvC+2MrCHxKwBw4tvfiipKDCuRFSg6sdoF1GyvzWC4LCw3Aa/+75mbM bYDBHy73HC45wMXkigGVXyqDrn60qrbQ66mom4jDmZRqZARYlyONHAhYAZ7+arTlB/ue Tm5GSFdy+r/23TXZnv5Q1rlNI9PBGNLMYwCXuwPYXyC/eMwcxrEthX2yZ39soxVU+Lv1 NrIw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714405438; x=1715010238; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=rFRiUfACCZhQwAfK3onSWIJbh+K4hzt2KNI2HTG0bgo=; b=V7/hs2Yva/iXnLe+ibtCwEt7Tp1g1Riv6yr3cSK9kR7od2C63z26ggNHKf/3JOHkLp 4d/QXCZ7QAZCo6UILRXEg/iDBh0jHKLpf+ZreXlawIW9cdTCFufwWYZGIldbo/VIKOzI 8E7CYVxhPMY2tIrj374g7L2q+WdXozGrZA4qlEV1G14jqQfZMh4sx9/0jURepaAffMZl zdbehRnYCf8NKY1U8+ohkxRggOUnb1XzMy2J6F3en+5KNCd/wz2pvhxJkflO8ipoXqFo ZdIhK60twCkH5WIx+/zaDwqFlWGX9P1jwYuKRRCibLhhEclWlne6kG3/tJ4SPF8zPgI4 tRzQ== X-Forwarded-Encrypted: i=1; AJvYcCX3nzCjhHNv5uMKoVFIGPjJCBMpNZoMwwMKU7cIVEoYDZ3fUuTnS5zXTshJLMsVFQ3X2CIfSUsLuriqdbA= X-Gm-Message-State: AOJu0YxGaKgOSczACSjNYZENIOYEdaG/WIccHyF4YEOyLmx15xrAfJPt d0P4Ff255WDwnRaK7UDJy87FjuY3+hNDfbzC5Iy1vM70tvAhGAwuYpZohx2kf+U= X-Google-Smtp-Source: AGHT+IExK8Wsbjm2qZl7SZlYEZdJYNTvyGFFfBCYc9y72zDna5Yb0gkQILmTYSg6T864ywuqd3ngcA== X-Received: by 2002:a17:902:b596:b0:1e4:4887:74f0 with SMTP id a22-20020a170902b59600b001e4488774f0mr9025871pls.36.1714405438359; Mon, 29 Apr 2024 08:43:58 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id b5-20020a170902d88500b001e40898e9acsm20474077plz.276.2024.04.29.08.43.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Apr 2024 08:43:58 -0700 (PDT) Date: Mon, 29 Apr 2024 08:43:56 -0700 From: Stephen Hemminger To: Ferruh Yigit Cc: Abdullah =?UTF-8?B?w5ZtZXIgWWFtYcOn?= , dev@dpdk.org, thomas@monjalon.net Subject: Re: [PATCH] devtools: add .clang-format file Message-ID: <20240429084356.58ac2bc8@hermes.local> In-Reply-To: <64089d51-ed3c-4383-9014-920d772c9a98@amd.com> References: <20240429130414.1049310-1-aomeryamac@gmail.com> <64089d51-ed3c-4383-9014-920d772c9a98@amd.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 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 On Mon, 29 Apr 2024 14:32:43 +0100 Ferruh Yigit wrote: > On 4/29/2024 2:04 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. > >=20 > > .clang-format file overrides the default style options provided by > > clang-format and large set of IDEs and text editors support it. > >=20 > > Signed-off-by: Abdullah =C3=96mer Yama=C3=A7 > > =20 >=20 > Overall +1 to have a format file, specially to help non-frequent > contributors. >=20 > 1. Some options are failing for me [1], I don't know if it requires a > specific version of clang-format >=20 > 2. Current options are not fully aligned with coding convention, it is > easier to see what is not compatible by running the tool on an existing > file [2]. > we need to fix them. >=20 >=20 >=20 > [1] > `clang-format -i ./lib/ethdev/rte_ethdev.c` > a. > /home/amd/development/dpdk-next-net/./.clang-format:28:1: error: unknown > key 'Whitespace' > Whitespace: > ^~~~~~~~~~ > Error reading /home/amd/development/dpdk-next-net/./.clang-format: > Invalid argument >=20 > b. > /home/amd/development/dpdk-next-net/./.clang-format:12:1: error: unknown > key 'EndOfLine' > EndOfLine: lf > ^~~~~~~~~ > Error reading /home/amd/development/dpdk-next-net/./.clang-format: > Invalid argument >=20 > c. > /home/amd/development/dpdk-next-net/./.clang-format:15:1: error: unknown > key 'File' > File: > ^~~~ > Error reading /home/amd/development/dpdk-next-net/./.clang-format: > Invalid argument >=20 >=20 >=20 > [2] > `clang-format -i ./lib/ethdev/rte_ethdev.c` (with failing part commented > out) > `git diff` >=20 > A few diff samples to fix at first glance: > ``` > static const struct rte_eth_xstats_name_off eth_dev_txq_stats_strings[] = =3D { > - {"packets", offsetof(struct rte_eth_stats, q_opackets)}, > - {"bytes", offsetof(struct rte_eth_stats, q_obytes)}, > + {"packets", offsetof(struct rte_eth_stats, q_opackets)}, > + {"bytes", offsetof(struct rte_eth_stats, q_obytes)}, > }; > ``` >=20 > ``` > -enum { > - STAT_QMAP_TX =3D 0, > - STAT_QMAP_RX > -}; > +enum { STAT_QMAP_TX =3D 0, STAT_QMAP_RX }; > ``` >=20 > ``` > -int > -rte_eth_iterator_init(struct rte_dev_iterator *iter, const char > *devargs_str) > +int rte_eth_iterator_init(struct rte_dev_iterator *iter, const char > *devargs_str) > ``` >=20 > ``` > RTE_ETH_FOREACH_DEV(p) Add this # Take from #=20 # git grep -h '^#define [^[:space:]]*FOREACH[^[:space:]]*(' lib/ \ # | sed "s,^#define \([^[:space:]]*FOREACH[^[:space:]]*\)(.*$, - '\1'," \ # | LC_ALL=3DC sort -u ForeachMacros:=20 - 'CIRBUF_FOREACH' - 'RTE_BBDEV_FOREACH' - 'RTE_DEV_FOREACH' - 'RTE_DMA_FOREACH_DEV' - 'RTE_EAL_DEVARGS_FOREACH' - 'RTE_ETH_FOREACH_DEV' - 'RTE_ETH_FOREACH_DEV_OF' - 'RTE_ETH_FOREACH_DEV_OWNED_BY' - 'RTE_ETH_FOREACH_DEV_SIBLING' - 'RTE_ETH_FOREACH_MATCHING_DEV' - 'RTE_ETH_FOREACH_VALID_DEV' - 'RTE_GPU_FOREACH' - 'RTE_GPU_FOREACH_CHILD' - 'RTE_GPU_FOREACH_PARENT' - 'RTE_LCORE_FOREACH' - 'RTE_LCORE_FOREACH_WORKER' - 'RTE_TAILQ_FOREACH' - 'RTE_TAILQ_FOREACH_SAFE'