git: 8c1a570ba56e - main - math/vtk9: fix build with clang 16

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Sat, 17 Jun 2023 15:25:06 UTC
The branch main has been updated by dim:

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

commit 8c1a570ba56ecb0ed8714b81241b1858058d156f
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-06-17 12:23:00 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-06-17 15:24:55 +0000

    math/vtk9: fix build with clang 16
    
    Clang 16 has a new error about incompatible function types, which shows
    up when building math/vtk9:
    
      /wrkdirs/usr/ports/math/vtk9/work/VTK-9.2.2/ThirdParty/cgns/vtkcgns/src/adfh/ADFH.c:1274:93: error: incompatible function pointer types passing 'herr_t (hid_t, const char *, const H5L_info1_t *, void *)' (aka 'int (long, const char *, const H5L_info1_t *, void *)') to parameter of type 'H5L_iterate2_t' (aka 'int (*)(long, const char *, const H5L_info2_t *, void *)') [-Wincompatible-function-pointer-types]
          if (! is_link(id)) H5Literate_by_name2(id, name, H5_INDEX_CRT_ORDER, H5_ITER_INC, NULL, delete_children, data, H5P_DEFAULT);
                                                                                                  ^~~~~~~~~~~~~~~
      /usr/local/include/H5Lpublic.h:992:87: note: passing argument to parameter 'op' here
                                        H5_iter_order_t order, hsize_t *idx, H5L_iterate2_t op, void *op_data,
                                                                                            ^
      /wrkdirs/usr/ports/math/vtk9/work/VTK-9.2.2/ThirdParty/cgns/vtkcgns/src/adfh/ADFH.c:1434:64: error: incompatible function pointer types passing 'herr_t (hid_t, const char *, const H5L_info1_t *, void *)' (aka 'int (long, const char *, const H5L_info1_t *, void *)') to parameter of type 'H5L_iterate2_t' (aka 'int (*)(long, const char *, const H5L_info2_t *, void *)') [-Wincompatible-function-pointer-types]
          H5Literate2(gid, H5_INDEX_CRT_ORDER, H5_ITER_NATIVE, NULL, fix_dimensions, NULL);
                                                                     ^~~~~~~~~~~~~~
      /usr/local/include/H5Lpublic.h:926:42: note: passing argument to parameter 'op' here
                                H5L_iterate2_t op, void *op_data);
                                               ^
    
    and a bunch more of these. The problem is that the H5Literate_by_name2()
    function (from /usr/local/include/H5Lpublic.h) is being called with an
    incorrect argument for the "op" parameter, which should be of type
    "H5L_iterate2_t" instead. In turn, "H5L_iterate2_t" is a function type,
    and requires the function's "info" parameter to be of type "const
    H5L_info2_t *".
    
    Redefine "H5L_info_t" to mean "H5L_info2_t" to work around this problem,
    otherwise a lot of function definitions would have to be adjusted.
    
    PR:             272037
    Approved by:    yuri (maintainer)
    MFH:            2023Q2
---
 math/vtk9/Makefile                                          |  2 +-
 .../files/patch-ThirdParty_cgns_vtkcgns_src_adfh_ADFH.c     | 13 +++++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git a/math/vtk9/Makefile b/math/vtk9/Makefile
index d04d22191888..34368e2814ff 100644
--- a/math/vtk9/Makefile
+++ b/math/vtk9/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	vtk
 DISTVERSION=	9.2.2
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES=	math graphics
 MASTER_SITES=	https://vtk.org/files/release/${VTK_SHORT_VER}/
 PKGNAMESUFFIX=	9
diff --git a/math/vtk9/files/patch-ThirdParty_cgns_vtkcgns_src_adfh_ADFH.c b/math/vtk9/files/patch-ThirdParty_cgns_vtkcgns_src_adfh_ADFH.c
new file mode 100644
index 000000000000..908a0098eced
--- /dev/null
+++ b/math/vtk9/files/patch-ThirdParty_cgns_vtkcgns_src_adfh_ADFH.c
@@ -0,0 +1,13 @@
+--- ThirdParty/cgns/vtkcgns/src/adfh/ADFH.c.orig	2022-10-02 11:37:19 UTC
++++ ThirdParty/cgns/vtkcgns/src/adfh/ADFH.c
+@@ -287,6 +287,10 @@ if (mta_root == NULL){set_error(ADFH_ERR_ROOTNULL, err
+ #define CMP_OINFO(r,n) ((r)->fileno==(n)->fileno && \
+                         (r)->addr==(n)->addr && (r)->addr != HADDR_UNDEF)
+ 
++#if H5_VERSION_GE(1,12,0)
++#undef H5L_info_t
++#define H5L_info_t H5L_info2_t
++#endif
+ 
+ static herr_t gfind_by_name(hid_t, const char *, const H5L_info_t*, void *);
+ static herr_t find_by_name(hid_t, const char *, const H5A_info_t*, void *);