Bug 268278 - graphics/py-pygraphviz: fix build with clang 15
Summary: graphics/py-pygraphviz: fix build with clang 15
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: freebsd-python (Nobody)
URL:
Keywords:
Depends on:
Blocks: 265425
  Show dependency treegraph
 
Reported: 2022-12-09 18:16 UTC by Dimitry Andric
Modified: 2022-12-18 17:48 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (python)


Attachments
graphics/py-pygraphviz: fix build with clang 15 (2.73 KB, patch)
2022-12-09 18:17 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 2022-12-09 18:16:10 UTC
During an exp-run for llvm 15 (see bug 265425), it turned out that graphics/py-pygraphviz failed to build with clang 15:

  pygraphviz/graphviz_wrap.c:3047:12: error: incompatible pointer to integer conversion returning 'Agsym_t *' (aka 'struct Agsym_s *') from a function with result type 'int' [-Wint-conversion]
      return agattr(g, kind, name, val);
             ^~~~~~~~~~~~~~~~~~~~~~~~~~
  1 error generated.

In graphviz.i and the swig-generated graphviz_wrap.c, the agattr_label() function is incorrectly labeled as returning 'int', while it should return 'Agsym_t *' instead. Upstream fixed this as part of a much bigger commit [1], and they also regenerated the swig wrapper.

For our case, it is simpler to patch the wrapper instead, as otherwise you would have to add swig as a build-time dependency.

[1] https://github.com/pygraphviz/pygraphviz/commit/79fdee178785620b90241c70a0efab9dd57e3c86
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2022-12-09 18:17:16 UTC
Created attachment 238669 [details]
graphics/py-pygraphviz: fix build with clang 15
Comment 2 commit-hook freebsd_committer freebsd_triage 2022-12-18 17:44:25 UTC
A commit in branch main references this bug:

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

commit f2f3ab67ff127029f70393a05f2f8e560d70ccb4
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-12-09 17:41:55 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-12-18 17:29:15 +0000

    graphics/py-pygraphviz: fix build with clang 15

    During an exp-run for llvm 15 (see bug 265425), it turned out that
    graphics/py-pygraphviz failed to build with clang 15:

      pygraphviz/graphviz_wrap.c:3047:12: error: incompatible pointer to integer conversion returning 'Agsym_t *' (aka 'struct Agsym_s *') from a function with result type 'int' [-Wint-conversion]
          return agattr(g, kind, name, val);
                 ^~~~~~~~~~~~~~~~~~~~~~~~~~
      1 error generated.

    In graphviz.i and the swig-generated graphviz_wrap.c, the agattr_label()
    function is incorrectly labeled as returning 'int', while it should
    return 'Agsym_t *' instead. Upstream fixed this as part of a much bigger
    commit [1], and they also regenerated the swig wrapper.

    For our case, it is simpler to patch the wrapper instead, as otherwise
    you would have to add swig as a build-time dependency.

    [1] https://github.com/pygraphviz/pygraphviz/commit/79fdee178785620b90241c70a0efab9dd57e3c86

    PR:             268278
    Approved by:    portmgr (tcberner)
    MFH:            2022Q4

 .../files/patch-pygraphviz_graphviz__wrap.c (new)  | 36 ++++++++++++++++++++++
 1 file changed, 36 insertions(+)