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.
Created attachment 242822 [details] math/vtk9: fix build with clang 16
Approved. Please commit it.
A commit in branch main references this bug: 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 +- .../patch-ThirdParty_cgns_vtkcgns_src_adfh_ADFH.c (new) | 13 +++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-)