git: 98fd17ab866a - main - devel/py-ruamel.yaml.clib: fix build with clang 16

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Tue, 23 May 2023 14:16:18 UTC
The branch main has been updated by dim:

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

commit 98fd17ab866a916691388b5f6e801586329b9ba6
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-05-20 14:30:54 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-05-23 14:15:16 +0000

    devel/py-ruamel.yaml.clib: fix build with clang 16
    
    Clang 16 has a new error about incompatible function types, which shows
    up when building devel/py-ruamel.yaml.clib:
    
      _ruamel_yaml.c:3590:52: error: incompatible function pointer types passing 'int (void *, char *, int, int *)' to parameter of type 'yaml_read_handler_t *' (aka 'int (*)(void *, unsigned char *, unsigned long, unsigned long *)') [-Wincompatible-function-pointer-types]
          yaml_parser_set_input((&__pyx_v_self->parser), __pyx_f_12_ruamel_yaml_input_handler, ((void *)__pyx_v_self));
                                                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
      _ruamel_yaml.c:15301:53: error: incompatible function pointer types passing 'int (void *, char *, int)' to parameter of type 'yaml_write_handler_t *' (aka 'int (*)(void *, unsigned char *, unsigned long)') [-Wincompatible-function-pointer-types]
        yaml_emitter_set_output((&__pyx_v_self->emitter), __pyx_f_12_ruamel_yaml_output_handler, ((void *)__pyx_v_self));
                                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    It seems that _ruamel_yaml.c was originally generated from a rather old
    yaml.h interface header. I have looked upstream but it has not been
    updated there either, so for now patch the function signatures to match
    what is in our textproc/libyaml port.
    
    PR:             271531
    Approved by:    sunpoet (maintainer)
    MFH:            2023Q2
---
 devel/py-ruamel.yaml.clib/Makefile            |  1 +
 devel/py-ruamel.yaml.clib/files/patch-clang16 | 31 +++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/devel/py-ruamel.yaml.clib/Makefile b/devel/py-ruamel.yaml.clib/Makefile
index cc913627101e..1963baa995d2 100644
--- a/devel/py-ruamel.yaml.clib/Makefile
+++ b/devel/py-ruamel.yaml.clib/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	ruamel.yaml.clib
 PORTVERSION=	0.2.7
+PORTREVISION=	1
 CATEGORIES=	devel python
 MASTER_SITES=	PYPI
 PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
diff --git a/devel/py-ruamel.yaml.clib/files/patch-clang16 b/devel/py-ruamel.yaml.clib/files/patch-clang16
new file mode 100644
index 000000000000..c004325bd508
--- /dev/null
+++ b/devel/py-ruamel.yaml.clib/files/patch-clang16
@@ -0,0 +1,31 @@
+--- _ruamel_yaml.c.orig	2022-10-20 06:59:47 UTC
++++ _ruamel_yaml.c
+@@ -1553,8 +1553,8 @@ static PyTypeObject *__pyx_ptype_12_ruamel_yaml_CEmitt
+ static PyTypeObject *__pyx_ptype_12_ruamel_yaml_Mark = 0;
+ static PyTypeObject *__pyx_ptype_12_ruamel_yaml_CParser = 0;
+ static PyTypeObject *__pyx_ptype_12_ruamel_yaml_CEmitter = 0;
+-static int __pyx_f_12_ruamel_yaml_input_handler(void *, char *, int, int *); /*proto*/
+-static int __pyx_f_12_ruamel_yaml_output_handler(void *, char *, int); /*proto*/
++static int __pyx_f_12_ruamel_yaml_input_handler(void *, unsigned char *, size_t, size_t *); /*proto*/
++static int __pyx_f_12_ruamel_yaml_output_handler(void *, unsigned char *, size_t); /*proto*/
+ static PyObject *__pyx_f_12_ruamel_yaml___pyx_unpickle_Mark__set_state(struct __pyx_obj_12_ruamel_yaml_Mark *, PyObject *); /*proto*/
+ #define __Pyx_MODULE_NAME "_ruamel_yaml"
+ extern int __pyx_module_is_main__ruamel_yaml;
+@@ -14551,7 +14551,7 @@ static PyObject *__pyx_pf_12_ruamel_yaml_7CParser_30__
+  *     parser = <CParser>data
+  */
+ 
+-static int __pyx_f_12_ruamel_yaml_input_handler(void *__pyx_v_data, char *__pyx_v_buffer, int __pyx_v_size, int *__pyx_v_read) {
++static int __pyx_f_12_ruamel_yaml_input_handler(void *__pyx_v_data, unsigned char *__pyx_v_buffer, size_t __pyx_v_size, size_t *__pyx_v_read) {
+   struct __pyx_obj_12_ruamel_yaml_CParser *__pyx_v_parser = 0;
+   PyObject *__pyx_v_value = NULL;
+   int __pyx_r;
+@@ -23430,7 +23430,7 @@ static PyObject *__pyx_pf_12_ruamel_yaml_8CEmitter_16_
+  *     emitter = <CEmitter>data
+  */
+ 
+-static int __pyx_f_12_ruamel_yaml_output_handler(void *__pyx_v_data, char *__pyx_v_buffer, int __pyx_v_size) {
++static int __pyx_f_12_ruamel_yaml_output_handler(void *__pyx_v_data, unsigned char *__pyx_v_buffer, size_t __pyx_v_size) {
+   struct __pyx_obj_12_ruamel_yaml_CEmitter *__pyx_v_emitter = 0;
+   PyObject *__pyx_v_value = NULL;
+   int __pyx_r;