Conditionalize use of -Wno-suggest-attribute=format pragma

Many GCC versions don't understand -Wno-suggest-attribute=format
so the pragma must only be used when supported
This commit is contained in:
Daniel P. Berrange committed 2015-01-16 17:12:27 +00:00
1 parent 29f15b43fa
commit 87fa184910
2 files changed
+13 -1

No files matched your search

+6
View File
@@ -215,6 +215,12 @@ AC_DEFUN([LIBVIRT_COMPILE_WARNINGS],[
;;
esac
case $WARN_CFLAGS in
*-Wsuggest-attribute=format*)
AC_DEFINE([HAVE_SUGGEST_ATTRIBUTE_FORMAT], [1], [Whether -Wsuggest-attribute=format works])
;;
esac
# Silence certain warnings in gnulib, and use improved glibc headers
AC_DEFINE([lint], [1],
[Define to 1 if the compiler is checking for lint.])
+7 -1
View File
@@ -234,9 +234,15 @@
# define VIR_WARNINGS_NO_CAST_ALIGN \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wcast-align\"")
# define VIR_WARNINGS_NO_PRINTF \
# if HAVE_SUGGEST_ATTRIBUTE_FORMAT
# define VIR_WARNINGS_NO_PRINTF \
_Pragma ("GCC diagnostic push") \
_Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=format\"")
# else
# define VIR_WARNINGS_NO_PRINTF \
_Pragma ("GCC diagnostic push")
# endif
# define VIR_WARNINGS_RESET \
_Pragma ("GCC diagnostic pop")