Fixes for GCC 14 and libxml2 2.12.0 "error: Make more xmlError structs constant" xml.c: In function ‘pg_xml_init’: xml.c:1177:52: error: passing argument 2 of ‘xmlSetStructuredErrorFunc’ from incompatible pointer type [-Wincompatible-pointer-types] 1177 | xmlSetStructuredErrorFunc((void *) errcxt, xml_errorHandler); | ^~~~~~~~~~~~~~~~ | | | void (*)(void *, xmlError *) {aka void (*)(void *, struct _xmlError *)} In file included from /usr/include/libxml2/libxml/valid.h:15, from /usr/include/libxml2/libxml/parser.h:19, from xml.c:50: /usr/include/libxml2/libxml/xmlerror.h:898:57: note: expected ‘xmlStructuredErrorFunc’ {aka ‘void (*)(void *, const struct _xmlError *)’} but argument is of type ‘void (*)(void *, xmlError *)’ {aka ‘void (*)(void *, struct _xmlError *)’} 898 | xmlStructuredErrorFunc handler); | ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~ diff --git a/src/backend/utils/adt/xml.c b/src/backend/utils/adt/xml.c index 6411f56b99..0eb39fcfc2 100644 --- a/src/backend/utils/adt/xml.c +++ b/src/backend/utils/adt/xml.c @@ -119,7 +119,7 @@ struct PgXmlErrorContext static xmlParserInputPtr xmlPgEntityLoader(const char *URL, const char *ID, xmlParserCtxtPtr ctxt); -static void xml_errorHandler(void *data, xmlErrorPtr error); +static void xml_errorHandler(void *data, const xmlError *error); static void xml_ereport_by_code(int level, int sqlcode, const char *msg, int errcode); static void chopStringInfoNewlines(StringInfo str); @@ -1749,7 +1749,7 @@ xml_ereport(PgXmlErrorContext *errcxt, int level, int sqlcode, const char *msg) * Error handler for libxml errors and warnings */ static void -xml_errorHandler(void *data, xmlErrorPtr error) +xml_errorHandler(void *data, const xmlError *error) { PgXmlErrorContext *xmlerrcxt = (PgXmlErrorContext *) data; xmlParserCtxtPtr ctxt = (xmlParserCtxtPtr) error->ctxt;