libxml2/backport-Add-XML_DEPRECATED-macro.patch
Zhipeng Xie 1513472492 backport upstream patches
Signed-off-by: Zhipeng Xie <xiezhipeng1@huawei.com>
2022-11-29 15:28:15 +08:00

66 lines
1.6 KiB
Diff

From a2fe74c08a9bd03cf5515b9e44d2005538b9f619 Mon Sep 17 00:00:00 2001
From: Nick Wellnhofer <wellnhofer@aevum.de>
Date: Sun, 20 Feb 2022 18:19:27 +0100
Subject: [PATCH 3/3] Add XML_DEPRECATED macro
__attribute__((deprecated)) is available since at least GCC 3.1, so an
exact version check is probably unnecessary.
---
include/libxml/xmlversion.h.in | 18 ++++++++++++++++++
testapi.c | 3 +++
2 files changed, 21 insertions(+)
diff --git a/include/libxml/xmlversion.h.in b/include/libxml/xmlversion.h.in
index f9f79a2f..b1d2a208 100644
--- a/include/libxml/xmlversion.h.in
+++ b/include/libxml/xmlversion.h.in
@@ -456,6 +456,15 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
# define LIBXML_ATTR_FORMAT(fmt,args)
#endif
+#ifndef XML_DEPRECATED
+# ifdef IN_LIBXML
+# define XML_DEPRECATED
+# else
+/* Available since at least GCC 3.1 */
+# define XML_DEPRECATED __attribute__((deprecated))
+# endif
+#endif
+
#else /* ! __GNUC__ */
/**
* ATTRIBUTE_UNUSED:
@@ -475,6 +484,15 @@ XMLPUBFUN void XMLCALL xmlCheckVersion(int version);
* Macro used to indicate to GCC the parameter are printf like
*/
#define LIBXML_ATTR_FORMAT(fmt,args)
+/**
+ * XML_DEPRECATED:
+ *
+ * Macro used to indicate that a function, variable, type or struct member
+ * is deprecated.
+ */
+#ifndef XML_DEPRECATED
+#define XML_DEPRECATED
+#endif
#endif /* __GNUC__ */
#ifdef __cplusplus
diff --git a/testapi.c b/testapi.c
index 4b091f0c..3a4dc2fe 100644
--- a/testapi.c
+++ b/testapi.c
@@ -8,6 +8,9 @@
* daniel@veillard.com
*/
+/* Disable deprecation warnings */
+#define XML_DEPRECATED
+
#include "libxml.h"
#include <stdio.h>
--
2.27.0