From d9af6f896accf755fa1ef486cf128fdf66314213 Mon Sep 17 00:00:00 2001 From: pmqs Date: Mon, 26 Feb 2024 15:20:07 +0000 Subject: [PATCH] #31 Fix build failure with "c++-compat" warnings --- .github/workflows/linux.yml | 8 +++++++- Zlib.xs | 2 +- zlib-src/zconf.h | 6 +++--- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml index ef8a982..954b9ad 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/linux.yml @@ -30,11 +30,16 @@ jobs: - '5.10' - '5.8' - '5.6' + build-zlib: - 0 - 1 - name: Perl ${{ matrix.perl }} BUILD_ZLIB:${{matrix.build-zlib}} + cc-opts: + - "" + - "-Wc++-compat" + + name: Perl ${{ matrix.perl }} BUILD_ZLIB:${{matrix.build-zlib}} ${{matrix.cc-opts}} steps: - uses: actions/checkout@v4 - name: Setup perl @@ -49,5 +54,6 @@ jobs: run: perl Makefile.PL && make env: BUILD_ZLIB: ${{matrix.build-zlib}} + PERL_MM_OPT: CCFLAGS="-Werror ${{matrix.cc-opts}}" - name: Test run: make test diff --git a/Zlib.xs b/Zlib.xs index 22467ef..c9a07a7 100644 --- a/Zlib.xs +++ b/Zlib.xs @@ -656,7 +656,7 @@ voidpf my_zcalloc (voidpf opaque, unsigned items, unsigned size) PERL_UNUSED_VAR(opaque); /* TODO - put back to calloc */ /* return safecalloc(items, size); */ - return safemalloc(items* size); + return (voidpf)safemalloc(items* size); } diff --git a/zlib-src/zconf.h b/zlib-src/zconf.h index 46a305f..703b7ef 100644 --- a/zlib-src/zconf.h +++ b/zlib-src/zconf.h @@ -408,12 +408,12 @@ typedef uLong FAR uLongf; #ifdef STDC typedef void const *voidpc; - typedef void FAR *voidpf; + typedef Bytef *voidpf; typedef Bytef *voidp; #else typedef Byte const *voidpc; - typedef Byte FAR *voidpf; - typedef Byte *voidp; + typedef Bytef *voidpf; + typedef Bytef *voidp; #endif #if !defined(Z_U4) && !defined(Z_SOLO) && defined(STDC)