summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
author韩朴宇 <[email protected]>2020-02-05 00:47:38 +0800
committerGitHub <[email protected]>2020-02-04 08:47:37 -0800
commit52c487a0e4432269b0b0ddc034155a8cf62e0299 (patch)
treeaf06e62da704cdc2b83166673c6c3bd12f41e624
parent8c4987c489c842a7dcd2356bdfd53e2aacc33316 (diff)
Use -Werror to check if the compiler supports specific options
Be default, clang treats unknown warning option as warning. We need to use -Werror to make it an error. Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Ryan Moeller <[email protected]> Signed-off-by: 12101111 <[email protected]> Closes #9927
-rw-r--r--config/always-compiler-options.m412
1 files changed, 6 insertions, 6 deletions
diff --git a/config/always-compiler-options.m4 b/config/always-compiler-options.m4
index e187f6ff8..f903655fa 100644
--- a/config/always-compiler-options.m4
+++ b/config/always-compiler-options.m4
@@ -22,7 +22,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_ASAN], [
AS_IF([ test "$enable_asan" = "yes" ], [
AC_MSG_CHECKING([whether $CC supports -fsanitize=address])
saved_cflags="$CFLAGS"
- CFLAGS="$CFLAGS -fsanitize=address"
+ CFLAGS="$CFLAGS -Werror -fsanitize=address"
AC_LINK_IFELSE([
AC_LANG_SOURCE([[ int main() { return 0; } ]])
], [
@@ -52,7 +52,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_FRAME_LARGER_THAN], [
AC_MSG_CHECKING([whether $CC supports -Wframe-larger-than=<size>])
saved_flags="$CFLAGS"
- CFLAGS="$CFLAGS -Wframe-larger-than=4096"
+ CFLAGS="$CFLAGS -Werror -Wframe-larger-than=4096"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [
FRAME_LARGER_THAN="-Wframe-larger-than=4096"
@@ -73,7 +73,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_NO_FORMAT_TRUNCATION], [
AC_MSG_CHECKING([whether $CC supports -Wno-format-truncation])
saved_flags="$CFLAGS"
- CFLAGS="$CFLAGS -Wno-format-truncation"
+ CFLAGS="$CFLAGS -Werror -Wno-format-truncation"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [
NO_FORMAT_TRUNCATION=-Wno-format-truncation
@@ -100,7 +100,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_NO_BOOL_COMPARE], [
AC_MSG_CHECKING([whether $CC supports -Wno-bool-compare])
saved_flags="$CFLAGS"
- CFLAGS="$CFLAGS -Wbool-compare"
+ CFLAGS="$CFLAGS -Werror -Wbool-compare"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [
NO_BOOL_COMPARE=-Wno-bool-compare
@@ -126,7 +126,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_NO_UNUSED_BUT_SET_VARIABLE], [
AC_MSG_CHECKING([whether $CC supports -Wno-unused-but-set-variable])
saved_flags="$CFLAGS"
- CFLAGS="$CFLAGS -Wunused-but-set-variable"
+ CFLAGS="$CFLAGS -Werror -Wunused-but-set-variable"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [
NO_UNUSED_BUT_SET_VARIABLE=-Wno-unused-but-set-variable
@@ -147,7 +147,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_NO_OMIT_FRAME_POINTER], [
AC_MSG_CHECKING([whether $CC supports -fno-omit-frame-pointer])
saved_flags="$CFLAGS"
- CFLAGS="$CFLAGS -fno-omit-frame-pointer"
+ CFLAGS="$CFLAGS -Werror -fno-omit-frame-pointer"
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [
NO_OMIT_FRAME_POINTER=-fno-omit-frame-pointer