Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp1938657imm; Mon, 3 Sep 2018 13:36:43 -0700 (PDT) X-Google-Smtp-Source: ANB0Vda+aWr5iaw6rB+hHdwOWAUcZuCFMyENWYdbaZDQ7HRraFhyaHN8UlCSdRzEvHv+WctnZF3D X-Received: by 2002:a63:41c4:: with SMTP id o187-v6mr20562910pga.297.1536007003301; Mon, 03 Sep 2018 13:36:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1536007003; cv=none; d=google.com; s=arc-20160816; b=SoxQxG52S1tWG5hKTkFoC5fy9AmdjihC6sZpgbQC87uDuT4rCbrfvJ1hHXamVCoRME BV1YRgtmCoaIHFQyEE9EoK+/GiMq50oLUOXb0DisljsivheTDja8u5/88LXOI6P5lFS8 HQTRwh3YudP/0W8D4XdIM/Kwjo9Wxe5dvIu6ZLAzWohmMja82A81izBZEQxRtv/KuLoU 1kvjxxwptAKt+9uZ30cNtV+RSbfhyvlKSoO7ds2hCd96pY27j9T59LV/AJ/n7lVzMM2N X/QfdxyG0G4c941A9KZlwpeesXrh7ZHVsXLG34Nil6EXCwWX9pSmaE32NW4QANl1Pc99 oF8g== 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:arc-authentication-results; bh=DF6EgP2im+TL2Bj+0aBYVQPMWJB603xa+lUoFLMY8Fw=; b=eC1c8ciMYVS95kGcuWooaFSP/NXuhkpujlFfPSCV4MlcQLXny9LR2JPj277TlGj17S TDDoIidUed+qEBrYaeRN2Z3c432aOwGnFEuCiAQadOQ4TnWffN7E0uIzuU616i1XhFqJ n0C/BCXbWrCKMckNnJWm/jiY5+KuMjgju15RIbUlKQoMLCx3UB9udSTHxnufX3HVE+2h 6XW7mUG5US5PFyrRpw1yQsoshwhvu9dd0c/wMqa+HvKNijih25+Uyic44uKT0ychLT7u TEFjyy7HvHTzh3SJXCcDEx4ZedigUVGpziQYR5Ki/oPeS3RR+TSrguKvxRYFatCuPiMG +eNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=N3ZeJBUU; 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 n10-v6si18135856pgf.415.2018.09.03.13.36.28; Mon, 03 Sep 2018 13:36:43 -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=N3ZeJBUU; 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 S1728920AbeIDAzo (ORCPT + 99 others); Mon, 3 Sep 2018 20:55:44 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:45527 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727552AbeIDAzn (ORCPT ); Mon, 3 Sep 2018 20:55:43 -0400 Received: by mail-wr1-f65.google.com with SMTP id 20-v6so1712696wrb.12; Mon, 03 Sep 2018 13:33:51 -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=DF6EgP2im+TL2Bj+0aBYVQPMWJB603xa+lUoFLMY8Fw=; b=N3ZeJBUUTuoGb3LLWWOs3VIwCM49YoDhwtHAGNM4msavD6YT9RCx33qsSpzbACBN6t KAzcIdLB61VIXGAtRyIgkTvFbO6ZSbHXG+JflQzL4jq+QnF2DrmGA9FhQ2W2aUTu7LEj vBLbmKCfRYXqGJljckX4235jYDM2YiWNtSRuG1MbXH0xD6O/bWxJKaoZFpgAcG4BiHv8 GzZctzko2W14rXEkCQnEuV+apaxQRl+q70aMLCeoMH/IcLVNfJQmz3KAn/qS60yZA7Xz h0Tbz8L0kgUFxU8PKLF9SJ+n5G7+uNrVHk0P/LowPq9zuPk0UJdlDB90vla6i2qKI0Nq mvRw== 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=DF6EgP2im+TL2Bj+0aBYVQPMWJB603xa+lUoFLMY8Fw=; b=aZAAn1/dOhuuGNrfwTUWDFLjjvEx0SWGro7yKYyqgd1JHY7j67/Sw/6A4Led9TSeXH GuF6Pu00hxRZ/Wh7neVJmzeUTMBWVtDTAJx0QEikkHG/DSL035ppZ91gjEGnbvP7mfwc mxfHH6Z/DQ+Fm/C7SiU2iC6/eCnyD8jxUmaPtzRYC2aw4ifshSMoWWFiV4187X9y+TSZ rK1lPpETYPTkm+zqSEbDEV1x/l4lLIFQ7AuHt9qBJQa738keQx7MX28f9Fi3qQUfJn82 Hl8gOYdWmMi32WdAVx+vzahNF9KX2T36m5sjfalFwWCe35yiX7QfL3doNOXl4J9xUZ+g 8hYA== X-Gm-Message-State: APzg51Dd+0+sGOGaUK/NKBwNPMseAYhXTgXc3sQb3lcjth4MZgodxy29 +Uqxj8afqpMuTQpoinl5+y4= X-Received: by 2002:a5d:66d2:: with SMTP id k18-v6mr20496480wrw.154.1536006831167; Mon, 03 Sep 2018 13:33:51 -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 132-v6sm12354870wmd.13.2018.09.03.13.33.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 03 Sep 2018 13:33:50 -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 03/12] Compiler Attributes: remove unneeded tests Date: Mon, 3 Sep 2018 22:33:07 +0200 Message-Id: <20180903203316.16183-4-miguel.ojeda.sandonis@gmail.com> In-Reply-To: <20180903203316.16183-1-miguel.ojeda.sandonis@gmail.com> References: <20180903203316.16183-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 | 24 +++--------------------- 1 file changed, 3 insertions(+), 21 deletions(-) diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h index 2bc0f94df38e..759b3fea9216 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,7 +208,8 @@ struct ftrace_likely_data { #define __alias(symbol) __attribute__((__alias__(#symbol))) #define __cold __attribute__((__cold__)) #define __section(S) __attribute__((__section__(#S))) - +#define __gnu_inline __attribute__((__gnu_inline__)) +#define __always_inline inline __attribute__((__always_inline__)) #ifdef CONFIG_ENABLE_MUST_CHECK #define __must_check __attribute__((__warn_unused_result__)) @@ -227,18 +225,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 +249,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