Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp684095pxf; Wed, 24 Mar 2021 13:18:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzi+EKGXxM0EknJbL+BMG/OL35jDeu9tBCewdopqY1ePD7rAXaBLjrko6Vv6Nex2kPH50Vp X-Received: by 2002:aa7:dc56:: with SMTP id g22mr5424700edu.219.1616617118235; Wed, 24 Mar 2021 13:18:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616617118; cv=none; d=google.com; s=arc-20160816; b=sL47C/X202PErlfRgJgUHCT1YnSQtzvTq7VXs5xGWyyImQIriAy99jKFSAZ27KP5C/ 2/q2h+L1ZLrY/404OhsfUiWIYEFze57+DjKPEbS3dm68gQcxjwnbq0bareUokN6/n5WM 9sezOjoNqYHdjT/lQgvMD+9lwZ4t/KLwk5PoAsYG+2kdJ5EDeukkSp/CP9G6iH38V4zt rbGIbMtk/0BrF2nGMDNioMCrag7F1vH7NzEZpv6EWOILzfydrWna0BCLsJCOhf1d4VVU OE5StAe0A4+7+YDZ4L7hizB7CkpamyXvgRIybdaOjXDWGx+DPS09VPEJFhUhUUIBqY4d bd5w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:user-agent:references:message-id :in-reply-to:subject:cc:to:from:date:ironport-hdrordr; bh=oGm5AoihWeWpOi3BVpDqgzj7ldYKvjSzSlYhylwou/U=; b=bDtRguT93S7p/sDksHL7HT5RVrpOV+fqNgJOqhdYRd01KoYW/2SDoMgTxPVwxfvBb9 /NbyD363caMOf7GmQpYUGDvEsZXDFc5AawkjJQdNSVWlBIIg+qjtY23eBflUeEz8f/pW oUte2ULGWT3GW2zjWSlhMnQ3a3T0/jhd2RBD7jPM42NhmMxUsVNaAOabwAmgrp414Xr7 +ZxoSrswjbdya3YY6v4vl6op8cEQBipxAGxcRtTByg0p6XpmjBleSey1vHy/Ojwq+eOH 9AouGEtYTU0KEmmcjUJQjg8U0Tqf3N9gZ+0SatQ9uGh6jb7SlQPyRPamCHN1e02k90wT 448A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l33si2883044ede.161.2021.03.24.13.18.14; Wed, 24 Mar 2021 13:18:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238163AbhCXUQo (ORCPT + 99 others); Wed, 24 Mar 2021 16:16:44 -0400 Received: from mail3-relais-sop.national.inria.fr ([192.134.164.104]:6518 "EHLO mail3-relais-sop.national.inria.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238153AbhCXUQc (ORCPT ); Wed, 24 Mar 2021 16:16:32 -0400 IronPort-HdrOrdr: =?us-ascii?q?A9a23=3Agtl5mq0h1werp35a+9f/ogqjBFMkLtp033Aq?= =?us-ascii?q?2lEZdDV+dMuEm8ey2MkKzBOcskd0ZFgMkc2NUZPqfVry7phwiLN6AZ6DW03ctH?= =?us-ascii?q?KsPMVe6+LZogHIPw3b2qpj2bx7c654YeeAaGRSqcrh+gG3H5IB7bC8kJyAvuvV?= =?us-ascii?q?w3dzQQwCUcgJ0y5DBgmWCUFwTgVdbKBJd6a03NZNpDarZB0sAPiTO39tZYT+ju?= =?us-ascii?q?HQmImjSRALAANP0njtsRqYrI+/KRSe0xsEOgkj/Z4p+wH+/DDE2g=3D=3D?= X-IronPort-AV: E=Sophos;i="5.81,275,1610406000"; d="scan'208";a="376775116" Received: from 173.121.68.85.rev.sfr.net (HELO hadrien) ([85.68.121.173]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 24 Mar 2021 21:16:30 +0100 Date: Wed, 24 Mar 2021 21:16:30 +0100 (CET) From: Julia Lawall X-X-Sender: jll@hadrien To: Denis Efremov cc: cocci@systeme.lip6.fr, linux-kernel@vger.kernel.org Subject: Re: [PATCH] coccinelle: misc: restrict patch mode in flexible_array.cocci In-Reply-To: <20210308191215.1362498-1-efremov@linux.com> Message-ID: References: <20210308191215.1362498-1-efremov@linux.com> User-Agent: Alpine 2.22 (DEB 394 2020-01-19) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 8 Mar 2021, Denis Efremov wrote: > Skip patches generation for structs/unions with a single field. > Changing a zero-length array to a flexible array member in a struct > with no named members breaks the compilation. However, reporting > such cases is still valuable, e.g. commit 637464c59e0b > ("ACPI: NFIT: Fix flexible_array.cocci warnings"). > > Signed-off-by: Denis Efremov Applied. I changed the log message to remove "/unions", since the change doesn't mention unions. julia > --- > scripts/coccinelle/misc/flexible_array.cocci | 23 ++++++++++++++++++-- > 1 file changed, 21 insertions(+), 2 deletions(-) > > diff --git a/scripts/coccinelle/misc/flexible_array.cocci b/scripts/coccinelle/misc/flexible_array.cocci > index 947fbaff82a9..f427fd68ed2d 100644 > --- a/scripts/coccinelle/misc/flexible_array.cocci > +++ b/scripts/coccinelle/misc/flexible_array.cocci > @@ -51,21 +51,40 @@ position p : script:python() { relevant(p) }; > }; > ) > > +@only_field depends on patch@ > +identifier name, array; > +type T; > +position q; > +@@ > + > +( > + struct name {@q > + T array[0]; > + }; > +| > + struct {@q > + T array[0]; > + }; > +) > + > @depends on patch@ > identifier name, array; > type T; > position p : script:python() { relevant(p) }; > +// position @q with rule "only_field" simplifies > +// handling of bitfields, arrays, etc. > +position q != only_field.q; > @@ > > ( > - struct name { > + struct name {@q > ... > T array@p[ > - 0 > ]; > }; > | > - struct { > + struct {@q > ... > T array@p[ > - 0 > -- > 2.26.2 > >