Thread: Make PostgreSQL work with newer libxml2.
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
-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.
Best Regards,
Xing