1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

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 2015-01-16 14:45:08 +00:00
parent 29f15b43fa
commit 87fa184910
2 changed files with 13 additions and 1 deletions

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.])

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")