Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1033119imm; Sat, 8 Sep 2018 14:28:16 -0700 (PDT) X-Google-Smtp-Source: ANB0VdYNL8VcEKpYJDhSdImJFd+joajUkTin+QyDmEOo7AiwOHRvsc6s8O87k+DDe6g+aE05e/+O X-Received: by 2002:a62:d44a:: with SMTP id u10-v6mr15634331pfl.144.1536442096009; Sat, 08 Sep 2018 14:28:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536442095; cv=none; d=google.com; s=arc-20160816; b=zCBYPASsf3pub3HxJZKT6UTUjZmamthy1cwBZa10NFdoI5mTfdgSNhn/K0TbDwiARL aZAmhyCjXjnRwLEEDZiAmQWn/zQMa5PWHec6ILbJ/9A/GG/ulyDkNIhXL8dSjajXPEZM 1kFehdnwm0OrWEKcjQdL2ge5srBsvrxWx9k99I28X1jheO17WACJBwhmsDiU2kmp7mo5 GHR46tJORXKVtDytRismzEAu/e2sE1Xc6J1eirV41pqqREpg90023ZNi9bfKg47nAomE zVSDtvUI9bSqf549mkWiNmd3E9VjpbDiY01FFdtLrmswJP95qaabco8Aj37msA7S91Sk 6yQg== 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=01rM1QtUoUf8J7p45IvdhY9Atu3kso7QHsx3BsqEdqk=; b=DlcbetKFssBsJT2FwW92TGoCPh82pAU4dqIw68hY6Iq4jb1WjoPd0JmZdOFXxVwMUT 7DnyHSI5yLHxilCGNG8yT8KkhQC9jjgVB77YojV6rUkr75YHz0knIcMNKxh7sSKQLxal yaV4zGZ1ckK9EdgCAnVheGhS8UOReHCMu47kOE5OVxmsGVApXLr5x3zdHFzVDjVQZWNX FUCNl4K5yHfQYB8jx/weKBJlvlixg+5RwMeqFwGYc9HWUtSdNNxpjgA81gNwxpEuezla 4A9P1bi7h2hRa8bK2TeKSEj14AY/Rc3PnhShV+ogc3IXs4tJ1U/YwWu+fwM0ZOhadXv+ EiKA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=k0HTF6R5; 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 u2-v6si11796735pge.585.2018.09.08.14.28.00; Sat, 08 Sep 2018 14:28:15 -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=k0HTF6R5; 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 S1727885AbeIICMZ (ORCPT + 99 others); Sat, 8 Sep 2018 22:12:25 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:39238 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727639AbeIICMY (ORCPT ); Sat, 8 Sep 2018 22:12:24 -0400 Received: by mail-wr1-f68.google.com with SMTP id s14-v6so9150989wrw.6; Sat, 08 Sep 2018 14:25:16 -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=01rM1QtUoUf8J7p45IvdhY9Atu3kso7QHsx3BsqEdqk=; b=k0HTF6R5jpzWOQaz8bWvePFRbhtJnFqqQK9dpLFbYA6xIWgjZCWNOAfDhsaXSnjmZY bI3se4vxjfbLcpym/jkxMRi8RxZFjvs9/WyAzNXElGGj7BYIak/n/BTikqe+6kXVsDJK wi4W7lSzKd86jiB72wgB+iDMBgZUPha8pF0x+/08LHShmwLJeZqN6BG3qL/sbpreNrvs m102yp6Pyg+bdyscKAm7PV7VYW3p83e1Zc6+4KcTvjxW1gdaGXvsx8NxcXpKnRakPKTQ WDlZduzTKZ5ZbJVnhaODqgulDKf5erKUO7uCGr+w6pc/OAFW2mnl2K+avz69FJr3hPpk CISQ== 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=01rM1QtUoUf8J7p45IvdhY9Atu3kso7QHsx3BsqEdqk=; b=Qv/uvxjWjBZEgyPVZi16eDI8kFLK6zUxm9JWeYa0q8DyhtesqpKRyAF4JgJlWat8hV Qu6zzaIYEO0VQC9ZNIDJV1NG8gGYzbkB5FVzCY6PASgqTr/WqW2g0Vvz92GMXVxYaGE5 83UPCtfgXIu+tptY39oDwLk6DoHBoWqxZIJG+DIic5sQ4BN3sZLOeJZXZ9EFD3ks+O3i itKwCosNrFib9L1HF8U0mpjj1sIgVfI1qf0Mu6IMoSRLljpBjJr3l8hrIwKhIU3eH7ew BU8eswaFX+6eHG8chukywkdc1MjqKIuQsdGyowqVl+xZE+orKhtoBkQFtfWw6C+0v2fn 5oRg== X-Gm-Message-State: APzg51CaEEo88BSIZI0YnsGriRIIjOecbSekzv1ec1a04GTS6wShutEs hrd1iJisTCJl+eFQfwY2eXY= X-Received: by 2002:adf:f7c4:: with SMTP id a4-v6mr10531253wrq.86.1536441915355; Sat, 08 Sep 2018 14:25:15 -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 u40-v6sm17340786wrc.43.2018.09.08.14.25.14 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 08 Sep 2018 14:25:14 -0700 (PDT) From: Miguel Ojeda To: Linus Torvalds Cc: linux-kernel@vger.kernel.org, Miguel Ojeda , Rasmus Villemoes , Luc Van Oostenryck , Eli Friedman , Christopher Li , Kees Cook , Ingo Molnar , Geert Uytterhoeven , Arnd Bergmann , Greg Kroah-Hartman , Masahiro Yamada , Joe Perches , Dominique Martinet , linux-sparse@vger.kernel.org Subject: [PATCH v4 03/13] Compiler Attributes: remove unneeded tests Date: Sat, 8 Sep 2018 23:24:49 +0200 Message-Id: <20180908212459.19736-4-miguel.ojeda.sandonis@gmail.com> In-Reply-To: <20180908212459.19736-1-miguel.ojeda.sandonis@gmail.com> References: <20180908212459.19736-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 Attributes const and always_inline have tests around them which are unneeded, since they are supported by gcc >= 4.6, clang >= 3 and icc >= 13. https://godbolt.org/z/DFPq37 In the case of gnu_inline, we do not need to test for __GNUC_STDC_INLINE__ because, regardless of the current inlining behavior, we can simply always force the old GCC inlining behavior by using the attribute in all cases. Cc: Rasmus Villemoes Cc: Luc Van Oostenryck Cc: Eli Friedman Cc: Christopher Li Cc: Kees Cook Cc: Ingo Molnar Cc: Geert Uytterhoeven Cc: Arnd Bergmann Cc: Greg Kroah-Hartman Cc: Masahiro Yamada Cc: Joe Perches Cc: Dominique Martinet Cc: Linus Torvalds Cc: linux-sparse@vger.kernel.org Reviewed-by: Nick Desaulniers Signed-off-by: Miguel Ojeda --- include/linux/compiler_types.h | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h index 2bc0f94df38e..83475515bc39 100644 --- a/include/linux/compiler_types.h +++ b/include/linux/compiler_types.h @@ -158,10 +158,6 @@ struct ftrace_likely_data { (sizeof(t) == sizeof(char) || sizeof(t) == sizeof(short) || \ sizeof(t) == sizeof(int) || sizeof(t) == sizeof(long)) -#ifndef __attribute_const__ -#define __attribute_const__ __attribute__((__const__)) -#endif - #ifndef __noclone #define __noclone #endif @@ -196,6 +192,7 @@ struct ftrace_likely_data { * [...] */ #define __pure __attribute__((__pure__)) +#define __attribute_const__ __attribute__((__const__)) #define __aligned(x) __attribute__((__aligned__(x))) #define __aligned_largest __attribute__((__aligned__)) #define __printf(a, b) __attribute__((__format__(printf, a, b))) @@ -211,6 +208,8 @@ struct ftrace_likely_data { #define __alias(symbol) __attribute__((__alias__(#symbol))) #define __cold __attribute__((__cold__)) #define __section(S) __attribute__((__section__(#S))) +#define __always_inline inline __attribute__((__always_inline__)) +#define __gnu_inline __attribute__((__gnu_inline__)) #ifdef CONFIG_ENABLE_MUST_CHECK @@ -227,18 +226,6 @@ struct ftrace_likely_data { #define __compiler_offsetof(a, b) __builtin_offsetof(a, b) -/* - * Feature detection for gnu_inline (gnu89 extern inline semantics). Either - * __GNUC_STDC_INLINE__ is defined (not using gnu89 extern inline semantics, - * and we opt in to the gnu89 semantics), or __GNUC_STDC_INLINE__ is not - * defined so the gnu89 semantics are the default. - */ -#ifdef __GNUC_STDC_INLINE__ -# define __gnu_inline __attribute__((__gnu_inline__)) -#else -# define __gnu_inline -#endif - /* * Force always-inline if the user requests it so via the .config. * GCC does not warn about unused static inline functions for @@ -263,10 +250,6 @@ struct ftrace_likely_data { #define __inline inline #define noinline __attribute__((__noinline__)) -#ifndef __always_inline -#define __always_inline inline __attribute__((__always_inline__)) -#endif - /* * Rather then using noinline to prevent stack consumption, use * noinline_for_stack instead. For documentation reasons. -- 2.17.1