From patchwork Mon Sep 3 20:33:07 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miguel Ojeda X-Patchwork-Id: 10586383 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 17EC4112B for ; Mon, 3 Sep 2018 20:34:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0755E29323 for ; Mon, 3 Sep 2018 20:34:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id EF91629329; Mon, 3 Sep 2018 20:34:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6560629323 for ; Mon, 3 Sep 2018 20:34:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728880AbeIDAzo (ORCPT ); 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-Google-Smtp-Source: ANB0VdajEQG88h/5EjDl4FcNGP04S1HHL2onUqoMdqD+iGOA3RZ5GBELkQxzB8t38HN9GQ9y/VH4Ow== 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-sparse-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sparse@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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.