[Mesa-dev] [PATCH] build: enable -Werror=incompatible-pointer-types

Gert Wollny gw.fossdev at gmail.com
Wed Nov 21 17:58:47 UTC 2018


Am Mittwoch, den 21.11.2018, 13:14 +0000 schrieb Emil Velikov:
> From: Emil Velikov <emil.velikov at collabora.com>
> 
> More or less any issue pointed out by the compiler is an error. Make
> sure we flag and bail loudly.
> 
> Cc: Eric Engestrom <eric.engestrom at intel.com>
> Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
> ---
> Eric, feel free to squash this with your patch.
> ---
>  Android.common.mk | 1 +
>  configure.ac      | 2 ++
>  scons/gallium.py  | 1 +
>  3 files changed, 4 insertions(+)
> 
> diff --git a/Android.common.mk b/Android.common.mk
> index aa1b266a393..4bdbf70e30b 100644
> --- a/Android.common.mk
> +++ b/Android.common.mk
> @@ -31,6 +31,7 @@ LOCAL_C_INCLUDES += \
>  
>  MESA_VERSION := $(shell cat $(MESA_TOP)/VERSION)
>  LOCAL_CFLAGS += \
> +	-Werror=incompatible-pointer-types \
>  	-Wno-error \
>  	-Wno-unused-parameter \
>  	-Wno-pointer-arith \
> diff --git a/configure.ac b/configure.ac
> index 93a52475d50..2b632cda997 100644
> --- a/configure.ac
> +++ b/configure.ac
> @@ -307,6 +307,7 @@ dnl
>  AX_CHECK_COMPILE_FLAG([-
> Wall],                                 [CFLAGS="$CFLAGS -Wall"])
>  AX_CHECK_COMPILE_FLAG([-Werror=implicit-function-declaration],
> [CFLAGS="$CFLAGS -Werror=implicit-function-declaration"])
>  AX_CHECK_COMPILE_FLAG([-Werror=missing-
> prototypes],            [CFLAGS="$CFLAGS -Werror=missing-
> prototypes"])
> +AX_CHECK_COMPILE_FLAG([-Werror=incompatible-pointer-
> types],    [CFLAGS="$CFLAGS -Werror=incompatible-pointer-types"])
>  AX_CHECK_COMPILE_FLAG([-Wmissing-
> prototypes],                  [CFLAGS="$CFLAGS -Wmissing-
> prototypes"])
>  dnl Dylan Baker: gcc and clang always accepr -Wno-*, hence check for
> the original warning, then set the no-* flag
>  AX_CHECK_COMPILE_FLAG([-Wmissing-field-
> initializers],          [CFLAGS="$CFLAGS -Wno-missing-field-
> initializers"])
> @@ -326,6 +327,7 @@ dnl Check C++ compiler flags
>  dnl
>  AC_LANG_PUSH([C++])
>  AX_CHECK_COMPILE_FLAG([-
> Wall],                                 [CXXFLAGS="$CXXFLAGS -Wall"])
> +AX_CHECK_COMPILE_FLAG([-Werror=incompatible-pointer-
> types],    [CFXXLAGS="$CXXFLAGS -Werror=incompatible-pointer-types"])
For C++ this shoudn't be needed, because there this is already an
error. 

Cheers,
Gert

>  AX_CHECK_COMPILE_FLAG([-fno-math-
> errno],                       [CXXFLAGS="$CXXFLAGS -fno-math-errno"])
>  AX_CHECK_COMPILE_FLAG([-fno-trapping-
> math],                    [CXXFLAGS="$CXXFLAGS -fno-trapping-math"])
>  AX_CHECK_COMPILE_FLAG([-
> fvisibility=hidden],                   [VISIBILITY_CXXFLAGS="-
> fvisibility=hidden"])
> diff --git a/scons/gallium.py b/scons/gallium.py
> index 963834a5fbc..36f542d0d64 100755
> --- a/scons/gallium.py
> +++ b/scons/gallium.py
> @@ -451,6 +451,7 @@ def generate(env):
>          # - http://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
>          ccflags += [
>              '-Wall',
> +            '-Werror=incompatible-pointer-types'
>              '-Wno-long-long',
>              '-fmessage-length=0', # be nice to Eclipse
>          ]


More information about the mesa-dev mailing list