1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2024-10-26 12:25:09 +03:00

Visual Studio builds: Allow silencing deprecation warnings

Define XML_IGNORE_DEPRECATION_WARNINGS and the corresponding XML_POP_WARNINGS
for Visual Studio, and consequently define XML_IGNORE_FPTR_CAST_WARNINGS so
that we do not get a compiler warning on Visual Studio by doing a
__pragma(warning(pop)) without a corresponding __pragma(warning(push)).

Also correct the documentation a bit for XML_POP_WARNINGS.
This commit is contained in:
Chun-wei Fan 2022-11-22 14:56:58 +08:00
parent b9590d5d81
commit 707ade225c
2 changed files with 17 additions and 3 deletions

View File

@ -499,13 +499,23 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
*
* Macro used to ignore pointer cast warnings that can't be worked around.
*/
#define XML_IGNORE_FPTR_CAST_WARNINGS
#if defined (_MSC_VER) && (_MSC_VER >= 1400)
# define XML_IGNORE_FPTR_CAST_WARNINGS __pragma(warning(push))
#else
# define XML_IGNORE_FPTR_CAST_WARNINGS
#endif
/**
* LIBXML_POP_WARNINGS:
* XML_POP_WARNINGS:
*
* Macro used to restore warnings state.
*/
#define XML_POP_WARNINGS
#ifndef XML_POP_WARNINGS
# if defined (_MSC_VER) && (_MSC_VER >= 1400)
# define XML_POP_WARNINGS __pragma(warning(pop))
# else
# define XML_POP_WARNINGS
# endif
#endif
#endif /* __GNUC__ */
#ifdef __cplusplus

View File

@ -68,6 +68,10 @@
#define XML_IGNORE_DEPRECATION_WARNINGS \
_Pragma("GCC diagnostic push") \
_Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
#elif defined (_MSC_VER) && (_MSC_VER >= 1400)
#define XML_IGNORE_DEPRECATION_WARNINGS \
__pragma(warning(push)) \
__pragma(warning(disable : 4996))
#else
#define XML_IGNORE_DEPRECATION_WARNINGS
#endif