mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-01-14 09:12:11 +03:00
config: add and use KERNEL_CC check for -Wno-format-zero-length
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Ivan Shapovalov <intelfx@intelfx.name> Closes #16997
This commit is contained in:
parent
92579489e0
commit
c00c3e33bb
@ -155,6 +155,34 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_CC_NO_FORMAT_ZERO_LENGTH], [
|
||||
AC_SUBST([NO_FORMAT_ZERO_LENGTH])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # Check if kernel cc supports -Wno-format-zero-length option.
|
||||
dnl #
|
||||
AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_KERNEL_CC_NO_FORMAT_ZERO_LENGTH], [
|
||||
saved_cc="$CC"
|
||||
AS_IF(
|
||||
[ test -n "$KERNEL_CC" ], [ CC="$KERNEL_CC" ],
|
||||
[ test -n "$KERNEL_LLVM" ], [ CC="clang" ],
|
||||
[ CC="gcc" ]
|
||||
)
|
||||
AC_MSG_CHECKING([whether $CC supports -Wno-format-zero-length])
|
||||
|
||||
saved_flags="$CFLAGS"
|
||||
CFLAGS="$CFLAGS -Werror -Wno-format-zero-length"
|
||||
|
||||
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([], [])], [
|
||||
KERNEL_NO_FORMAT_ZERO_LENGTH=-Wno-format-zero-length
|
||||
AC_MSG_RESULT([yes])
|
||||
], [
|
||||
KERNEL_NO_FORMAT_ZERO_LENGTH=
|
||||
AC_MSG_RESULT([no])
|
||||
])
|
||||
|
||||
CC="$saved_cc"
|
||||
CFLAGS="$saved_flags"
|
||||
AC_SUBST([KERNEL_NO_FORMAT_ZERO_LENGTH])
|
||||
])
|
||||
|
||||
dnl #
|
||||
dnl # Check if cc supports -Wno-clobbered option.
|
||||
dnl #
|
||||
|
||||
@ -256,6 +256,7 @@ AC_DEFUN([ZFS_AC_CONFIG_ALWAYS], [
|
||||
ZFS_AC_CONFIG_ALWAYS_CC_FRAME_LARGER_THAN
|
||||
ZFS_AC_CONFIG_ALWAYS_CC_NO_FORMAT_TRUNCATION
|
||||
ZFS_AC_CONFIG_ALWAYS_CC_NO_FORMAT_ZERO_LENGTH
|
||||
ZFS_AC_CONFIG_ALWAYS_KERNEL_CC_NO_FORMAT_ZERO_LENGTH
|
||||
ZFS_AC_CONFIG_ALWAYS_CC_FORMAT_OVERFLOW
|
||||
ZFS_AC_CONFIG_ALWAYS_CC_NO_OMIT_FRAME_POINTER
|
||||
ZFS_AC_CONFIG_ALWAYS_CC_NO_IPA_SRA
|
||||
|
||||
@ -4,7 +4,7 @@
|
||||
|
||||
ZFS_MODULE_CFLAGS += -std=gnu99 -Wno-declaration-after-statement
|
||||
ZFS_MODULE_CFLAGS += -Wmissing-prototypes
|
||||
ZFS_MODULE_CFLAGS += @KERNEL_DEBUG_CFLAGS@ @NO_FORMAT_ZERO_LENGTH@
|
||||
ZFS_MODULE_CFLAGS += @KERNEL_DEBUG_CFLAGS@ @KERNEL_NO_FORMAT_ZERO_LENGTH@
|
||||
|
||||
ifneq ($(KBUILD_EXTMOD),)
|
||||
zfs_include = @abs_top_srcdir@/include
|
||||
|
||||
Loading…
Reference in New Issue
Block a user