From patchwork Mon Sep 25 18:24:10 2023
Content-Type: text/plain; charset="utf-8"
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-Patchwork-Submitter: Tobias Burnus
X-Patchwork-Id: 144527
Return-Path:
Delivered-To: ouuuleilei@gmail.com
Received: by 2002:a59:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp1401972vqu;
Mon, 25 Sep 2023 11:25:31 -0700 (PDT)
X-Google-Smtp-Source:
AGHT+IGkcnhG1hKDg58CeE6cy5b+HZjX/yieOyi3xm1mwa0uKHZtT0MWuT4TiyjenY68JyT91w98
X-Received: by 2002:a05:6000:6:b0:31f:fa1a:83fb with SMTP id
h6-20020a056000000600b0031ffa1a83fbmr7207563wrx.7.1695666331588;
Mon, 25 Sep 2023 11:25:31 -0700 (PDT)
ARC-Seal: i=1; a=rsa-sha256; t=1695666331; cv=none;
d=google.com; s=arc-20160816;
b=GvvZibJY6oPAiHXRSUGp/wa2qZRWQhtW7fyQQbKPoZGx3V4wXgbl54DkllL52KF6pQ
jOuJTIEsN3IVUBxMv4v0fk0x/bs+ozn5kWlsDKCIK6oHJG3uVifkgepbxuv/tFeEwqt5
6NKspL6seIiL/KTTApWoKO2rUDvBlst4Ehh9E4xG5U9dbLyXQQn1Qg8NO8cbpnLOnDlD
k/CAPxlNK46WsCKwGZH1s2JgJJ9mZ6wyUftEgYjufZCz4z4Bj2iNxZGlQp4CM6JMdssW
ZDWN5snv9SE9dzhHppr3RazhbmXDV5+bcRtavguwPWBET139EUw7tB/Yw8BOKCvkrL38
/9mg==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com;
s=arc-20160816;
h=errors-to:list-subscribe:list-help:list-post:list-archive
:list-unsubscribe:list-id:precedence:content-transfer-encoding
:in-reply-to:from:references:cc:to:content-language:subject
:user-agent:mime-version:date:message-id:ironport-sdr:dmarc-filter
:delivered-to;
bh=fNaWUgGJ6n0nXw7AA1GmBb63LsPURQI08dHTbZT7ewI=;
fh=ahS1sjdG9xmt0pmqgOtsc/hUNSHM0Rwz7ertGIc8Kos=;
b=GGxxPORr8Ka7yCLekkA+TMUGyX6DUyNflSkfqloxZQKEJIEXF5o0QBsr6yz3vHAJSN
+3oIRSUOEeg7UXiDWOQcatvoS+nDhN2JCHxCkQX9Z42LDVS5ju0JZNrsL6pD+pXpZ0cX
QB9NBYEW3UwZaVlEnkU2pfC0lKj6tOPz688kEwutCA/pLQJi4DA1iDIrckLqjdLMN9L/
pNpxBJ90cu389zDynN6SXi6CoHFdA9J0vOc5UNYCutLTkTZdgTAYaYGqQVTnHVI2WD8S
9a2AAD4fkzdMU8QTaMLMN1KAZ42h+IPIsnTaFmT1LdX0zER+RX4Jzhy9viFfs96vY9Df
UCnw==
ARC-Authentication-Results: i=1; mx.google.com;
spf=pass (google.com: domain of
gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates
2620:52:3:1:0:246e:9693:128c as permitted sender)
smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"
Received: from server2.sourceware.org (server2.sourceware.org.
[2620:52:3:1:0:246e:9693:128c])
by mx.google.com with ESMTPS id
g21-20020a1709067c5500b00992ae2a902dsi9610776ejp.786.2023.09.25.11.25.31
for
(version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
Mon, 25 Sep 2023 11:25:31 -0700 (PDT)
Received-SPF: pass (google.com: domain of
gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates
2620:52:3:1:0:246e:9693:128c as permitted sender)
client-ip=2620:52:3:1:0:246e:9693:128c;
Authentication-Results: mx.google.com;
spf=pass (google.com: domain of
gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates
2620:52:3:1:0:246e:9693:128c as permitted sender)
smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"
Received: from server2.sourceware.org (localhost [IPv6:::1])
by sourceware.org (Postfix) with ESMTP id AB05238618E3
for ; Mon, 25 Sep 2023 18:24:42 +0000 (GMT)
X-Original-To: gcc-patches@gcc.gnu.org
Delivered-To: gcc-patches@gcc.gnu.org
Received: from esa3.mentor.iphmx.com (esa3.mentor.iphmx.com [68.232.137.180])
by sourceware.org (Postfix) with ESMTPS id ECF3D3858D3C
for ; Mon, 25 Sep 2023 18:24:17 +0000 (GMT)
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ECF3D3858D3C
Authentication-Results: sourceware.org; dmarc=none (p=none dis=none)
header.from=codesourcery.com
Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mentor.com
X-CSE-ConnectionGUID: EM8Y6MH4SWOhUPPdTDO7sg==
X-CSE-MsgGUID: WhsOqwJJT7qR3YY0d/4b1A==
X-IronPort-AV: E=Sophos;i="6.03,175,1694764800"; d="scan'208";a="17800082"
Received: from orw-gwy-01-in.mentorg.com ([192.94.38.165])
by esa3.mentor.iphmx.com with ESMTP; 25 Sep 2023 10:24:15 -0800
IronPort-SDR:
mD4h8Yh7pLuklulgbRHoiU8xA+WhuYBsnDMrMOcj7vU6HtY8SyrPijy937jffOnat46zUfwV8d
pclU7sH0ZBN2A+0ETRy6vu8jQx/dbcDOAkyjCDQJgkSoZcJIYbbJbjcCAy/r+UgyV9/fA9lHHp
++TayavFCs9a0YC3cAXev2VSx9rJyHCWqrZHhwbEI4LKIpFecnB3RAvglxxelfqMm+USKwIYTF
6Zbfd+Fh9QMOwenpUMnD18HKCeIjq8K19yg6dIyS+s9HAU6AtRadgeVNzP4MA5+RjuJa47KWMR
Eik=
Message-ID:
Date: Mon, 25 Sep 2023 20:24:10 +0200
MIME-Version: 1.0
User-Agent: Mozilla Thunderbird
Subject: Improve -Wflex-array-member-not-at-end changes.html wording |Plus:
and warning bug? (was: [V2][PATCH] gcc-14/changes.html: Deprecate a GCC C
extension on flexible array members.)
Content-Language: en-US
To: Qing Zhao , ,
CC:
References: <20230807142216.1857701-1-qing.zhao@oracle.com>
From: Tobias Burnus
In-Reply-To: <20230807142216.1857701-1-qing.zhao@oracle.com>
X-Originating-IP: [137.202.0.90]
X-ClientProxiedBy: svr-ies-mbx-15.mgc.mentorg.com (139.181.222.15) To
svr-ies-mbx-12.mgc.mentorg.com (139.181.222.12)
X-Spam-Status: No, score=-5.3 required=5.0 tests=BAYES_00,
HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, KAM_SHORT, SPF_HELO_PASS,
SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: gcc-patches@gcc.gnu.org
X-Mailman-Version: 2.1.30
Precedence: list
List-Id: Gcc-patches mailing list
List-Unsubscribe: ,
List-Archive:
List-Post:
List-Help:
List-Subscribe: ,
Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org
X-getmail-retrieved-from-mailbox: INBOX
X-GMAIL-THRID: 1778035019205362928
X-GMAIL-MSGID: 1778035019205362928
Hi all,
I stumbled over this as I found the wording in the release notes rather unclear.is.
First, the following gives only a -pedantic warning and not a -Wflex-array-member-not-at-end:
struct t { int b; int x[]; };
struct q { int b; struct t a[2]; int c; };
warning: invalid use of structure with flexible array member [-Wpedantic]
If I remove the "[2]", it shows additionally:
warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
It seems as if it should print latter warning also inside the struct.
Qing? Joseph? Thoughts?
* * *
Secondly, if this is deprecated, shouldn't then the warning enabled by, e.g., -Wall or made
otherwise more prominent? (-std=?) - Currently, one either has to find the new flag or use
-pedantic.
Or is this not really regarded as deprecated? But then (IMHO) we should not really claim so and just
add the warning without deprecation.
BTW; clang-15 prints the -Wgnu-variable-sized-type-not-at-end warning by default.
Joseph, all: Thoughts?
* * *
Cross ref: The patch adding the new warning is r14-2197-g070a6bf0bdc6761
https://gcc.gnu.org/pipermail/gcc-cvs/2023-June/385730.html (cf. previously in this thread)
* * *
Regarding the changes.html wording:
On 07.08.23 16:22, Qing Zhao via Gcc-patches wrote:
> Comparing to the 1st version, the only change is to address Richard's
> comment on refering a warning option for diagnosing deprecated behavior.
...
> +++ b/htdocs/gcc-14/changes.html
> @@ -30,7 +30,18 @@ a work-in-progress.
>
> Caveats
>
> - - ...
> + - C:
> + Support for the GCC extension, a structure containing a C99 flexible array
> + member, or a union containing such a structure, is not the last field of
> + another structure, is deprecated. Refer to
> +
> + Zero Length Arrays.
...
I find the first sentence difficult to read. What do you think of the following?
(It is hard to come up with some good wording.)
Tobias
PS: C17 has:
"A structure or union shall not contain a member with incomplete or function type (hence, a structure
shall not contain an instance of itself, but may contain a pointer to an instance of itself), except that
the last member of a structure with more than one named member may have incomplete array type;
such a structure (and any union containing, possibly recursively, a member that is such a structure)
shall not be a member of a structure or an element of an array."
-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955
--- a/htdocs/gcc-14/changes.html
+++ b/htdocs/gcc-14/changes.html
@@ -31,9 +31,10 @@ a work-in-progress.
Caveats
- C:
- Support for the GCC extension, a structure containing a C99 flexible array
- member, or a union containing such a structure, is not the last field of
- another structure, is deprecated. Refer to
+ Support for the GCC extension that a structure containing a C99 flexible
+ array (and any union containing a member of such structure) can be a
+ member of a structure has been deprecated for the case that it is not
+ the last member. Refer to
Zero Length Arrays.
Any code relying on this extension should be modifed to ensure that