Fix build with GCC 14 and libxml2 2.12.0

This commit is contained in:
Yaakov Selkowitz 2024-01-23 21:57:38 -05:00
parent 4c0280b8e6
commit 70ab2f6574
3 changed files with 79 additions and 0 deletions

37
postgresql-libxml2.patch Normal file
View File

@ -0,0 +1,37 @@
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 d3db75eb87..619f908c6d 100644
--- a/src/backend/utils/adt/xml.c
+++ b/src/backend/utils/adt/xml.c
@@ -124,7 +124,7 @@ static xmlParserInputPtr xmlPgEntityLoader(const char *URL, const char *ID,
xmlParserCtxtPtr ctxt);
static void xml_errsave(Node *escontext, PgXmlErrorContext *errcxt,
int sqlcode, const char *msg);
-static void xml_errorHandler(void *data, xmlErrorPtr error);
+static void xml_errorHandler(void *data, const xmlError *error);
static int errdetail_for_xml_code(int code);
static void chopStringInfoNewlines(StringInfo str);
static void appendStringInfoLineSeparator(StringInfo str);
@@ -2044,7 +2044,7 @@ xml_errsave(Node *escontext, PgXmlErrorContext *errcxt,
* 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;

View File

@ -0,0 +1,37 @@
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;

View File

@ -95,6 +95,8 @@ Patch9: postgresql-server-pg_config.patch
# rhbz#1940964 # rhbz#1940964
Patch10: postgresql-datalayout-mismatch-on-s390.patch Patch10: postgresql-datalayout-mismatch-on-s390.patch
Patch12: postgresql-no-libecpg.patch Patch12: postgresql-no-libecpg.patch
Patch13: postgresql-libxml2.patch
Patch14: postgresql15-libxml2.patch
# This macro is used for package names in the files section # This macro is used for package names in the files section
%if %?postgresql_default %if %?postgresql_default
@ -533,6 +535,7 @@ goal of accelerating analytics queries.
%endif %endif
%patch 9 -p1 %patch 9 -p1
%patch 10 -p1 %patch 10 -p1
%patch 13 -p1
%if ! %external_libpq %if ! %external_libpq
@ -549,6 +552,8 @@ tar xfj %{SOURCE3}
find . -type f -name Makefile -exec sed -i -e "s/SO_MAJOR_VERSION=\s\?\([0-9]\+\)/SO_MAJOR_VERSION= %{private_soname}-\1/" {} \; find . -type f -name Makefile -exec sed -i -e "s/SO_MAJOR_VERSION=\s\?\([0-9]\+\)/SO_MAJOR_VERSION= %{private_soname}-\1/" {} \;
%endif %endif
%patch 14 -p1 -d postgresql-%{prevversion}
# apply once SOURCE3 is extracted # apply once SOURCE3 is extracted
%endif %endif