git: 7e59982ac623 - main - x11-fonts/afdko: Fix build with Clang 16 and remove the workaround

From: Po-Chuan Hsieh <sunpoet_at_FreeBSD.org>
Date: Sun, 09 Jul 2023 21:37:38 UTC
The branch main has been updated by sunpoet:

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

commit 7e59982ac623f96767eabe6e4ddc8b2e578f940a
Author:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
AuthorDate: 2023-07-09 21:23:39 +0000
Commit:     Po-Chuan Hsieh <sunpoet@FreeBSD.org>
CommitDate: 2023-07-09 21:34:20 +0000

    x11-fonts/afdko: Fix build with Clang 16 and remove the workaround
    
    /wrkdirs/usr/ports/x11-fonts/afdko/work/afdko-3.9.6/c/shared/source/tx_shared/tx_shared.c:526:20: error: incompatible function pointer types assigning to 'size_t (*)(ctlStreamCallbacks *, void *, char **)' (aka 'unsigned long (*)(struct ctlStreamCallbacks_ *, void *, char **)') from 'size_t (ctlStreamCallbacks *, Stream *, char **)' (aka 'unsigned long (struct ctlStreamCallbacks_ *, Stream *, char **)') [-Wincompatible-function-pointer-types]
        h->cb.stm.read = stm_read;
                       ^ ~~~~~~~~
    /wrkdirs/usr/ports/x11-fonts/afdko/work/afdko-3.9.6/c/shared/source/tx_shared/tx_shared.c:527:24: error: incompatible function pointer types assigning to 'size_t (*)(ctlStreamCallbacks *, void *, xmlDocPtr *)' (aka 'unsigned long (*)(struct ctlStreamCallbacks_ *, void *, struct _xmlDoc **)') from 'size_t (ctlStreamCallbacks *, Stream *, xmlDocPtr *)' (aka 'unsigned long (struct ctlStreamCallbacks_ *, Stream *, struct _xmlDoc **)') [-Wincompatible-function-pointer-types]
        h->cb.stm.xml_read = stm_xml_read;
                           ^ ~~~~~~~~~~~~
    2 errors generated.
---
 x11-fonts/afdko/Makefile            |  6 ------
 x11-fonts/afdko/files/patch-clang16 | 13 +++++++++++++
 2 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/x11-fonts/afdko/Makefile b/x11-fonts/afdko/Makefile
index 6d3064c76d80..2ace93500dbb 100644
--- a/x11-fonts/afdko/Makefile
+++ b/x11-fonts/afdko/Makefile
@@ -14,10 +14,4 @@ USE_GNOME=	libxml2
 
 CMAKE_OFF=	SKBUILD
 
-.include <bsd.port.options.mk>
-
-.if ${OPSYS} == FreeBSD && ${OSVERSION} >= 1400091
-CFLAGS+=	-Wno-error=incompatible-function-pointer-types
-.endif
-
 .include <bsd.port.mk>
diff --git a/x11-fonts/afdko/files/patch-clang16 b/x11-fonts/afdko/files/patch-clang16
new file mode 100644
index 000000000000..63fb8afe7412
--- /dev/null
+++ b/x11-fonts/afdko/files/patch-clang16
@@ -0,0 +1,13 @@
+--- c/shared/source/tx_shared/tx_shared.c.orig	2023-06-13 21:30:33 UTC
++++ c/shared/source/tx_shared/tx_shared.c
+@@ -523,8 +523,8 @@ void stmInit(txCtx h) {
+     h->cb.stm.open = stm_open;
+     h->cb.stm.seek = stm_seek;
+     h->cb.stm.tell = stm_tell;
+-    h->cb.stm.read = stm_read;
+-    h->cb.stm.xml_read = stm_xml_read;
++    h->cb.stm.read = (size_t (*)(ctlStreamCallbacks *, void *, char **)) stm_read;
++    h->cb.stm.xml_read = (size_t (*)(ctlStreamCallbacks *, void *, xmlDocPtr *)) stm_xml_read;
+     h->cb.stm.write = stm_write;
+     h->cb.stm.status = stm_status;
+     h->cb.stm.close = stm_close;