mc-cflags.m4 3.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. dnl @synopsis mc_CHECK_CFLAGS
  2. dnl
  3. dnl Check flags supported by C compiler
  4. dnl
  5. dnl @author Slava Zanko <slavazanko@gmail.com>
  6. dnl @modified by Andrew Borodin <aborodin@vmail.ru>
  7. dnl @modified by Yury V. Zaytsev <yury@shurup.com>
  8. dnl @version 2024-11-03
  9. dnl @license GPL
  10. dnl @copyright Free Software Foundation, Inc.
  11. AC_DEFUN([mc_CHECK_CFLAGS],[
  12. AC_LANG_PUSH(C)
  13. mc_configured_cflags=""
  14. dnl Sorted -f options:
  15. case "$CC" in
  16. gcc*)
  17. AX_APPEND_COMPILE_FLAGS([-fdiagnostics-show-option], [mc_configured_cflags])
  18. ;;
  19. *)
  20. ;;
  21. esac
  22. AX_APPEND_COMPILE_FLAGS([-Wall], [mc_configured_cflags], [$EXTRA_OPTION])
  23. AX_APPEND_COMPILE_FLAGS([-Wextra], [mc_configured_cflags], [$EXTRA_OPTION])
  24. dnl Enable support for C standard features up to (and including) C99 and pedantic warnings
  25. AX_APPEND_COMPILE_FLAGS([-Wattributes], [mc_configured_cflags], [$EXTRA_OPTION])
  26. AX_APPEND_COMPILE_FLAGS([-Wimplicit-function-declaration], [mc_configured_cflags], [$EXTRA_OPTION])
  27. AX_APPEND_COMPILE_FLAGS([-Wimplicit-int], [mc_configured_cflags], [$EXTRA_OPTION])
  28. AX_APPEND_COMPILE_FLAGS([-Wno-declaration-after-statement], [mc_configured_cflags], [$EXTRA_OPTION])
  29. AX_APPEND_COMPILE_FLAGS([-Wno-long-long], [mc_configured_cflags], [$EXTRA_OPTION])
  30. AX_APPEND_COMPILE_FLAGS([-Wno-vla], [mc_configured_cflags], [$EXTRA_OPTION])
  31. AX_APPEND_COMPILE_FLAGS([-Wincompatible-pointer-types], [mc_configured_cflags], [$EXTRA_OPTION])
  32. AX_APPEND_COMPILE_FLAGS([-Wint-conversion], [mc_configured_cflags], [$EXTRA_OPTION])
  33. dnl Sorted -W options not included in -Wall and -Wextra
  34. AX_APPEND_COMPILE_FLAGS([-Wbad-function-cast], [mc_configured_cflags], [$EXTRA_OPTION])
  35. AX_APPEND_COMPILE_FLAGS([-Wconditional-uninitialized], [mc_configured_cflags], [$EXTRA_OPTION])
  36. AX_APPEND_COMPILE_FLAGS([-Wfloat-conversion], [mc_configured_cflags], [$EXTRA_OPTION])
  37. AX_APPEND_COMPILE_FLAGS([-Wfloat-equal], [mc_configured_cflags], [$EXTRA_OPTION])
  38. AX_APPEND_COMPILE_FLAGS([-Wformat-security], [mc_configured_cflags], [$EXTRA_OPTION])
  39. AX_APPEND_COMPILE_FLAGS([-Wformat-signedness], [mc_configured_cflags], [$EXTRA_OPTION])
  40. AX_APPEND_COMPILE_FLAGS([-Wimplicit-fallthrough], [mc_configured_cflags], [$EXTRA_OPTION])
  41. AX_APPEND_COMPILE_FLAGS([-Wmissing-declarations], [mc_configured_cflags], [$EXTRA_OPTION])
  42. AX_APPEND_COMPILE_FLAGS([-Wmissing-format-attribute], [mc_configured_cflags], [$EXTRA_OPTION])
  43. AX_APPEND_COMPILE_FLAGS([-Wmissing-prototypes], [mc_configured_cflags], [$EXTRA_OPTION])
  44. AX_APPEND_COMPILE_FLAGS([-Wmissing-variable-declarations], [mc_configured_cflags], [$EXTRA_OPTION])
  45. AX_APPEND_COMPILE_FLAGS([-Wnested-externs], [mc_configured_cflags], [$EXTRA_OPTION])
  46. AX_APPEND_COMPILE_FLAGS([-Wpointer-arith], [mc_configured_cflags], [$EXTRA_OPTION])
  47. AX_APPEND_COMPILE_FLAGS([-Wredundant-decls], [mc_configured_cflags], [$EXTRA_OPTION])
  48. AX_APPEND_COMPILE_FLAGS([-Wshadow], [mc_configured_cflags], [$EXTRA_OPTION])
  49. AX_APPEND_COMPILE_FLAGS([-Wstrict-prototypes], [mc_configured_cflags], [$EXTRA_OPTION])
  50. AX_APPEND_COMPILE_FLAGS([-Wswitch-default], [mc_configured_cflags], [$EXTRA_OPTION])
  51. AX_APPEND_COMPILE_FLAGS([-Wundef], [mc_configured_cflags], [$EXTRA_OPTION])
  52. AX_APPEND_COMPILE_FLAGS([-Wunreachable-code], [mc_configured_cflags], [$EXTRA_OPTION])
  53. AX_APPEND_COMPILE_FLAGS([-Wunused-result], [mc_configured_cflags], [$EXTRA_OPTION])
  54. AX_APPEND_COMPILE_FLAGS([-Wwrite-strings], [mc_configured_cflags], [$EXTRA_OPTION])
  55. dnl Explicitly disabled warnings
  56. dnl This flags casts like (GCompareDataFunc) with missing parameter
  57. AX_APPEND_COMPILE_FLAGS([-Wno-cast-function-type], [mc_configured_cflags], [$EXTRA_OPTION])
  58. dnl https://github.com/llvm/llvm-project/issues/20574
  59. AX_APPEND_COMPILE_FLAGS([-Wno-assign-enum], [mc_configured_cflags], [$EXTRA_OPTION])
  60. AC_LANG_POP()
  61. ])