Skip to content

Commit

Permalink
textproc/p5-XML-LibXML: fix build with clang 16
Browse files Browse the repository at this point in the history
Clang 16 has a new error about incompatible function types, which shows
up when building textproc/p5-XML-LibXML:

  perl-libxml-mm.c:142:18: error: incompatible function pointer types passing 'void (void *, void *, xmlChar *)' (aka 'void (void *, void *, unsigned char *)') to parameter of type 'xmlHashScanner' (aka 'void (*)(void *, void *, const unsigned char *)') [-Wincompatible-function-pointer-types]
                  xmlHashScan(r, PmmRegistryDumpHashScanner, NULL);
                                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
  /usr/local/include/libxml2/libxml/hash.h:213:22: note: passing argument to parameter 'f' here
                                           xmlHashScanner f,
                                                          ^
  perl-libxml-mm.c:234:44: error: incompatible function pointer types passing 'void (void *, xmlChar *)' (aka 'void (void *, unsigned char *)') to parameter of type 'xmlHashDeallocator' (aka 'void (*)(void *, const unsigned char *)') [-Wincompatible-function-pointer-types]
          if( xmlHashRemoveEntry(PmmREGISTRY, name, PmmRegistryHashDeallocator) )
                                                    ^~~~~~~~~~~~~~~~~~~~~~~~~~
  /usr/local/include/libxml2/libxml/hash.h:160:47: note: passing argument to parameter 'f' here
                             xmlHashDeallocator f);
                                                ^
  perl-libxml-mm.c:301:38: error: incompatible function pointer types passing 'void *(void *, xmlChar *)' (aka 'void *(void *, unsigned char *)') to parameter of type 'xmlHashCopier' (aka 'void *(*)(void *, const unsigned char *)') [-Wincompatible-function-pointer-types]
          reg_copy = xmlHashCopy(PmmREGISTRY, PmmRegistryHashCopier);
                                              ^~~~~~~~~~~~~~~~~~~~~
  /usr/local/include/libxml2/libxml/hash.h:208:21: note: passing argument to parameter 'f' here
                                           xmlHashCopier f);
                                                         ^

In all three cases, the libxml2 callback functions require const xmlChar
pointers, so fix the parameters in their definitions.

PR:		271355
Approved by:	portmgr (build fix blanket)
MFH:		2023Q2
  • Loading branch information
DimitryAndric committed May 18, 2023
1 parent 967c804 commit ea9006c
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 0 deletions.
1 change: 1 addition & 0 deletions textproc/p5-XML-LibXML/Makefile
@@ -1,5 +1,6 @@
PORTNAME= XML-LibXML
PORTVERSION= 2.0208
PORTREVISION= 1
PORTEPOCH= 1
CATEGORIES= textproc perl5
MASTER_SITES= CPAN
Expand Down
29 changes: 29 additions & 0 deletions textproc/p5-XML-LibXML/files/patch-perl-libxml-mm.c
@@ -0,0 +1,29 @@
--- perl-libxml-mm.c.orig 2022-09-21 16:57:45 UTC
+++ perl-libxml-mm.c
@@ -121,7 +121,7 @@ extern SV* PROXY_NODE_REGISTRY_MUTEX;
extern SV* PROXY_NODE_REGISTRY_MUTEX;

/* Utility method used by PmmDumpRegistry */
-void PmmRegistryDumpHashScanner(void * payload, void * data, xmlChar * name)
+void PmmRegistryDumpHashScanner(void * payload, void * data, const xmlChar * name)
{
LocalProxyNodePtr lp = (LocalProxyNodePtr) payload;
ProxyNodePtr node = (ProxyNodePtr) lp->proxy;
@@ -215,7 +215,7 @@ static void
/* PP: originally this was static inline void, but on AIX the compiler
did not chew it, so I'm removing the inline */
static void
-PmmRegistryHashDeallocator(void *payload, xmlChar *name)
+PmmRegistryHashDeallocator(void *payload, const xmlChar *name)
{
Safefree((LocalProxyNodePtr) payload);
}
@@ -279,7 +279,7 @@ void *
* internal, used by PmmCloneProxyNodes
*/
void *
-PmmRegistryHashCopier(void *payload, xmlChar *name)
+PmmRegistryHashCopier(void *payload, const xmlChar *name)
{
ProxyNodePtr proxy = ((LocalProxyNodePtr) payload)->proxy;
LocalProxyNodePtr lp;

0 comments on commit ea9006c

Please sign in to comment.