On Fri, Aug 31, 2018 at 10:05 AM Miguel Ojeda
<miguel.ojeda.sando...@gmail.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 <efrie...@codeaurora.org>
> Cc: Christopher Li <spa...@chrisli.org>
> Cc: Kees Cook <keesc...@chromium.org>
> Cc: Ingo Molnar <mi...@kernel.org>
> Cc: Geert Uytterhoeven <ge...@linux-m68k.org>
> Cc: Arnd Bergmann <a...@arndb.de>
> Cc: Greg Kroah-Hartman <gre...@linuxfoundation.org>
> Cc: Masahiro Yamada <yamada.masah...@socionext.com>
> Cc: Joe Perches <j...@perches.com>
> Cc: Dominique Martinet <asmad...@codewreck.org>
> Cc: Nick Desaulniers <ndesaulni...@google.com>
> Cc: Linus Torvalds <torva...@linux-foundation.org>
> Signed-off-by: Miguel Ojeda <miguel.ojeda.sando...@gmail.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 <ndesaulni...@google.com>

-- 
Thanks,
~Nick Desaulniers

Reply via email to