From patchwork Thu Sep 20 17:22:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miguel Ojeda X-Patchwork-Id: 10608255 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 366796CB for ; Thu, 20 Sep 2018 17:23:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1C3C32E283 for ; Thu, 20 Sep 2018 17:23:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0ECCF2E29A; Thu, 20 Sep 2018 17:23:36 +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 8CB5D2E283 for ; Thu, 20 Sep 2018 17:23:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387977AbeITXIE (ORCPT ); Thu, 20 Sep 2018 19:08:04 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:50388 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387922AbeITXID (ORCPT ); Thu, 20 Sep 2018 19:08:03 -0400 Received: by mail-wm1-f66.google.com with SMTP id s12-v6so345380wmc.0; Thu, 20 Sep 2018 10:23:31 -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=DMcPIrwqXms9WD0kkoWDdZrBP6b9NZOj826HYTgaFlU=; b=g8rtPT1E8Eoyx+j9tu4pGEhD3gHhesom2knFsEfU/KANrXLls5YdqUVG6XB5cRcGdP y4Z+dsZzwSYWvAxIhxfxUjrg5MZyQEsW3fMg/th7ekvi2lHkic/f1vwDQjVQTfZQ8qZO /FkBUE1E5Wfs/I9o5JdRaOy+MCWeUYeJot5eCp+pesXtb7p+3iZXLaG5EuBYczdQshcn 718iF+l3s+iGV4BW6+0pjblcGEzkIl4WyTo6ak6KJRuWVW6ZNlB3jSnap9Gm2XO1t8DM XzsHWao7RIOMW0RM2uFy/UwS+Wz2s3A5r3v8fInigpY0PHSRV0XBLtejAwZQ7d19YKNW BG2w== 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=DMcPIrwqXms9WD0kkoWDdZrBP6b9NZOj826HYTgaFlU=; b=frdtEVUrkmhnpNERzvycKfc2E9h10n2B/j9cyaEWxEOZtRXhRYU6eeHoxjpkZIE7Ck Nzq9LWJdxPaA5veYovB14yIMevovY6IJFmKWwXn3cVEaoydLgxRMtTFRlHda0xMhqYG5 nBNPhMuqTMjIHKzM/xNVvu7g5/TtXtGAltWSotgQhm5lccpfWkJ8BP+JjbydT2nM8las aTpfQd0Oc+eNv3QOCIYPvqJqV01pc9/NjWzdj4NJnih/GYVhaPH/v7Cdzv/PMZck+DFP kTj7Xzqi3rLM7RIUDzYSxdqXF9yXvaxH2qz/tBRy8PVcMe2t7Nk2RRwzT50f5m2VpO1u CoHA== X-Gm-Message-State: APzg51Bh6C1Q5KwmPMWdAwX3PnR4vb12PS8IpTAGA6pd2gHUqnmdSJfx zLSYnGyo7AEKQ1hU0xzWDU4= X-Google-Smtp-Source: ANB0VdaMv6GmzxVbSxHXGF7UC11DeWjw6Iv4hpoYvbbIH/e4da+E5L4k3GKFZ5U3ek6jz8O6egpeyw== X-Received: by 2002:a1c:3503:: with SMTP id c3-v6mr3876931wma.46.1537464210885; Thu, 20 Sep 2018 10:23:30 -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.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 20 Sep 2018 10:23:30 -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 03/15] Compiler Attributes: remove unneeded tests Date: Thu, 20 Sep 2018 19:22:49 +0200 Message-Id: <20180920172301.21868-4-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-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@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. Reviewed-by: Nick Desaulniers Reviewed-by: Luc Van Oostenryck 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 8fbdd47dd3d0..5ff9cda893f4 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 @@ -235,18 +234,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 @@ -271,10 +258,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.