Make PostgreSQL work with newer libxml2.

From: Xing Guo <higuoxing(at)gmail(dot)com>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Make PostgreSQL work with newer libxml2.
Date: 2023-12-03 15:17:55
Message-ID: CACpMh+DMZVHM+iDSyqdcpK8sr7jd_HxxLJRNvGTzcLBE0W07QA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi hackers,

There is a breaking change of API since the v2.12.0 of libxml2[1][2]. My
compiler complains about incompatible function signatures:

/usr/bin/clang -Wall -Wmissing-prototypes -Wpointer-arith
-Wdeclaration-after-statement -Werror=vla
-Werror=unguarded-availability-new -Wendif-labels -Wmissing
-format-attribute -Wcast-function-type -Wformat-security
-fno-strict-aliasing -fwrapv -fexcess-precision=standard
-Wno-unused-command-line-argument -Wno-compou
nd-token-split-by-macro -Wno-cast-function-type-strict -g -Og -g3 -I. -I.
-I../../../../src/include -D_GNU_SOURCE -I/usr/include/libxml2 -c -o
xml.o xml.c
xml.c:1199:45: error: incompatible function pointer types passing 'void
(void *, xmlErrorPtr)' (aka 'void (void *, struct _xmlError *)') to
parameter of type '
xmlStructuredErrorFunc' (aka 'void (*)(void *, const struct _xmlError *)')
[-Wincompatible-function-pointer-types]
xmlSetStructuredErrorFunc((void *) errcxt, xml_errorHandler);
^~~~~~~~~~~~~~~~
/usr/include/libxml2/libxml/xmlerror.h:898:29: note: passing argument to
parameter 'handler' here
xmlStructuredErrorFunc handler);
^
xml.c:4806:55: error: incompatible function pointer types passing 'void
(void *, xmlErrorPtr)' (aka 'void (void *, struct _xmlError *)') to
parameter of type '
xmlStructuredErrorFunc' (aka 'void (*)(void *, const struct _xmlError *)')
[-Wincompatible-function-pointer-types]
xmlSetStructuredErrorFunc((void *) xtCxt->xmlerrcxt,
xml_errorHandler);

^~~~~~~~~~~~~~~~
/usr/include/libxml2/libxml/xmlerror.h:898:29: note: passing argument to
parameter 'handler' here
xmlStructuredErrorFunc handler);
^
xml.c:4860:55: error: incompatible function pointer types passing 'void
(void *, xmlErrorPtr)' (aka 'void (void *, struct _xmlError *)') to
parameter of type '
xmlStructuredErrorFunc' (aka 'void (*)(void *, const struct _xmlError *)')
[-Wincompatible-function-pointer-types]
xmlSetStructuredErrorFunc((void *) xtCxt->xmlerrcxt,
xml_errorHandler);

^~~~~~~~~~~~~~~~
/usr/include/libxml2/libxml/xmlerror.h:898:29: note: passing argument to
parameter 'handler' here
xmlStructuredErrorFunc handler);
^
xml.c:5003:55: error: incompatible function pointer types passing 'void
(void *, xmlErrorPtr)' (aka 'void (void *, struct _xmlError *)') to
parameter of type '
xmlStructuredErrorFunc' (aka 'void (*)(void *, const struct _xmlError *)')
[-Wincompatible-function-pointer-types]
xmlSetStructuredErrorFunc((void *) xtCxt->xmlerrcxt,
xml_errorHandler);

^~~~~~~~~~~~~~~~
/usr/include/libxml2/libxml/xmlerror.h:898:29: note: passing argument to
parameter 'handler' here
xmlStructuredErrorFunc handler);
^
4 errors generated.
make[4]: *** [<builtin>: xml.o] Error 1

Here is a quick workaround for it.

[1]
https://github.com/GNOME/libxml2/commit/61034116d0a3c8b295c6137956adc3ae55720711
[2]
https://github.com/GNOME/libxml2/commit/45470611b047db78106dcb2fdbd4164163c15ab7

Best Regards,
Xing

Attachment Content-Type Size
v1-0001-Make-PostgreSQL-work-with-newer-version-of-libxml.patch text/x-patch 1.7 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Davin Shearer 2023-12-03 15:31:58 Re: Emitting JSON to file using COPY TO
Previous Message Andrew Dunstan 2023-12-03 15:10:38 Re: Emitting JSON to file using COPY TO