[linux-next] scripts/dtc: Replace zero-length array with DECLARE_FLEX_ARRAY() helper
Message ID | 202211150903277271642@zte.com.cn |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2452860wru; Mon, 14 Nov 2022 17:09:10 -0800 (PST) X-Google-Smtp-Source: AA0mqf5JXbqa6V/fThmUQK1IAVwEG1I/tliXgyB8j687TXKBtIyGH2D7BvJVsOAjCs4FUkk0sVcl X-Received: by 2002:a17:903:11c6:b0:186:8c13:50b3 with SMTP id q6-20020a17090311c600b001868c1350b3mr1621339plh.153.1668474549719; Mon, 14 Nov 2022 17:09:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668474549; cv=none; d=google.com; s=arc-20160816; b=leHjugj4cs88heHF2QegZrfXr4M8nW5Y6BGmco27B2j6lyYsW54UXh+bciUAJoGzeg O7864fzoAhj8DCrFJhwOg6F+o1szfB0IQSV0C11544e898A0neCHKXh0mbdkz0XTLG2F yCnK1HTpS/gGXIDuON+p0OzuZFnf7ilz9gq01vJYi0PWODa31U4lpEaqhqHTD+bLaSZJ XLavgo5jPtG9fd5iP73iDSZysHce/786KZpryKdeBnsQlyv1BtcUs0u8tu0CWR2RoZBg gtP2XXvjK4teXhq25WuvzK6PcYN4KRHh4IJ5gvBjvDI3guVV+ZUf1Hq3ail0XMQyWf2L Nrlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:mime-version:message-id:date; bh=nxr6DLja2nccUfCRcSGWocz4Yn5chLrq2D4hjWjAhDg=; b=zliUV7W2GfbQebbySVtqhKwFXHhwEwSOB8M+zgRrnyZWss1nutkq3F4XQjeJxSilzC 4/XsnjjRzMNTkdtrKCbFOX7cld7CKrF6DGEDVyBPyZhebrj1yDWuYaKnPJOZtfkLmOFL sOw6+ythBdKmLMR54EFC+jBClL/X03+/ivTvz6Cx22ZR3bqMhPOIh5drQOUfENAZOFl+ eczQ+oY4C0ghA8FqKIDsiCXeFr8aB3mSdY9yDWqRoYmyL1PE3mK1fZy5oXFG2si9NPio KgyPPh3O3swRwgIm7DkGtVmXV5HJOZbKH9gx4h2ob/35R3U/BrljdUG09hBtClYTALEI TKsA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f1-20020a63f741000000b00439ae52c996si10637288pgk.71.2022.11.14.17.08.49; Mon, 14 Nov 2022 17:09:09 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=zte.com.cn Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231934AbiKOBDy (ORCPT <rfc822;zwp10758@gmail.com> + 99 others); Mon, 14 Nov 2022 20:03:54 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54848 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231201AbiKOBDv (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 14 Nov 2022 20:03:51 -0500 Received: from mxct.zte.com.cn (mxct.zte.com.cn [58.251.27.85]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 213D06343; Mon, 14 Nov 2022 17:03:50 -0800 (PST) Received: from mxde.zte.com.cn (unknown [10.35.20.165]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mxct.zte.com.cn (FangMail) with ESMTPS id 4NB7Gr2sKhzvMG; Tue, 15 Nov 2022 09:03:48 +0800 (CST) Received: from mxus.zte.com.cn (unknown [10.207.168.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mxde.zte.com.cn (FangMail) with ESMTPS id 4NB7Gm51hFz4xD4B; Tue, 15 Nov 2022 09:03:44 +0800 (CST) Received: from mxhk.zte.com.cn (unknown [192.168.250.137]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mxus.zte.com.cn (FangMail) with ESMTPS id 4NB7Gh5CMjzdmc15; Tue, 15 Nov 2022 09:03:40 +0800 (CST) Received: from mxct.zte.com.cn (unknown [192.168.251.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mxhk.zte.com.cn (FangMail) with ESMTPS id 4NB7Gb5W2Gz8RV7G; Tue, 15 Nov 2022 09:03:35 +0800 (CST) Received: from mse-fl1.zte.com.cn (unknown [10.5.228.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mxct.zte.com.cn (FangMail) with ESMTPS id 4NB7GY1CPBz501Sm; Tue, 15 Nov 2022 09:03:33 +0800 (CST) Received: from xaxapp01.zte.com.cn ([10.88.40.50]) by mse-fl1.zte.com.cn with SMTP id 2AF13RQq082275; Tue, 15 Nov 2022 09:03:27 +0800 (+08) (envelope-from guo.ziliang@zte.com.cn) Received: from mapi (xaxapp03[null]) by mapi (Zmail) with MAPI id mid32; Tue, 15 Nov 2022 09:03:27 +0800 (CST) Date: Tue, 15 Nov 2022 09:03:27 +0800 (CST) X-Zmail-TransId: 2afb6372e55fffffffffdf7ef669 X-Mailer: Zmail v1.0 Message-ID: <202211150903277271642@zte.com.cn> Mime-Version: 1.0 From: <guo.ziliang@zte.com.cn> To: <gustavoars@kernel.org> Cc: <robh+dt@kernel.org>, <frowand.list@gmail.com>, <keescook@chromium.org>, <devicetree@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <guo.ziliang@zte.com.cn> Subject: =?utf-8?q?=5BPATCH_linux-next=5D_scripts/dtc=3A_Replace_zero-length?= =?utf-8?q?_array_with_DECLARE=5FFLEX=5FARRAY=28=29_helper?= Content-Type: text/plain; charset="UTF-8" X-MAIL: mse-fl1.zte.com.cn 2AF13RQq082275 X-Fangmail-Gw-Spam-Type: 0 X-FangMail-Miltered: at cgslv5.04-192.168.251.14.novalocal with ID 6372E573.002 by FangMail milter! X-FangMail-Envelope: 1668474228/4NB7Gr2sKhzvMG/6372E573.002/10.35.20.165/[10.35.20.165]/mxde.zte.com.cn/<guo.ziliang@zte.com.cn> X-Fangmail-Anti-Spam-Filtered: true X-Fangmail-MID-QID: 6372E573.002/4NB7Gr2sKhzvMG X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_PASS,UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749522369175527872?= X-GMAIL-MSGID: =?utf-8?q?1749522369175527872?= |
Series |
[linux-next] scripts/dtc: Replace zero-length array with DECLARE_FLEX_ARRAY() helper
|
|
Commit Message
guo.ziliang@zte.com.cn
Nov. 15, 2022, 1:03 a.m. UTC
From: guo ziliang <guo.ziliang@zte.com.cn> Zero-length arrays are deprecated and we are moving towards adopting C99 flexible-array members, instead. So, replace zero-length arrays declarations in anonymous union with the new DECLARE_FLEX_ARRAY() helper macro. Signed-off-by: guo ziliang <guo.ziliang@zte.com.cn> --- scripts/dtc/libfdt/fdt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 1.8.3.1
Comments
On Tue, Nov 15, 2022 at 09:03:27AM +0800, guo.ziliang@zte.com.cn wrote: > From: guo ziliang <guo.ziliang@zte.com.cn> > > Zero-length arrays are deprecated and we are moving towards adopting > C99 flexible-array members, instead. So, replace zero-length arrays > declarations in anonymous union with the new DECLARE_FLEX_ARRAY() > helper macro. > > Signed-off-by: guo ziliang <guo.ziliang@zte.com.cn> > --- > scripts/dtc/libfdt/fdt.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/scripts/dtc/libfdt/fdt.h b/scripts/dtc/libfdt/fdt.h > index f2e6880..f66fff1 100644 > --- a/scripts/dtc/libfdt/fdt.h > +++ b/scripts/dtc/libfdt/fdt.h > @@ -35,14 +35,14 @@ struct fdt_reserve_entry { > > struct fdt_node_header { > fdt32_t tag; > - char name[0]; > + DECLARE_FLEX_ARRAY(char, name); > }; > > struct fdt_property { > fdt32_t tag; > fdt32_t len; > fdt32_t nameoff; > - char data[0]; > + DECLARE_FLEX_ARRAY(char, data); > }; This was addressed in commit: 5224f7909617 ("treewide: Replace zero-length arrays with flexible-array members") My question here is why these changes were reverted by commit: ea3723a541c1 ("scripts/dtc: Update to upstream version v1.6.1-63-g55778a03df61") ?? :O Thanks -- Gustavo
On Mon, Nov 14, 2022 at 7:03 PM <guo.ziliang@zte.com.cn> wrote: > > From: guo ziliang <guo.ziliang@zte.com.cn> > > Zero-length arrays are deprecated and we are moving towards adopting > C99 flexible-array members, instead. So, replace zero-length arrays > declarations in anonymous union with the new DECLARE_FLEX_ARRAY() > helper macro. > > Signed-off-by: guo ziliang <guo.ziliang@zte.com.cn> > --- > scripts/dtc/libfdt/fdt.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) Changes to dtc/libfdt must go upstream first and then we sync upstream back to the kernel.
diff --git a/scripts/dtc/libfdt/fdt.h b/scripts/dtc/libfdt/fdt.h index f2e6880..f66fff1 100644 --- a/scripts/dtc/libfdt/fdt.h +++ b/scripts/dtc/libfdt/fdt.h @@ -35,14 +35,14 @@ struct fdt_reserve_entry { struct fdt_node_header { fdt32_t tag; - char name[0]; + DECLARE_FLEX_ARRAY(char, name); }; struct fdt_property { fdt32_t tag; fdt32_t len; fdt32_t nameoff; - char data[0]; + DECLARE_FLEX_ARRAY(char, data); }; #endif /* !__ASSEMBLY */