Only add -Wno-format-truncation when using GCC

* Clang produces warnings such as
  warning: unknown warning option '-Wno-format-truncation' [-Wunknown-warning-option]
This commit is contained in:
David Seifert 2022-03-27 13:20:49 +02:00
parent 4b01368fd8
commit ce57da8fd4
No known key found for this signature in database
GPG Key ID: CE36E117202E3842

View File

@ -633,11 +633,22 @@ AS_IF([test "x$enable_werror" = "xyes"], [
AC_LANG_POP([C++]) AC_LANG_POP([C++])
]) ])
common_flags="-Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Wwrite-strings -Wundef -Wuninitialized -Winit-self -Wno-format-truncation" common_flags="-Wall -Wextra -Wpointer-arith -Wcast-align -Wcast-qual -Wshadow -Wwrite-strings -Wundef -Wuninitialized -Winit-self"
AX_APPEND_COMPILE_FLAGS([${common_flags} -Wvla -Wbad-function-cast -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Waggregate-return], [CFLAGS]) common_cflags="${common_flags}"
dnl Clang doesn't know about -Wno-format-truncation
dnl and would spew tons of warnings otherwise.
AS_IF([test "x$ax_cv_c_compiler_vendor" = "xgnu"], [
common_cflags+=" -Wno-format-truncation"
])
common_cxxflags="${common_flags}"
AS_IF([test "x$ax_cv_cxx_compiler_vendor" = "xgnu"], [
common_cxxflags+=" -Wno-format-truncation"
])
AX_APPEND_COMPILE_FLAGS([${common_cflags} -Wvla -Wbad-function-cast -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Waggregate-return], [CFLAGS])
AC_LANG_PUSH([C++]) AC_LANG_PUSH([C++])
AX_APPEND_COMPILE_FLAGS([${common_flags} -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Wreorder -Wsign-promo], [CXXFLAGS]) AX_APPEND_COMPILE_FLAGS([${common_cxxflags} -Wctor-dtor-privacy -Wnon-virtual-dtor -Woverloaded-virtual -Wreorder -Wsign-promo], [CXXFLAGS])
AC_LANG_POP([C++]) AC_LANG_POP([C++])
AS_IF([test "x$enable_test_coverage" = "xyes"], [ AS_IF([test "x$enable_test_coverage" = "xyes"], [