From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from cross.elm.relay.mailchannels.net (cross.elm.relay.mailchannels.net [23.83.212.46]) by sourceware.org (Postfix) with ESMTPS id 640E93858C83 for ; Wed, 1 Feb 2023 16:55:26 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 640E93858C83 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=gotplt.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 10B805017B7; Wed, 1 Feb 2023 16:55:25 +0000 (UTC) Received: from pdx1-sub0-mail-a305.dreamhost.com (unknown [127.0.0.6]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 07136500C9F; Wed, 1 Feb 2023 16:55:23 +0000 (UTC) ARC-Seal: i=1; s=arc-2022; d=mailchannels.net; t=1675270523; a=rsa-sha256; cv=none; b=cT7W6E5D2lQjlCixfY1u3hAiM0PZCp6cYCADkzgJ/vIrPx6MGneLU+pW9X36FoOVVwTEHA AXT4CApxizRyLQTEgOFclzud8o+mzHg708D1RRsPhifQuO6dLLmPy7qcNxDjPlFFqIzMR/ 0b8FB1VckdC/W28+hhTzo8g57qU90zmc9HHJgLjX51woIWtK/t3qgFXlFDdMvOCMPrnh+G SRsP32KMcBmNSPNtsw697P88YNUhE5xt5iNoaw9SNnFhoN7i2u4Uiyxin/gDG5b/iHheGP zDZ/yeeVCrZByLIWg79A4e77v/ymTC0j0KoZTB8AcI976gpjnxzp5wAr4VngCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=mailchannels.net; s=arc-2022; t=1675270523; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=U6mtKiSlRqGRFn/ieNKfIs5141af0MetsPIuj0LFIjU=; b=SjMVh6SNq5b6jIU9L23OA+jSbPIdnwg0PTnA5F6CTLHfZc8wXiTUSFYabCDf/TvomqnY+A AWXziOkSjicsl26autPqyC/hilR4jftTNDKPjtgmEcDPSwkuk5yRSkggqOCe+oKvzBbdRP w47XaG5BiFlY80fUvjkkDtTtm1kyDdL7xhBdKRawBQPioSL53LhZldOT8dbEeyaHMNIJuj 6RsuZVJVNVVJfjU3MtPqsJhBkAsRkn+RxMRxYAhdvA0MyfGAYH0SGOOX90t7x619XENgoL RVbJ4cS40T6cSGIiOmH1pXgChHU7WhTF8zQdVY68j3igUUbJEyzNVRMYRa14Uw== ARC-Authentication-Results: i=1; rspamd-5fb8f68d88-jhxsn; auth=pass smtp.auth=dreamhost smtp.mailfrom=siddhesh@gotplt.org X-Sender-Id: dreamhost|x-authsender|siddhesh@gotplt.org X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|siddhesh@gotplt.org X-MailChannels-Auth-Id: dreamhost X-Stretch-Spicy: 2c2bd999504c6b4d_1675270523305_3092374580 X-MC-Loop-Signature: 1675270523304:1651294555 X-MC-Ingress-Time: 1675270523304 Received: from pdx1-sub0-mail-a305.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384) by 100.97.74.12 (trex/6.7.1); Wed, 01 Feb 2023 16:55:23 +0000 Received: from [192.168.0.182] (bras-vprn-toroon4834w-lp130-07-174-93-43-36.dsl.bell.ca [174.93.43.36]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) (Authenticated sender: siddhesh@gotplt.org) by pdx1-sub0-mail-a305.dreamhost.com (Postfix) with ESMTPSA id 4P6Shp1RWSzT4; Wed, 1 Feb 2023 08:55:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gotplt.org; s=dreamhost; t=1675270522; bh=U6mtKiSlRqGRFn/ieNKfIs5141af0MetsPIuj0LFIjU=; h=Date:Subject:To:Cc:From:Content-Type:Content-Transfer-Encoding; b=VCoafE+56EEO7pnSRItsgZFZlYfwGVHZKU8gNQ75AeqlKQ5KF8Dv/RfE2oJ/+yUw4 QWiNbJmvlwZppJafGk9er30sk4MxM2BmZwGmKLzU+yHdzQSgxxGUnv8h/WQ0aIxdG5 i9Jc+V0WzmW2K9CYK30rR2F+Vk87Awn953k3Ll7xqPwcBUssLOvJusmxJ2Jzv1PvkC IOmlgph2ys+0EihDWgPI++zOpp+hODZ1QU+CNw9Wm9BIGDa3ax/O9bIOOq9GLi786f LvYn8BzbqX3kfG3vu3qk5sdYgvHdn4Pxyjd5Vzi+W3QtjBYeG41yEzWwpsCnZ1nRlp TaxSoMQAi/E2g== Message-ID: Date: Wed, 1 Feb 2023 11:55:20 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0 Subject: Re: [PATCH 2/2] Documentation Update. Content-Language: en-US To: Qing Zhao , rguenther@suse.de Cc: gcc-patches@gcc.gnu.org, keescook@chromium.org References: <20230131141140.3610133-1-qing.zhao@oracle.com> <20230131141140.3610133-3-qing.zhao@oracle.com> From: Siddhesh Poyarekar In-Reply-To: <20230131141140.3610133-3-qing.zhao@oracle.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-3037.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 2023-01-31 09:11, Qing Zhao wrote: > Update documentation to clarify a GCC extension on structure with > flexible array member being nested in another structure. > > gcc/ChangeLog: > > * doc/extend.texi: Document GCC extension on a structure containing > a flexible array member to be a member of another structure. Should this resolve pr#77650 since the proposed action there appears to be to document these semantics? Thanks, Sid > --- > gcc/doc/extend.texi | 35 ++++++++++++++++++++++++++++++++++- > 1 file changed, 34 insertions(+), 1 deletion(-) > > diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi > index 4a89a3eae7c..54e4baf49a9 100644 > --- a/gcc/doc/extend.texi > +++ b/gcc/doc/extend.texi > @@ -1748,7 +1748,40 @@ Flexible array members may only appear as the last member of a > A structure containing a flexible array member, or a union containing > such a structure (possibly recursively), may not be a member of a > structure or an element of an array. (However, these uses are > -permitted by GCC as extensions.) > +permitted by GCC as extensions, see details below.) > +@end itemize > + > +GCC extension accepts a structure containing a flexible array member, or > +a union containing such a structure (possibly recursively) to be a member > +of a structure. > + > +There are two situations: > + > +@itemize @bullet > +@item > +The structure with a flexible array member is the last field of another > +structure, for example: > + > +@smallexample > +struct flex @{ int length; char data[]; @}; > + > +struct out_flex @{ int m; struct flex flex_data; @}; > +@end smallexample > + > +In the above, @code{flex_data.data[]} is considered as a flexible array too. > + > +@item > +The structure with a flexible array member is the middle field of another > +structure, for example: > + > +@smallexample > +struct flex @{ int length; char data[]; @}; > + > +struct mid_flex @{ int m; struct flex flex_data; int n; @}; > +@end smallexample > + > +In the above, @code{flex_data.data[]} is allowed to be extended flexibly to > +the padding. E.g, up to 4 elements. > @end itemize > > Non-empty initialization of zero-length