git: ea9006c8e8ff - main - textproc/p5-XML-LibXML: fix build with clang 16

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Thu, 18 May 2023 11:41:05 UTC
The branch main has been updated by dim:

URL: https://cgit.FreeBSD.org/ports/commit/?id=ea9006c8e8ff30532f8ebd66d850cc6b2b8701b7

commit ea9006c8e8ff30532f8ebd66d850cc6b2b8701b7
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-05-10 19:19:33 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-05-18 11:36:36 +0000

    textproc/p5-XML-LibXML: fix build with clang 16
    
    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
---
 textproc/p5-XML-LibXML/Makefile                    |  1 +
 .../p5-XML-LibXML/files/patch-perl-libxml-mm.c     | 29 ++++++++++++++++++++++
 2 files changed, 30 insertions(+)

diff --git a/textproc/p5-XML-LibXML/Makefile b/textproc/p5-XML-LibXML/Makefile
index 6fac2543f6b2..1b07bd0927bd 100644
--- a/textproc/p5-XML-LibXML/Makefile
+++ b/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
diff --git a/textproc/p5-XML-LibXML/files/patch-perl-libxml-mm.c b/textproc/p5-XML-LibXML/files/patch-perl-libxml-mm.c
new file mode 100644
index 000000000000..ad6f7f1d6489
--- /dev/null
+++ b/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;