gdraheim / zziplib

The ZZIPlib provides read access on ZIP-archives and unpacked data. It features an additional simplified API following the standard Posix API for file access
Other
64 stars 53 forks source link

Build failure with Clang 15 (`error: incompatible pointer to integer conversion initializing 'off_t' (aka 'long') with an expression of type 'zzip_byte_t *' (aka 'unsigned char *')`) #140

Closed thesamesam closed 9 months ago

thesamesam commented 2 years ago

Observed the following build failure when compiling zzlib-0.13.72 with Clang 15:

[18/66] /usr/lib/ccache/bin/clang -DHAVE_CONFIG_H -Dlibzzipmmapped_EXPORTS -I/var/tmp/portage/dev-libs/zziplib-0.13.72-r1/work/zziplib-0.13.72 -I/var/tmp/portage/dev-libs/zziplib-0.13.72-r1/work/zziplib-0.13.72_build  -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches     -ggdb3 -fno-strict-aliasing -fPIC -fcolor-diagnostics   -Wpointer-arith -Wsign-compare -Wmissing-declarations -Werror-implicit-function-declaration -Wstrict-aliasing -Warray-bounds -MD -MT zzip/CMakeFiles/libzzipmmapped.dir/mmapped.c.o -MF zzip/CMakeFiles/libzzipmmapped.dir/mmapped.c.o.d -o zzip/CMakeFiles/libzzipmmapped.dir/mmapped.c.o -c /var/tmp/portage/dev-libs/zziplib-0.13.72-r1/work/zziplib-0.13.72/zzip/mmapped.c
FAILED: zzip/CMakeFiles/libzzipmmapped.dir/mmapped.c.o
/usr/lib/ccache/bin/clang -DHAVE_CONFIG_H -Dlibzzipmmapped_EXPORTS -I/var/tmp/portage/dev-libs/zziplib-0.13.72-r1/work/zziplib-0.13.72 -I/var/tmp/portage/dev-libs/zziplib-0.13.72-r1/work/zziplib-0.13.72_build  -O2 -pipe -march=native -fdiagnostics-color=always -frecord-gcc-switches     -ggdb3 -fno-strict-aliasing -fPIC -fcolor-diagnostics   -Wpointer-arith -Wsign-compare -Wmissing-declarations -Werror-implicit-function-declaration -Wstrict-aliasing -Warray-bounds -MD -MT zzip/CMakeFiles/libzzipmmapped.dir/mmapped.c.o -MF zzip/CMakeFiles/libzzipmmapped.dir/mmapped.c.o.d -o zzip/CMakeFiles/libzzipmmapped.dir/mmapped.c.o -c /var/tmp/portage/dev-libs/zziplib-0.13.72-r1/work/zziplib-0.13.72/zzip/mmapped.c
/var/tmp/portage/dev-libs/zziplib-0.13.72-r1/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);
          ^        ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/var/tmp/portage/dev-libs/zziplib-0.13.72-r1/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 =
                                 ^
/var/tmp/portage/dev-libs/zziplib-0.13.72-r1/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 =
                                 ^
/var/tmp/portage/dev-libs/zziplib-0.13.72-r1/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.
$ clang --version
clang version 15.0.0
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/lib/llvm/15/bin

Full log: build.log

gdraheim commented 9 months ago

I have rewritten that mmapped.c section so it can not creep in anymore. - to be in next release.