Bug 268185 - devel/zziplib: Fix build with clang 15
Summary: devel/zziplib: 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: Po-Chuan Hsieh
URL:
Keywords:
Depends on:
Blocks: 265425
  Show dependency treegraph
 
Reported: 2022-12-05 22:55 UTC by Dimitry Andric
Modified: 2022-12-18 17:47 UTC (History)
1 user (show)

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


Attachments
devel/zziplib: fix build with clang 15 (3.52 KB, patch)
2022-12-05 22:57 UTC, Dimitry Andric
no flags Details | Diff
devel/zziplib: fix build with clang 15 (3.20 KB, patch)
2022-12-06 12:17 UTC, Dimitry Andric
no flags Details | Diff
devel/zziplib: fix build with clang 15 (2.72 KB, patch)
2022-12-10 11:27 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-05 22:55:23 UTC
During an exp-run for llvm 15 (see bug 265425), it turned out that devel/zziplib failed to build with clang (and lld) 15:

/wrkdirs/usr/ports/devel/zziplib/work/zziplib-0.13.72/zzip/mmapped.c:664:11: error: incompatible pointer to integer conversion initializing 'off_t' (aka 'long') with an expression of type 'zzip_byte_t *' (aka 'unsigned char *') [-Wint-conversion]
    off_t offset = zzip_file_header_to_data(header);
          ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/wrkdirs/usr/ports/devel/zziplib/work/zziplib-0.13.72/zzip/mmapped.c:666:34: warning: incompatible pointer types initializing 'struct zzip_extra_zip64 *' with an expression of type 'char *' [-Wincompatible-pointer-types]
        struct zzip_extra_zip64* zip64 =
                                 ^
/wrkdirs/usr/ports/devel/zziplib/work/zziplib-0.13.72/zzip/mmapped.c:673:34: warning: incompatible pointer types initializing 'struct zzip_extra_zip64 *' with an expression of type 'char *' [-Wincompatible-pointer-types]
        struct zzip_extra_zip64* zip64 =
                                 ^
/wrkdirs/usr/ports/devel/zziplib/work/zziplib-0.13.72/zzip/mmapped.c:685:24: error: incompatible integer to pointer conversion assigning to 'Bytef *' (aka 'unsigned char *') from 'off_t' (aka 'long') [-Wint-conversion]
    file->zlib.next_in = offset;
                       ^ ~~~~~~
2 warnings and 2 errors generated.

Indeed, at several points it is needed to cast the returned pointers to off_t, or vice versa.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2022-12-05 22:57:14 UTC
Created attachment 238559 [details]
devel/zziplib: fix build with clang 15
Comment 2 Dimitry Andric freebsd_committer freebsd_triage 2022-12-06 12:17:31 UTC
Created attachment 238569 [details]
devel/zziplib: fix build with clang 15

Update patch to remove revision bump.
Comment 4 Dimitry Andric freebsd_committer freebsd_triage 2022-12-10 11:27:32 UTC
Created attachment 238689 [details]
devel/zziplib: fix build with clang 15

Use patch from https://github.com/gdraheim/zziplib/issues/140 instead.
Comment 5 commit-hook freebsd_committer freebsd_triage 2022-12-18 17:44:31 UTC
A commit in branch main references this bug:

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

commit 76a985cab04d771c8446662c310fe2261e722fac
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2022-12-05 22:55:48 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2022-12-18 17:22:14 +0000

    devel/zziplib: fix build with clang 15

    During an exp-run for llvm 15 (see bug 265425), it turned out that
    devel/zziplib failed to build with clang (and lld) 15:

    /wrkdirs/usr/ports/devel/zziplib/work/zziplib-0.13.72/zzip/mmapped.c:664:11: error: incompatible pointer to integer conversion initializing 'off_t' (aka 'long') with an expression of type 'zzip_byte_t *' (aka 'unsigned char *') [-Wint-conversion]
        off_t offset = zzip_file_header_to_data(header);
              ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /wrkdirs/usr/ports/devel/zziplib/work/zziplib-0.13.72/zzip/mmapped.c:666:34: warning: incompatible pointer types initializing 'struct zzip_extra_zip64 *' with an expression of type 'char *' [-Wincompatible-pointer-types]
            struct zzip_extra_zip64* zip64 =
                                     ^
    /wrkdirs/usr/ports/devel/zziplib/work/zziplib-0.13.72/zzip/mmapped.c:673:34: warning: incompatible pointer types initializing 'struct zzip_extra_zip64 *' with an expression of type 'char *' [-Wincompatible-pointer-types]
            struct zzip_extra_zip64* zip64 =
                                     ^
    /wrkdirs/usr/ports/devel/zziplib/work/zziplib-0.13.72/zzip/mmapped.c:685:24: error: incompatible integer to pointer conversion assigning to 'Bytef *' (aka 'unsigned char *') from 'off_t' (aka 'long') [-Wint-conversion]
        file->zlib.next_in = offset;
                           ^ ~~~~~~
    2 warnings and 2 errors generated.

    Use the patch from https://github.com/gdraheim/zziplib/issues/140 to fix
    the errors.

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

 devel/zziplib/files/patch-zzip_mmapped.c (new) | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)