mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-07 00:31:11 +00:00
m4: add NM_COMPILER_WARNING_FLAG() macro
We used COMPILER_FLAG(LIBSYSTEMD_NM_CFLAGS, "-Wno-gnu-variable-sized-type-not-at-end") to detect whether the flag is supported. However, that does not work with GCC since version 4.4 due to https://gcc.gnu.org/wiki/FAQ#wnowarning. Note that we already had NM_COMPILER_WARNING(), but that again does something rather different.
This commit is contained in:
parent
3117198f15
commit
119d30145e
|
@ -29,8 +29,17 @@ AC_DEFUN([NM_COMPILER_FLAG], [
|
|||
], [$4])
|
||||
])
|
||||
|
||||
dnl Check whether a particular warning is supported. If yes, the flag
|
||||
dnl is appended to [ENV-VAR].
|
||||
dnl NM_COMPILER_WARNING_FLAG([ENV-VAR], [WARNING])
|
||||
AC_DEFUN([NM_COMPILER_WARNING_FLAG], [
|
||||
dnl "-Wno-*" requires special handling, see https://gcc.gnu.org/wiki/FAQ#wnowarning.
|
||||
_NM_COMPILER_FLAG([-Wall $(printf '%s' "$2" | sed -e 's/^-W\(no-\|no-error=\)/-W/')], [], [eval "AS_TR_SH([$1])='$$1 $2'"], [])
|
||||
])
|
||||
|
||||
dnl Check whether a particular warning is not emitted with code provided,
|
||||
dnl append an option to disable the warning to a specified variable if the check fails.
|
||||
dnl Note that this always either adds -W$2 or -Wno-$2, depending on whether it's supported.
|
||||
dnl NM_COMPILER_WARNING([ENV-VAR], [WARNING], [C-SNIPPET])
|
||||
AC_DEFUN([NM_COMPILER_WARNING], [
|
||||
_NM_COMPILER_FLAG([-W$2], [$3], [eval "AS_TR_SH([$1])='$$1 -W$2'"], [eval "AS_TR_SH([$1])='$$1 -Wno-$2'"])
|
||||
|
|
Loading…
Reference in a new issue