Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp2276533imm; Thu, 20 Sep 2018 10:26:02 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZXH2qH2dNsF4QkAVL2IoRuREIJG0Mb7B+sLfAYwxTUbLA/aTy8Yt0wLKZ+yni5Yiyjx+L+ X-Received: by 2002:a63:28c7:: with SMTP id o190-v6mr37803882pgo.84.1537464362448; Thu, 20 Sep 2018 10:26:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537464362; cv=none; d=google.com; s=arc-20160816; b=YAm3FeNEXdtQJsgaav5tJ7WyffzQvGF7OiLMOz0qnB83ZXNY5dwVlt95is7C5QAIoU q+6WxmgMU+hC1A0uY+VlUSbZoZsjQfu8c/qPbWDIZa2v4t8Y7LJOs1lun+HTSUcaBWpS dFT1wB37EcUKJncGmA53dMNMbBUNdxH53aSAKmHXr90RvlR+YLH0LXK/dxG4jU3uMk9B iZmx1b+VyS5l0Ofhr3UssakpKvDLHe0mwPJkcwAyStFmLAMTu+jo0lVbLIXzwkvlx7rg e9A2lMo3q9MQHAzRcY6h18OP7yuO0lL5xjH6sGC7408BjLqZdu2WgSrquabq5QkofGQz b6Jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=3IAlaipCNnrtQXC9KGumpKwQRaKsYxmUF93A0nM9u8k=; b=Po7EOqBD0SWuWv1q+uot8ZQ5wy8ZGmpzwqrwaB4Dt+d6AU1bxIh9MNPToJ0Xl4z1hU zztVrcwu0ZEQ/DftQs73j/AJIX6hhDlom3Qr/XXPmTBdBMZxUUFNrZeXK35W5Ama2lIU Eya4VrWJZnq2zumDQeAsXmZyP3lCWUDzZpvYyAd1/yXtZTO34KNY99DXVKf2kFq/80+B vFKCimKpk7S9+y08YkT/KWWO+y/P7Y72IKlH82G2eKnTz9Z3qapABremtQKbe+gUPqwR v26jjOoJVs85f3ZigGurxWGDKekNW2ToaVddvKmF5xeOGeOxSFffEY8RmDxb2BzIlSZF /uBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VtD32SbD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 200-v6si24732441pfv.137.2018.09.20.10.25.47; Thu, 20 Sep 2018 10:26:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=VtD32SbD; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388043AbeITXIG (ORCPT + 99 others); Thu, 20 Sep 2018 19:08:06 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:40128 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727556AbeITXIF (ORCPT ); Thu, 20 Sep 2018 19:08:05 -0400 Received: by mail-wr1-f67.google.com with SMTP id y8-v6so6562169wrh.7; Thu, 20 Sep 2018 10:23:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=3IAlaipCNnrtQXC9KGumpKwQRaKsYxmUF93A0nM9u8k=; b=VtD32SbDIbB8mKCUPJoXm+oF2hfSMjUQk6HnHcXYt+Wsy39LwvZ5dYPRqB+Vzuqyid mEncoH5wOxwdrRAxKOOl1RFgJ8LaVJViaew5fTMgWprGZYS8Nr2C8zz//2FnBLJumBC2 N/vaQeS31/bntVshVutpj5dWfxEa4JZcH/H3L0HiBfPpfcHhsr3tzyGHciSq4HY2wl32 z0utH32YK8sCtinfEtY5OJkpt3/IlK6KktbP4MLrC63SdaQ1PeTna8w2xDZf9bL7y5Ni OpIomudruyWj/hlNI7DUJ653rG3H7726+VpeggiTxO5Mpms1LslWJ8nZU9b2aLpJAB6i QNhw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=3IAlaipCNnrtQXC9KGumpKwQRaKsYxmUF93A0nM9u8k=; b=TMGzCy1JHcpkdoankZwu14inbuqqYGEprQyo73GCqsnuBkktFWUjrA7clb+g1fu+rW k4M8VeAParz5zgPbecH0WD7Rt3thPIQIgmjNVQD2XKV2ao6z3RrK/6l/YSFK6ddP80jB 0Zhya7qtpJwBo04bDO/GhWBH1N9J23hSxN8TM2DF086C2TMqwG2fM3sFTEWsR6Dgojve twQuC0wEAjgM/R8/sodPX5ahzO3WwULt+SOxFSdPuqMRKI7enIwNNFuFj7d5gaeXMTdc Q2jRusjaxJRJxvpqICwzybnhm05Uv0tOubs8ky7i2ZtYgQPydOarNTojMX6LTjAqe4xD 8LPA== X-Gm-Message-State: APzg51BWX/1XHFN3C1Isz7R3UAs32jp2nEaaoDZIsNkJlBI0FFwYTOV9 KqQ6ib4+FuCPO9gTFVKNTho= X-Received: by 2002:adf:ad34:: with SMTP id p49-v6mr35394591wrc.10.1537464213065; Thu, 20 Sep 2018 10:23:33 -0700 (PDT) Received: from localhost.localdomain (62.83.35.8.dyn.user.ono.com. [62.83.35.8]) by smtp.gmail.com with ESMTPSA id q200-v6sm3466562wmd.2.2018.09.20.10.23.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Sep 2018 10:23:32 -0700 (PDT) From: Miguel Ojeda To: Greg Kroah-Hartman Cc: linux-kernel@vger.kernel.org, Miguel Ojeda , Andreas Dilger , Masahiro Yamada , Michal Marek , Steven Rostedt , Mauro Carvalho Chehab , Olof Johansson , Konstantin Ryabitsev , "David S . Miller" , Andrey Ryabinin , Kees Cook , Thomas Gleixner , Ingo Molnar , Paul Lawrence , Sandipan Das , Andrey Konovalov , David Woodhouse , Will Deacon , Philippe Ombredanne , Paul Burton , David Rientjes , Willy Tarreau , Martin Sebor , Christopher Li , Jonathan Corbet , Theodore Ts'o , Geert Uytterhoeven , Rasmus Villemoes , Joe Perches , Arnd Bergmann , Dominique Martinet , Stefan Agner , Luc Van Oostenryck , Nick Desaulniers , Andrew Morton , Linus Torvalds , linux-doc@vger.kernel.org, linux-ext4@vger.kernel.org, linux-sparse@vger.kernel.org, linux-kbuild@vger.kernel.org Subject: [PATCH v5 04/15] Compiler Attributes: homogenize __must_be_array Date: Thu, 20 Sep 2018 19:22:50 +0200 Message-Id: <20180920172301.21868-5-miguel.ojeda.sandonis@gmail.com> In-Reply-To: <20180920172301.21868-1-miguel.ojeda.sandonis@gmail.com> References: <20180920172301.21868-1-miguel.ojeda.sandonis@gmail.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Different definitions of __must_be_array: * gcc: disabled for __CHECKER__ * clang: same definition as gcc's, but without __CHECKER__ * intel: the comment claims __builtin_types_compatible_p() is unsupported; but icc seems to support it since 13.0.1 (released in 2012). See https://godbolt.org/z/S0l6QQ Therefore, we can remove all of them and have a single definition in compiler.h Reviewed-by: Nick Desaulniers Reviewed-by: Luc Van Oostenryck Signed-off-by: Miguel Ojeda --- include/linux/compiler-clang.h | 1 - include/linux/compiler-gcc.h | 7 ------- include/linux/compiler-intel.h | 3 --- include/linux/compiler.h | 7 +++++++ 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/include/linux/compiler-clang.h b/include/linux/compiler-clang.h index d11cad61ba5c..fa9532f8d885 100644 --- a/include/linux/compiler-clang.h +++ b/include/linux/compiler-clang.h @@ -41,6 +41,5 @@ * compilers, like ICC. */ #define barrier() __asm__ __volatile__("" : : : "memory") -#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) #define __assume_aligned(a, ...) \ __attribute__((__assume_aligned__(a, ## __VA_ARGS__))) diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h index 7a1de7683df5..3b32bbfa5a49 100644 --- a/include/linux/compiler-gcc.h +++ b/include/linux/compiler-gcc.h @@ -68,13 +68,6 @@ */ #define uninitialized_var(x) x = x -#ifdef __CHECKER__ -#define __must_be_array(a) 0 -#else -/* &a[0] degrades to a pointer: a different type from an array */ -#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) -#endif - #ifdef RETPOLINE #define __noretpoline __attribute__((__indirect_branch__("keep"))) #endif diff --git a/include/linux/compiler-intel.h b/include/linux/compiler-intel.h index fef8bb3e53ef..6004b4588bd4 100644 --- a/include/linux/compiler-intel.h +++ b/include/linux/compiler-intel.h @@ -29,9 +29,6 @@ */ #define OPTIMIZER_HIDE_VAR(var) barrier() -/* Intel ECC compiler doesn't support __builtin_types_compatible_p() */ -#define __must_be_array(a) 0 - #endif /* icc has this, but it's called _bswap16 */ diff --git a/include/linux/compiler.h b/include/linux/compiler.h index ec4a28bad2c6..165b1d5683ed 100644 --- a/include/linux/compiler.h +++ b/include/linux/compiler.h @@ -357,4 +357,11 @@ static inline void *offset_to_ptr(const int *off) compiletime_assert(__native_word(t), \ "Need native word sized stores/loads for atomicity.") +#ifdef __CHECKER__ +#define __must_be_array(a) 0 +#else +/* &a[0] degrades to a pointer: a different type from an array */ +#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) +#endif + #endif /* __LINUX_COMPILER_H */ -- 2.17.1