Quoting Marc Dietrich (2017-11-29 05:47:55)
> gcc seems to always accept unsupported negative compiler warning options:
> 
> echo "int i;" | gcc -c -xc -Wno-bob - # no error
> echo "int i;" | gcc -c -xc -Walice -  # unsupported compiler option
> 
> Inverting the options fixes the tests.
> 
> Signed-off-by: Marc Dietrich <marvi...@gmx.de>
> ---
>  configure.ac | 4 ++--
>  meson.build  | 4 ++--
>  2 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/configure.ac b/configure.ac
> index 1344c12884..c025d9c766 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -394,8 +394,8 @@ esac
>  AC_SUBST([VISIBILITY_CFLAGS])
>  AC_SUBST([VISIBILITY_CXXFLAGS])
>  
> -AX_CHECK_COMPILE_FLAG([-Wno-override-init],                    
> [WNO_OVERRIDE_INIT="$WNO_OVERRIDE_INIT -Wno-override-init"])         # gcc
> -AX_CHECK_COMPILE_FLAG([-Wno-initializer-overrides],            
> [WNO_OVERRIDE_INIT="$WNO_OVERRIDE_INIT -Wno-initializer-overrides"]) # clang
> +AX_CHECK_COMPILE_FLAG([-Woverride-init],                    
> [WNO_OVERRIDE_INIT="$WNO_OVERRIDE_INIT -Wno-override-init"])         # gcc
> +AX_CHECK_COMPILE_FLAG([-Winitializer-overrides],            
> [WNO_OVERRIDE_INIT="$WNO_OVERRIDE_INIT -Wno-initializer-overrides"]) # clang
>  AC_SUBST([WNO_OVERRIDE_INIT])

This is correct I think.

>  
>  dnl
> diff --git a/meson.build b/meson.build
> index bba9a292aa..e69ef6a14b 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -683,7 +683,7 @@ endif
>  cpp = meson.get_compiler('cpp')
>  cpp_args = []
>  foreach a : ['-Wall', '-fno-math-errno', '-fno-trapping-math',
> -             '-Qunused-arguments', '-Wno-non-virtual-dtor']
> +             '-Qunused-arguments', '-Wnon-virtual-dtor']
>    if cpp.has_argument(a)
>      cpp_args += a
>    endif

This inverts the meaning of the test, instead remove it from the list and do
something like:

if cpp.has_argument('-Wnon-virtual-dtor')
  cpp_args += '-Wno-non-virtual-dtor')
endif

> @@ -708,7 +708,7 @@ foreach a : ['-Werror=pointer-arith', '-Werror=vla']
>  endforeach
>  
>  no_override_init_args = []
> -foreach a : ['-Wno-override-init', '-Wno-initializer-overrides']
> +foreach a : ['-Woverride-init', '-Winitializer-overrides']

Same here, but you can do something like:

foreach a : ['override-init', 'initializer-overrides']
  if cc.has_argument('-W0@0'.format(a))
    no_override_init_args += '-Wno-@0@'.format(a)
  endif
endforeach

Please be sure to add a comment explaining why this is necessary, preferably in
both places in meson and in configure.ac

And thank you for looking into this. The warnings about those arguments were
annoying me to no end.

Dylan

Attachment: signature.asc
Description: signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to