[0/7] replace zero length arrays
Message ID | 20230113215205.125767-1-stephen@networkplumber.org (mailing list archive) |
---|---|
Headers |
Return-Path: <dev-bounces@dpdk.org> X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 33337423CA; Fri, 13 Jan 2023 22:52:09 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1ECF142D86; Fri, 13 Jan 2023 22:52:09 +0100 (CET) Received: from mail-pf1-f170.google.com (mail-pf1-f170.google.com [209.85.210.170]) by mails.dpdk.org (Postfix) with ESMTP id 3E50040E0F for <dev@dpdk.org>; Fri, 13 Jan 2023 22:52:08 +0100 (CET) Received: by mail-pf1-f170.google.com with SMTP id h7so12936209pfq.4 for <dev@dpdk.org>; Fri, 13 Jan 2023 13:52:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=yw4BhYlUYo3pYavPXT2OWhSGNC/eOfRh2mVwy3KpcKI=; b=MtWXwO58btvRrkR1x+XTMz/9MypCfdTt+K5oFgVyfEwIT0o76sV8dERZ8Fbu1SP8B5 TUjdtH+pin/NRr6IfYal9/TINjAlaH/WWWgXFHLw3ya9TqBsl8nqEJUf62/2PJBGo2Db +wQBqpi2BvOoDHYyDBg2DwzWV5ircZ3Sm1CZa+WJXYCwdnBuNkV7ocSvZqjtFIuN2MDb 36s2xg2GRs4zahiMfy6lXfqGRf3aZ6vSje5MRPEgSmFp6zPgajjkcKMHN0E0Vdu2ZDAC bI/qjyKhJmGGb5Yq79boiwNtStjTwgd2Vj65Qf4tzEY5J/isMg/Z7Ym/juVaNBSM2ffq TkCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=yw4BhYlUYo3pYavPXT2OWhSGNC/eOfRh2mVwy3KpcKI=; b=BNl22uC2kUv+dnh6TeDfW65bvtAVd2wSx9+8/Nk6YtOfsBeTOFB8BTdjp4fy9qFUi/ S8LwRv4lvUD3vEZ5iCui8YPBFwQIGjo/dx/Wl85NnDnKe6jgAd3u3M5kYo3DlSyqG2JO n4bCJca2vQg+sYRpcnY7VlL8+uxU07bq79fEADZx8VXhpuwstNzDtuCC8CWAa5yvasSE Gie6ibWa8TOBMuBIKVNBLSv7OpZI3wNqI2Ps/Ok0Tknn6qBxS7r3svQKJ3wapjDbtOO+ Z6GgMeC/pWJ+Plpsxo2tlPC+vi/YDBchBy3cPzENuw54oNOT9WJCKyP6px2cI5ogkVv0 GH5Q== X-Gm-Message-State: AFqh2kotQE8Sx1neVoUU1XI2lrCEYi8XZoMMPZ8a3MKgsIg+1J8OylNG onCnPqtkSGRl3Mb6h9+b4llhWEde2x8sv7MXlBc= X-Google-Smtp-Source: AMrXdXsrXbllmBF2QLY61EQXMy9y0dTAbFIadigZ0Kb21cnxihLjRjHuu3a0JMnC0z97qx5Dlod+Hw== X-Received: by 2002:a05:6a00:88a:b0:581:19ed:78b9 with SMTP id q10-20020a056a00088a00b0058119ed78b9mr83026539pfj.2.1673646726904; Fri, 13 Jan 2023 13:52:06 -0800 (PST) Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218]) by smtp.gmail.com with ESMTPSA id m190-20020a6258c7000000b005821c109cebsm9543995pfb.199.2023.01.13.13.52.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Jan 2023 13:52:06 -0800 (PST) From: Stephen Hemminger <stephen@networkplumber.org> To: dev@dpdk.org Cc: Stephen Hemminger <stephen@networkplumber.org> Subject: [PATCH 0/7] replace zero length arrays Date: Fri, 13 Jan 2023 13:51:58 -0800 Message-Id: <20230113215205.125767-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.39.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions <dev.dpdk.org> List-Unsubscribe: <https://mails.dpdk.org/options/dev>, <mailto:dev-request@dpdk.org?subject=unsubscribe> List-Archive: <http://mails.dpdk.org/archives/dev/> List-Post: <mailto:dev@dpdk.org> List-Help: <mailto:dev-request@dpdk.org?subject=help> List-Subscribe: <https://mails.dpdk.org/listinfo/dev>, <mailto:dev-request@dpdk.org?subject=subscribe> Errors-To: dev-bounces@dpdk.org |
Message
Stephen Hemminger
Jan. 13, 2023, 9:51 p.m. UTC
Zero length arrays are a GNU extension that has been superseded by flex arrays. https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html These are places found by cocci/zero_length_array.cocci Stephen Hemminger (7): member: replace zero length array with flex array cryptodev: replace zero length array with flex array security: replace zero length array with flex array mlx5: replace zero length array with flex array nfp: replace zero length array with flex array enic: replace zero length array with flex array dpaax: replace zero length array with flex array drivers/common/dpaax/caamflib/desc/ipsec.h | 2 +- drivers/net/enic/base/vnic_devcmd.h | 2 +- drivers/net/mlx5/mlx5.h | 4 ++-- drivers/net/mlx5/mlx5_flow.h | 2 +- drivers/net/mlx5/mlx5_tx.h | 2 +- drivers/net/nfp/flower/nfp_flower_cmsg.h | 2 +- lib/cryptodev/cryptodev_pmd.h | 2 +- lib/member/rte_member_heap.h | 2 +- lib/security/rte_security_driver.h | 2 +- 9 files changed, 10 insertions(+), 10 deletions(-)
Comments
> From: Stephen Hemminger [mailto:stephen@networkplumber.org] > Sent: Friday, 17 November 2023 05.03 > > Zero length arrays are a GNU extension that has been > superseded by flex arrays. > > https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html > > These are places found by cocci/zero_length_array.cocci Series-acked-by: Morten Brørup <mb@smartsharesystems.com> Suggest checkpatches to disallow this, if it doesn't already.
On Fri, 17 Nov 2023 09:31:11 +0100 Morten Brørup <mb@smartsharesystems.com> wrote: > Series-acked-by: Morten Brørup <mb@smartsharesystems.com> > > Suggest checkpatches to disallow this, if it doesn't already. Unfortunately, matching this with awk is too hard. Coccinelle can do it but don't want to introduce dependency on that. Maybe a compiler flag would be possible, but could not find one.
On Fri, Nov 17, 2023 at 08:18:23AM -0800, Stephen Hemminger wrote: > On Fri, 17 Nov 2023 09:31:11 +0100 > Morten Brørup <mb@smartsharesystems.com> wrote: > > > Series-acked-by: Morten Brørup <mb@smartsharesystems.com> > > > > Suggest checkpatches to disallow this, if it doesn't already. > > Unfortunately, matching this with awk is too hard. Coccinelle can do it > but don't want to introduce dependency on that. > > Maybe a compiler flag would be possible, but could not find one. -pedantic will warn, but to use it without clobbering the build with warnings we would probably need to qualify all use of non-standard extensions with the __extension__ keyword. ``` struct foo { int a; int b; char buffer[0]; }; ``` zhora ~> gcc -Wall -pedantic oink.c oink.c:7:14: warning: ISO C forbids zero-size array ‘buffer’ [-Wpedantic] 7 | char buffer[0];
> From: Stephen Hemminger [mailto:stephen@networkplumber.org] > Sent: Monday, 20 November 2023 18.07 > > Zero length arrays are a GNU extension that has been > superseded by flex arrays. > > https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html > > These are places found by cocci/zero_length_array.cocci > > v4 - fix issues reported by clang where zero length > array was embedded in security structures in cn10k > and txq being embedded in mlx5 was missing extension Thanks for cleaning this up. Series-acked-by: Morten Brørup <mb@smartsharesystems.com>
Series-acked-by: Chengwen Feng <fengchengwen@huawei.com> On 2023/11/21 15:26, Morten Brørup wrote: >> From: Stephen Hemminger [mailto:stephen@networkplumber.org] >> Sent: Monday, 20 November 2023 18.07 >> >> Zero length arrays are a GNU extension that has been >> superseded by flex arrays. >> >> https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html >> >> These are places found by cocci/zero_length_array.cocci >> >> v4 - fix issues reported by clang where zero length >> array was embedded in security structures in cn10k >> and txq being embedded in mlx5 was missing extension > > Thanks for cleaning this up. > > Series-acked-by: Morten Brørup <mb@smartsharesystems.com> >
29/11/2023 03:39, Stephen Hemminger: > Zero length arrays are a GNU extension that has been > superseded by flex arrays. > > https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html > > These are places found by cocci/zero_length_array.cocci > > v5 - revised version of dpaxx ip_hdr fix > rebase to 23.11 > > Stephen Hemminger (10): > member: replace zero length array with flex array > cryptodev: replace zero length array with flex array > security: replace zero length array with flex array > pipeline: replace zero length array with flex array > net/nfp: replace zero length array with flex array > net/enic: replace zero length array with flex array > net/mlx5: replace zero length array with flex array > pdcp: replace zero length array with flex array > net/cpfl: replace zero length array with flex array > common/dpaxx: replace zero length array There is no more left with devtools/cocci.sh devtools/cocci/zero_length_array.cocci Applied, thanks.