Mesa (master): m4: add Werror when checking for compiler flags
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Oct 30 16:42:30 UTC 2018
Module: Mesa
Branch: master
Commit: 29283921b72fa9386322fc9eb301d00e88b634b6
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=29283921b72fa9386322fc9eb301d00e88b634b6
Author: Emil Velikov <emil.velikov at collabora.com>
Date: Wed Oct 24 18:53:11 2018 +0100
m4: add Werror when checking for compiler flags
Seemingly that at some point clang started accepting _any_ flags,
whereas previously it would error out.
These days, you can give it -Whamsandwich and it will succeed, while
at the same time throwing an annoying warning.
Add -Werror so that everything gets flagged and set accordingly.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108082
Cc: Vinson Lee <vlee at freedesktop.org>
Repored-by: Vinson Lee <vlee at freedesktop.org>
Signed-off-by: Emil Velikov <emil.velikov at collabora.com>
Reviewed-by: Dylan Baker <dylan at pnwbakers.com>
Reviewed-by: Eric Engestrom <eric.engestrom at intel.com>
---
configure.ac | 11 +++++++++++
m4/ax_check_compile_flag.m4 | 7 ++++++-
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 156fb15fd3..be9674a0c1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -297,6 +297,12 @@ esac
AM_CONDITIONAL(HAVE_ANDROID, test "x$android" = xyes)
+# Toggle Werror since at some point clang started treating unknown -W
+# flags as warnings, succeeding with the build, yet issuing an annoying
+# warning.
+save_CFLAGS="$CFLAGS"
+export CFLAGS="$CFLAGS -Werror"
+
dnl
dnl Check compiler flags
dnl
@@ -312,6 +318,11 @@ AX_CHECK_COMPILE_FLAG([-fno-math-errno], [CFLAGS="$CFLAGS
AX_CHECK_COMPILE_FLAG([-fno-trapping-math], [CFLAGS="$CFLAGS -fno-trapping-math"])
AX_CHECK_COMPILE_FLAG([-fvisibility=hidden], [VISIBILITY_CFLAGS="-fvisibility=hidden"])
+CFLAGS="$save_CFLAGS"
+
+# Toggle Werror since at some point clang started treating unknown -W
+# flags as warnings, succeeding with the build, yet issuing an annoying
+# warning.
dnl
dnl Check C++ compiler flags
dnl
diff --git a/m4/ax_check_compile_flag.m4 b/m4/ax_check_compile_flag.m4
index 51df0c09a7..0fdca907e8 100644
--- a/m4/ax_check_compile_flag.m4
+++ b/m4/ax_check_compile_flag.m4
@@ -55,6 +55,11 @@
# modified version of the Autoconf Macro, you may extend this special
# exception to the GPL to apply to your modified version as well.
+# Emil:
+# Toggle Werror since at some point clang started treating unknown -W
+# flags as warnings, succeeding with the build, yet issuing an annoying
+# warning.
+
#serial 3
AC_DEFUN([AX_CHECK_COMPILE_FLAG],
@@ -62,7 +67,7 @@ AC_DEFUN([AX_CHECK_COMPILE_FLAG],
AS_VAR_PUSHDEF([CACHEVAR],[ax_cv_check_[]_AC_LANG_ABBREV[]flags_$4_$1])dnl
AC_CACHE_CHECK([whether _AC_LANG compiler accepts $1], CACHEVAR, [
ax_check_save_flags=$[]_AC_LANG_PREFIX[]FLAGS
- _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1"
+ _AC_LANG_PREFIX[]FLAGS="$[]_AC_LANG_PREFIX[]FLAGS $4 $1 -Werror"
AC_COMPILE_IFELSE([m4_default([$5],[AC_LANG_PROGRAM()])],
[AS_VAR_SET(CACHEVAR,[yes])],
[AS_VAR_SET(CACHEVAR,[no])])
More information about the mesa-commit
mailing list