Bug 272037 - math/vtk9: fix build with clang 16
Summary: math/vtk9: fix build with clang 16
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Dimitry Andric
URL:
Keywords:
Depends on:
Blocks: 271047
  Show dependency treegraph
 
Reported: 2023-06-17 12:31 UTC by Dimitry Andric
Modified: 2023-06-17 15:27 UTC (History)
0 users

See Also:
yuri: maintainer-feedback+


Attachments
math/vtk9: fix build with clang 16 (3.38 KB, patch)
2023-06-17 12:32 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2023-06-17 12:31:54 UTC
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.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2023-06-17 12:32:14 UTC
Created attachment 242822 [details]
math/vtk9: fix build with clang 16
Comment 2 Yuri Victorovich freebsd_committer freebsd_triage 2023-06-17 14:26:11 UTC
Approved.

Please commit it.
Comment 3 commit-hook freebsd_committer freebsd_triage 2023-06-17 15:25:53 UTC
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(-)