From: Cameron Cawley Date: Thu, 25 Sep 2025 13:59:10 +0000 (+0100) Subject: Fix -Wunused-command-line-argument warnings on Mac OS X X-Git-Tag: 2.3.0-rc1~22 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=aa544c0181d01ce7d47deac2ebf9bb674687e6ff;p=thirdparty%2Fzlib-ng.git Fix -Wunused-command-line-argument warnings on Mac OS X --- diff --git a/CMakeLists.txt b/CMakeLists.txt index f2d03979..d1633646 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -405,6 +405,10 @@ if(APPLE) if(HAVE_W_ERROR_UNGUARDED_AVAILABILITY_NEW) set(ADDITIONAL_CHECK_FLAGS "${ADDITIONAL_CHECK_FLAGS} -Werror=unguarded-availability-new") endif() + check_c_compiler_flag(-Werror=unused-command-line-argument HAVE_W_ERROR_UNUSED_COMMAND_LINE_ARGUMENT) + if(HAVE_W_ERROR_UNUSED_COMMAND_LINE_ARGUMENT) + set(ADDITIONAL_CHECK_FLAGS "${ADDITIONAL_CHECK_FLAGS} -Werror=unused-command-line-argument") + endif() endif() # @@ -520,7 +524,9 @@ endif() # # Check whether compiler supports -fno-semantic-interposition parameter # +set(CMAKE_REQUIRED_FLAGS "${ADDITIONAL_CHECK_FLAGS}") check_c_compiler_flag(-fno-semantic-interposition HAVE_NO_INTERPOSITION) +set(CMAKE_REQUIRED_FLAGS) # # Check if we can hide zlib internal symbols that are linked between separate source files using hidden diff --git a/configure b/configure index 76176de7..0a7cbfcf 100755 --- a/configure +++ b/configure @@ -679,6 +679,18 @@ else echo "Checking for -Werror=unguarded-availability-new... No." | tee -a configure.log fi +# Check for -Werror=unused-command-line-argument compiler support +echo "" > test.c + cat > $test.c <> configure.log 2>&1; then + echo "Checking for -Werror=unused-command-line-argument... Yes." | tee -a configure.log + ADDITIONAL_CHECK_FLAGS="$ADDITIONAL_CHECK_FLAGS -Werror=unused-command-line-argument" +else + echo "Checking for -Werror=unused-command-line-argument... No." | tee -a configure.log +fi + # check for version script support cat > $test.c < test.c cat > $test.c <> configure.log 2>&1; then +if test "$gcc" -eq 1 && ($cc $CFLAGS $ADDITIONAL_CHECK_FLAGS -fno-semantic-interposition -c $test.c) >> configure.log 2>&1; then echo "Checking for -fno-semantic-interposition... Yes." | tee -a configure.log SFLAGS="$SFLAGS -fno-semantic-interposition" else