2016-01-04 21:43:19 +03:00
|
|
|
dnl @synopsis mc_CHECK_CFLAGS
|
2009-10-30 00:29:32 +03:00
|
|
|
dnl
|
2013-01-16 14:03:33 +04:00
|
|
|
dnl Check flags supported by C compiler
|
2009-10-30 00:29:32 +03:00
|
|
|
dnl
|
|
|
|
dnl @author Slava Zanko <slavazanko@gmail.com>
|
2021-09-19 17:13:56 +03:00
|
|
|
dnl @modified by Andrew Borodin <aborodin@vmail.ru>
|
2024-11-03 11:32:35 +03:00
|
|
|
dnl @modified by Yury V. Zaytsev <yury@shurup.com>
|
|
|
|
dnl @version 2024-11-03
|
2009-10-30 00:29:32 +03:00
|
|
|
dnl @license GPL
|
|
|
|
dnl @copyright Free Software Foundation, Inc.
|
|
|
|
|
2021-09-19 17:13:56 +03:00
|
|
|
AC_DEFUN([mc_CHECK_CFLAGS],[
|
|
|
|
AC_LANG_PUSH(C)
|
2009-10-30 00:29:32 +03:00
|
|
|
|
2021-09-19 17:13:56 +03:00
|
|
|
mc_configured_cflags=""
|
2009-10-30 00:29:32 +03:00
|
|
|
|
2021-09-19 17:13:56 +03:00
|
|
|
dnl Sorted -f options:
|
|
|
|
case "$CC" in
|
|
|
|
gcc*)
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-fdiagnostics-show-option], [mc_configured_cflags])
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
2009-12-06 19:22:33 +03:00
|
|
|
|
2024-11-03 11:32:35 +03:00
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wall], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wextra], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
|
|
|
|
dnl Enable support for C standard features up to (and including) C99 and pedantic warnings
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wattributes], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wimplicit-function-declaration], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wimplicit-int], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wno-declaration-after-statement], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wno-long-long], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wno-vla], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wincompatible-pointer-types], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wint-conversion], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
|
|
|
|
dnl Sorted -W options not included in -Wall and -Wextra
|
2021-09-19 17:13:56 +03:00
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wbad-function-cast], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wconditional-uninitialized], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wfloat-conversion], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wfloat-equal], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wformat-security], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wformat-signedness], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wimplicit-fallthrough], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wmissing-declarations], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wmissing-format-attribute], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wmissing-prototypes], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wmissing-variable-declarations], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wnested-externs], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wpointer-arith], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wredundant-decls], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wshadow], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wstrict-prototypes], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wswitch-default], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wundef], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wunreachable-code], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wunused-result], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wwrite-strings], [mc_configured_cflags], [$EXTRA_OPTION])
|
2013-01-16 14:03:33 +04:00
|
|
|
|
2024-11-03 11:43:29 +03:00
|
|
|
dnl Explicitly disabled warnings
|
|
|
|
|
|
|
|
dnl This flags casts like (GCompareDataFunc) with missing parameter
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wno-cast-function-type], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
|
|
|
|
dnl https://github.com/llvm/llvm-project/issues/20574
|
|
|
|
AX_APPEND_COMPILE_FLAGS([-Wno-assign-enum], [mc_configured_cflags], [$EXTRA_OPTION])
|
|
|
|
|
2013-01-16 14:03:33 +04:00
|
|
|
AC_LANG_POP()
|
2009-10-30 00:29:32 +03:00
|
|
|
])
|