From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, URIBL_SBL,URIBL_SBL_A,USER_AGENT_SANE_2 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 35DABC388F3 for ; Sat, 28 Sep 2019 07:17:22 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 0DC8420862 for ; Sat, 28 Sep 2019 07:17:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726026AbfI1HQr (ORCPT ); Sat, 28 Sep 2019 03:16:47 -0400 Received: from ms.lwn.net ([45.79.88.28]:35680 "EHLO ms.lwn.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725856AbfI1HQq (ORCPT ); Sat, 28 Sep 2019 03:16:46 -0400 Received: from localhost.localdomain (localhost [127.0.0.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ms.lwn.net (Postfix) with ESMTPSA id 30D802B4; Sat, 28 Sep 2019 07:16:43 +0000 (UTC) Date: Sat, 28 Sep 2019 01:16:39 -0600 From: Jonathan Corbet To: Stephen Kitt Cc: linux-doc@vger.kernel.org, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, linux-remoteproc@vger.kernel.org, linux-can@vger.kernel.org, linux-afs@lists.infradead.org, kvm@vger.kernel.org, "Gustavo A . R . Silva" Subject: Re: [PATCH] docs: use flexible array members, not zero-length Message-ID: <20190928011639.7c983e77@lwn.net> In-Reply-To: <20190927142927.27968-1-steve@sk2.org> References: <20190927142927.27968-1-steve@sk2.org> Organization: LWN.net X-Mailer: Claws Mail 3.17.3 (GTK+ 2.24.32; x86_64-redhat-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Fri, 27 Sep 2019 16:29:27 +0200 Stephen Kitt wrote: > Update the docs throughout to remove zero-length arrays, replacing > them with C99 flexible array members. GCC will then ensure that the > arrays are always the last element in the struct. I appreciate the thought but... > diff --git a/Documentation/bpf/btf.rst b/Documentation/bpf/btf.rst > index 4d565d202ce3..24ce50fc1fc1 100644 > --- a/Documentation/bpf/btf.rst > +++ b/Documentation/bpf/btf.rst > @@ -670,7 +670,7 @@ func_info for each specific ELF section.:: > __u32 sec_name_off; /* offset to section name */ > __u32 num_info; > /* Followed by num_info * record_size number of bytes */ > - __u8 data[0]; > + __u8 data[]; > }; I only checked this one, but found what I had expected: the actual definition of this structure (found in tools/lib/bpf/libbpf_internal.h) says "data[0]". We can't really make the documentation read the way we *wish* the source would be, we need to document reality. I'm pretty sure that most of the other examples will be the same. If you really want to fix these, the right solution is to fix the offending structures — one patch per structure — in the source, then update the documentation to match the new reality. Thanks, jon