Build failure with stricter C compilers (e.g. GCC 14)
Modern C compilers are becoming stricter with a variety of changes over the last year or so.
GCC 14 in particular (to be released in ~April 2024) fails to build libxslt-1.1.39's tests like:
/var/tmp/portage/dev-libs/libxslt-1.1.39/work/libxslt-1.1.39/tests/runtest.c: In function ‘initializeLibxml2’:
/var/tmp/portage/dev-libs/libxslt-1.1.39/work/libxslt-1.1.39/tests/runtest.c:459:37: error: passing argument 2 of ‘xmlSetStructuredErrorFunc’ from incompatible pointer type [-Wincompatible-pointer-types]
459 | xmlSetStructuredErrorFunc(NULL, testStructuredErrorHandler);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| void (*)(void *, const xmlError *) {aka void (*)(void *, const struct _xmlError *)}
In file included from /usr/include/libxml2/libxml/valid.h:15,
from /usr/include/libxml2/libxml/parser.h:17,
from /var/tmp/portage/dev-libs/libxslt-1.1.39/work/libxslt-1.1.39/tests/runtest.c:24:
/usr/include/libxml2/libxml/xmlerror.h:873:57: note: expected ‘xmlStructuredErrorFunc’ {aka ‘void (*)(void *, struct _xmlError *)’} but argument is of type ‘void (*)(void *, const xmlError *)’ {aka ‘void (*)(void *, const struct _xmlError *)’}
873 | xmlStructuredErrorFunc handler);
| ~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
make[3]: *** [Makefile:524: runtest.o] Error 1
make[3]: *** Waiting for unfinished jobs....
Originally reported downstream in Gentoo at https://bugs.gentoo.org/918973.
This can be emulated with -Werror=incompatible-pointer-types -Werror=implicit -Werror=int-conversion
on an older GCC or Clang.