[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOd=HDSCfPNcsa+_yDEeOGy4ZAzgOH5ry4iFNsibjLZQ7uQ@mail.gmail.com>
Date: Fri, 31 Aug 2018 14:10:39 -0700
From: Nick Desaulniers <ndesaulniers@...gle.com>
To: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>, efriedma@...eaurora.org,
sparse@...isli.org, Kees Cook <keescook@...omium.org>,
Ingo Molnar <mingo@...nel.org>,
Geert Uytterhoeven <geert@...ux-m68k.org>,
Arnd Bergmann <arnd@...db.de>,
Greg KH <gregkh@...uxfoundation.org>,
Masahiro Yamada <yamada.masahiro@...ionext.com>,
joe@...ches.com, asmadeus@...ewreck.org
Subject: Re: [PATCH 3/7] Compiler Attributes: remove unneeded tests
On Fri, Aug 31, 2018 at 10:05 AM Miguel Ojeda
<miguel.ojeda.sandonis@...il.com> wrote:
>
> 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. See https://godbolt.org/z/no0OZH
>
> 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: Eli Friedman <efriedma@...eaurora.org>
> Cc: Christopher Li <sparse@...isli.org>
> Cc: Kees Cook <keescook@...omium.org>
> Cc: Ingo Molnar <mingo@...nel.org>
> Cc: Geert Uytterhoeven <geert@...ux-m68k.org>
> Cc: Arnd Bergmann <arnd@...db.de>
> Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Cc: Masahiro Yamada <yamada.masahiro@...ionext.com>
> Cc: Joe Perches <joe@...ches.com>
> Cc: Dominique Martinet <asmadeus@...ewreck.org>
> Cc: Nick Desaulniers <ndesaulniers@...gle.com>
> Cc: Linus Torvalds <torvalds@...ux-foundation.org>
> Signed-off-by: Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
> ---
> include/linux/compiler_types.h | 19 ++-----------------
> 1 file changed, 2 insertions(+), 17 deletions(-)
>
> diff --git a/include/linux/compiler_types.h b/include/linux/compiler_types.h
> index 7cd958360ead..3662b19599fc 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
> -
If there's a v2, you could order this before the patch that removed
the underscores so that patch is smaller. Doesn't really matter
though.
> #ifndef __noclone
> #define __noclone
> #endif
> @@ -196,6 +192,7 @@ struct ftrace_likely_data {
> * [...]
> */
> #define __pure __attribute__((pure))
> +#define __const __attribute__((const))
> #define __aligned(x) __attribute__((aligned(x)))
> #define __aligned_largest __attribute__((aligned))
> #define __printf(a, b) __attribute__((format(printf, a, b)))
> @@ -227,17 +224,7 @@ 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
> +#define __gnu_inline __attribute__((gnu_inline))
Can this be moved into the block above with all the rest of required attributes?
>
> /*
> * Force always-inline if the user requests it so via the .config.
> @@ -263,9 +250,7 @@ struct ftrace_likely_data {
> #define __inline inline
> #define noinline __attribute__((noinline))
>
> -#ifndef __always_inline
> #define __always_inline inline __attribute__((always_inline))
> -#endif
Ditto.
>
> /*
> * Rather then using noinline to prevent stack consumption, use
> --
> 2.17.1
>
With the requested changes,
Reviewed-by: Nick Desaulniers <ndesaulniers@...gle.com>
--
Thanks,
~Nick Desaulniers
Powered by blists - more mailing lists