From patchwork Wed Apr 26 16:15:39 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jonathan Wakely X-Patchwork-Id: 87894 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp358608vqo; Wed, 26 Apr 2023 09:16:42 -0700 (PDT) X-Google-Smtp-Source: AKy350awLyu/It8I7tqCQkS3jo7fqoSiveJW9INoHKjQUmtX3WtCKED19gRY/a41eZPXBFG4qUMD X-Received: by 2002:aa7:c3c7:0:b0:506:6c24:c83 with SMTP id l7-20020aa7c3c7000000b005066c240c83mr20472085edr.29.1682525802172; Wed, 26 Apr 2023 09:16:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682525802; cv=none; d=google.com; s=arc-20160816; b=dV9dKvHN69DhEmSTqkWUEeKYuZcz9+lxozFNbSnGWyLbLv+F037z9g8M75JF7iULIP n76WCE69b8ca5GBBaMYxrwmnu+v74YvBwDDxHk/A0ZZ319iq/1e6ySTMxFLmulwdxoei kAa9HmKuh72sgHvuHv5MP+V7JQ+qsC68UiG3VxaPhVNdMIorg8llLBmNdxyp8Jy2sGkj MoOECDm5HKBWFGMK2LG2jALEXGBTrFaM+EMzpy2/FVRh1LvmT8f1nHrLyieAR8d7KwB/ RNj2SlWn9Z+CvvIVEt+LUD2iEukOQqv6TjnJxQymywgKCfKRzfOeK6yXPh5DaZ8aNdai VJxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:to :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=HRjXUni25xdZpW9HabYO7X+iU7Fnk1TJ6nRvdYRZNNg=; b=qb6J/wrS4iaT4m2h5t0Z2E1ieF/YaHGuHZiobL71AosHT2fwhelPCh5OyOZok25BYD 7qRznJ4keeranVnXL/K8F8o0ihq0/Ma4OxUE4HmFSfacioEeMOsJ1Gt6+EnaEgcQMc61 okgvv+SPwRlc+Rxmy4+ULiyOq6MSi/SztXWhR3HT6WTrcB+iO/39rYaElrNZbbZnWLJK UWAnqepo1ppk/9R8nCiNOIY5F7s3R1KYvtzj8pXmOgIKElMuAlNqkU0GaUHa2LRSGnTC C0FtfxMEWJnvmLfH7HxrzBbRvnPuT1YrSDmL4a0USPyY+QXw0v2YqTdRLGX3YD/GDa2Q V4Dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=s5HUrsfp; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id s21-20020aa7d795000000b00504b52a7ee7si12605587edq.37.2023.04.26.09.16.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 26 Apr 2023 09:16:42 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=s5HUrsfp; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CE23F3857711 for ; Wed, 26 Apr 2023 16:16:27 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CE23F3857711 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1682525787; bh=HRjXUni25xdZpW9HabYO7X+iU7Fnk1TJ6nRvdYRZNNg=; h=To:Subject:Date:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:From; b=s5HUrsfp/DvL9jMZr/xLPBeTw8AWZZWWcIr6VRF4CsShOuryImPHsVMNVtAvDYbSF 2cjQPBSj1VAbrjU3cjQbnYeXOrxXcdPqhTilg8kXUNSnFQlFdqFbDJrCqS+Ys2eUkd yI7pl7zHNr4eCoiud5GG5BX1dIyzhf26XUMZVvYw= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id ADBBF385841E for ; Wed, 26 Apr 2023 16:15:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org ADBBF385841E Received: from mimecast-mx02.redhat.com (mx3-rdu2.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-85-bkzMsIBxNy6uTi1H6kF4MQ-1; Wed, 26 Apr 2023 12:15:41 -0400 X-MC-Unique: bkzMsIBxNy6uTi1H6kF4MQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id B80E93C025C9 for ; Wed, 26 Apr 2023 16:15:40 +0000 (UTC) Received: from localhost (unknown [10.42.28.201]) by smtp.corp.redhat.com (Postfix) with ESMTP id 835F22027043 for ; Wed, 26 Apr 2023 16:15:40 +0000 (UTC) To: gcc-patches@gcc.gnu.org Subject: [PATCH] doc: Add explanation of zero-length array example Date: Wed, 26 Apr 2023 17:15:39 +0100 Message-Id: <20230426161539.1571701-1-jwakely@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.4 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-12.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_SHORT, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Jonathan Wakely via Gcc-patches From: Jonathan Wakely Reply-To: Jonathan Wakely Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764256175682059513?= X-GMAIL-MSGID: =?utf-8?q?1764256175682059513?= As suggested here: https://gcc.gnu.org/pipermail/gcc/2023-April/241190.html OK for trunk? -- >8 -- gcc/ChangeLog: * doc/extend.texi (Zero Length): Describe example. --- gcc/doc/extend.texi | 3 +++ 1 file changed, 3 insertions(+) diff --git a/gcc/doc/extend.texi b/gcc/doc/extend.texi index 84b44cb9916..06134a50ad2 100644 --- a/gcc/doc/extend.texi +++ b/gcc/doc/extend.texi @@ -1705,6 +1705,9 @@ struct line *thisline = (struct line *) thisline->length = this_length; @end smallexample +In this example, @code{thisline->contents} is an array of @code{char} that +can hold up to @code{thisline->length} bytes. + Although the size of a zero-length array is zero, an array member of this kind may increase the size of the enclosing type as a result of tail padding. The offset of a zero-length array member from the beginning