[Mesa-dev] [PATCH mesa] build: make passing an incorrect pointer type a hard error
Eric Engestrom
eric.engestrom at intel.com
Thu Nov 22 13:15:05 UTC 2018
More or less any of this issue pointed out by the compiler is
a coding error. Make sure we flag it and bail loudly.
v2: - apply the change to autotools and scons as well (Emil)
- C++ doesn't need this, it's already an error and the flag
doesn't exist (Gert)
Signed-off-by: Eric Engestrom <eric.engestrom at intel.com>
Reviewed-by: Dylan Baker <dylan at pnwbakers.com> # v1
Reviewed-by: Emil Velikov <emil.velikov at collabora.com> # v1
[Emil: apply the same change to autotools and scons]
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
---
Emil, I dropped the Android bit as this `-Wno-error` makes it look to me
like they don't want compiler warnings to stop the build.
---
configure.ac | 1 +
meson.build | 1 +
scons/gallium.py | 1 +
3 files changed, 3 insertions(+)
diff --git a/configure.ac b/configure.ac
index 93a52475d50e6ee65432..422c8e3c87c897a88b51 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"])
diff --git a/meson.build b/meson.build
index 4ad41fde13a33f546d48..2fde2b23e24fd2e4321e 100644
--- a/meson.build
+++ b/meson.build
@@ -788,6 +788,7 @@ endif
c_args = []
foreach a : ['-Werror=implicit-function-declaration',
'-Werror=missing-prototypes', '-Werror=return-type',
+ '-Werror=incompatible-pointer-types',
'-fno-math-errno',
'-fno-trapping-math', '-Qunused-arguments']
if cc.has_argument(a)
diff --git a/scons/gallium.py b/scons/gallium.py
index 963834a5fbc12a378ad4..04175014925cf088e5ea 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
]
--
Cheers,
Eric
More information about the mesa-dev
mailing list