Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp4700418pxb; Tue, 28 Sep 2021 01:58:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9SH1YsaOuQLhe1icMzO7jOnFuSSTzVDgYSm+EIYdgmWO8wiWAcig6riJtr1nS7aHx021c X-Received: by 2002:a63:7a4c:: with SMTP id j12mr3525201pgn.381.1632819494825; Tue, 28 Sep 2021 01:58:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632819494; cv=none; d=google.com; s=arc-20160816; b=wjM4QWy5Gooexmtan708YBHaSfSbFj18iSr6v8AoJuk2ShpXJHg7WH5zQwZqQON6vK LcMo5ujnTqM+CFqv0ZN213q6WIPsYr+xyH1QBsziV8u8VXj9zPvw1WEEl+TZazq/Mtz+ 2AXz4L32tClgKa6FtmSTuizCKk2k3MhOqaN26g/1rE88l23iFznnZaGta4rjCX1ZC/vo bGalY0v9IvT+Lg745haq5vyoLn8T8ZHDysYnvzk7zlUkl/oHjFdyeSsI4lk5niLXHAt4 Y6TPDM+003GCr1j+9qbEQVrwtvqBtN9OtEAfGMT6LoeXRMA+2MeVOa2DM32EUvUBOv/x MCiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=LeGt/Tn93JtQbtKXl6ce4bi4Y4el0XHub80GWsOlZos=; b=bXP2jddrNnVHvIxxeYnEy+h+MdpTmwrpAWaOITgCsoy9YIMFSd8q7RkJlQbOZta6WS tQUu8BHq8lX+fLpkdTiu2uMmXp7Y136BkY7yW7mWG9Lfd9QOip/VmJnpaYVQbc//+Mmd 02wd7oH702g0UHhCcruEUs/56mwtT4D+nwrl4R15o9stJfJtdllmNtgTWObpc19lLOKV SVXooFXGj7pLZsI7xPjh45/nj5gFcodA9pm4O8S8xoJx8UTEg6vR/69acRfVsFJi0wM3 E59nEJbS+mu9nQv+o88ISEthBHG2uuLutgsut+rT9hrFOAyfeF9TdAka37u74O6S/bDZ uQgg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="j5CcT/PA"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l72si22210523pge.227.2021.09.28.01.58.02; Tue, 28 Sep 2021 01:58:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="j5CcT/PA"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239639AbhI1I5i (ORCPT + 99 others); Tue, 28 Sep 2021 04:57:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:40562 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239254AbhI1I5h (ORCPT ); Tue, 28 Sep 2021 04:57:37 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2BFA9610E6; Tue, 28 Sep 2021 08:55:57 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1632819358; bh=2PEfYQceru6YB1PlEdl/SbUJ3dkL4YrWAtGhL4nsi+A=; h=From:To:Cc:Subject:Date:From; b=j5CcT/PA4IouFvm5GLaWbysL9NosPn/FtakgLBMvkKgM77vCJAiXq8zEgM1Ebe/Eb QEGxmn/HSNNIvJL74bMbYI8iwVn9NXPHzFZj8sgwZYgCjD29Nhw+6eol1vZslQXoCG vACkQrS4BBLDjvaDPJsTRXidpksZp7of+tRAV0bL7mDli+EuMRxqQNXoOr3RAj/UTi lo1fq+KjHH2vxEr0My7Bx3qjlUZYR9KdUNYTs2SOH4tulYJWJsQ252UaXceH6V+X5d wWGzX9NcpS4BGCTUaf4H1WwPRuM+Rqhs0pcLapXHQIYKfaCUcH53RaxRlIvEjhidUr a8kQFQWdl5rQA== From: Arnd Bergmann To: Kent Overstreet Cc: Arnd Bergmann , Jens Axboe , Coly Li , linux-kernel@vger.kernel.org Subject: [PATCH] [v2] bcache: hide variable-sized types from uapi header check Date: Tue, 28 Sep 2021 10:55:50 +0200 Message-Id: <20210928085554.2299495-1-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Arnd Bergmann The headers_check helper complains about a GNU extension in one of the exported headers: linux/bcache.h:354:2: warning: field '' with variable sized type 'union jset::(anonymous at ./usr/include/linux/bcache.h:354:2)' not at the end of a struct or class is a GNU extension [-Wgnu-variable-sized-type-not-at-end] BKEY_PADDED(uuid_bucket); ^ linux/bcache.h:134:2: note: expanded from macro 'BKEY_PADDED' union { struct bkey key; __u64 key ## _pad[BKEY_PAD]; } ^ Address this by enclosing the GNU extensions in an #ifdef: Since the header check is done with --std=c90, this shuts up the warning and makes it possible to include the header file C90 user space applications, but allows applications built with --std=gnu89 or higher to use those parts. Another alternative would be to exclude this header from the check, but the GNU extension check seems more sensible. Fixes: 81ab4190ac17 ("bcache: Pull on disk data structures out into a separate header") Signed-off-by: Arnd Bergmann --- v2: use __STRICT_ANSI__ check instead of __KERNEL__. I think this version is better than the first, let me know if that works for you. --- include/uapi/linux/bcache.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/include/uapi/linux/bcache.h b/include/uapi/linux/bcache.h index cf7399f03b71..b7901e986193 100644 --- a/include/uapi/linux/bcache.h +++ b/include/uapi/linux/bcache.h @@ -23,9 +23,13 @@ static inline void SET_##name(type *k, __u64 v) \ struct bkey { __u64 high; __u64 low; +#ifndef __STRICT_ANSI__ + /* gcc extension not meant for user space */ __u64 ptr[]; +#endif }; +#ifndef __STRICT_ANSI__ #define KEY_FIELD(name, field, offset, size) \ BITMASK(name, struct bkey, field, offset, size) @@ -127,6 +131,8 @@ static inline struct bkey *bkey_idx(const struct bkey *k, unsigned int nr_keys) return (struct bkey *) (d + nr_keys); } +#endif + /* Enough for a key with 6 pointers */ #define BKEY_PAD 8 -- 2.29.2