On Fri, Jan 25, 2019 at 11:43 AM Laura Abbott <labb...@redhat.com> wrote:
>
> Commit bee20031772a ("disable -Wattribute-alias warning for
> SYSCALL_DEFINEx()") disabled -Wattribute-alias with gcc8.
> gcc9 changed the format of -Wattribute-alias to take a parameter.
> This doesn't quite match with the existing disabling mechanism
> so update for gcc9 to match with the default (-Wattribute-alias=1).
>
> Signed-off-by: Laura Abbott <labb...@redhat.com>
> ---
> This is RFC because it feels ugly. I went ahead and did the obvious fixup
> but it's worth discussing if we're going to end up with an explosion or
> if there's a better way to handle this in one macro.

Bernd Edlinger has sent a patch to gcc for this:
https://gcc.gnu.org/ml/gcc-patches/2019-01/msg01120.html

and Miguel Ojeda said he wanted to send a patch for it to the
kernel as well, not sure if he wanted to take a different
approach there, so adding both to Cc here.

        Arnd




> ---
>  include/linux/compat.h       | 2 ++
>  include/linux/compiler-gcc.h | 7 ++++++-
>  include/linux/syscalls.h     | 2 ++
>  3 files changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/include/linux/compat.h b/include/linux/compat.h
> index 056be0d03722..d5d7700f26a6 100644
> --- a/include/linux/compat.h
> +++ b/include/linux/compat.h
> @@ -75,6 +75,8 @@
>         __diag_push();                                                        
>   \
>         __diag_ignore(GCC, 8, "-Wattribute-alias",                            
>   \
>                       "Type aliasing is used to sanitize syscall arguments");\
> +       __diag_ignore(GCC, 9, "-Wattribute-alias=1",                          
>   \
> +                     "Type aliasing is used to sanitize syscall arguments");\
>         asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__));     
>   \
>         asmlinkage long compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))      
>   \
>                 __attribute__((alias(__stringify(__se_compat_sys##name))));   
>   \
> diff --git a/include/linux/compiler-gcc.h b/include/linux/compiler-gcc.h
> index e8579412ad21..75079668344c 100644
> --- a/include/linux/compiler-gcc.h
> +++ b/include/linux/compiler-gcc.h
> @@ -165,8 +165,13 @@
>  #define __diag_str(s)          __diag_str1(s)
>  #define __diag(s)              _Pragma(__diag_str(GCC diagnostic s))
>
> -#if GCC_VERSION >= 80000
> +#if GCC_VERSION >= 90000
> +#define __diag_GCC_8(s)
> +#define __diag_GCC_9(s)                __diag(s)
> +#elif GCC_VERSION >= 80000
>  #define __diag_GCC_8(s)                __diag(s)
> +#define __diag_GCC_9(s)
>  #else
>  #define __diag_GCC_8(s)
> +#define __diag_GCC_9(s)
>  #endif
> diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
> index 257cccba3062..a08059e1ccf4 100644
> --- a/include/linux/syscalls.h
> +++ b/include/linux/syscalls.h
> @@ -236,6 +236,8 @@ static inline int is_syscall_trace_event(struct 
> trace_event_call *tp_event)
>         __diag_push();                                                  \
>         __diag_ignore(GCC, 8, "-Wattribute-alias",                      \
>                       "Type aliasing is used to sanitize syscall arguments");\
> +       __diag_ignore(GCC, 9, "-Wattribute-alias=1",                    \
> +                     "Type aliasing is used to sanitize syscall arguments");\
>         asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))       \
>                 __attribute__((alias(__stringify(__se_sys##name))));    \
>         ALLOW_ERROR_INJECTION(sys##name, ERRNO);                        \
> --
> 2.20.1
>

Reply via email to