From c537ccf0aea640e625abce653d5890afc934b340 Mon Sep 17 00:00:00 2001 From: Lars Erik Wik Date: Thu, 25 Sep 2025 11:29:05 +0200 Subject: [PATCH] Fixed compilation error on GCC versions prior to 4.5 The deprecated attribute started accepting an optional string argument in GCC version 4.5. Compiling libxml2 with GCC versions prior to that would cause compilation errors such as: ``` ./include/libxml/xmlmemory.h:134: error: wrong number of arguments specified for 'deprecated' attribute ``` Now the string argument is omitted for older versions of GCC. Signed-off-by: Lars Erik Wik --- include/libxml/xmlexports.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/include/libxml/xmlexports.h b/include/libxml/xmlexports.h index 3149c7317..3a23c5489 100644 --- a/include/libxml/xmlexports.h +++ b/include/libxml/xmlexports.h @@ -55,8 +55,12 @@ #ifndef XML_DEPRECATED #if defined(IN_LIBXML) #define XML_DEPRECATED - #elif __GNUC__ * 100 + __GNUC_MINOR__ >= 301 + #elif __GNUC__ * 100 + __GNUC_MINOR__ >= 405 + /* GCC 4.5+ supports deprecated with message */ #define XML_DEPRECATED __attribute__((deprecated("See https://gnome.pages.gitlab.gnome.org/libxml2/html/deprecated.html"))) + #elif __GNUC__ * 100 + __GNUC_MINOR__ >= 301 + /* GCC 3.1+ supports deprecated without message */ + #define XML_DEPRECATED __attribute__((deprecated)) #elif defined(_MSC_VER) && _MSC_VER >= 1400 /* Available since Visual Studio 2005 */ #define XML_DEPRECATED __declspec(deprecated("See https://gnome.pages.gitlab.gnome.org/libxml2/html/deprecated.html"))