From 7708713b634eb2f72ffe484b565a5a87f58e8cb3 Mon Sep 17 00:00:00 2001 From: Mostyn Bramley-Moore Date: Thu, 2 Jan 2025 00:30:37 +0100 Subject: [PATCH] Suppress macOS CC_MD5_* deprecation warnings in the autoconf build too (#2473) This also limits the amount of code where deprecation warnings are suppressed. Previously these warnings were only suppressed in the cmake build. --- CMakeLists.txt | 5 ----- libarchive/archive_digest.c | 11 +++++++++++ 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 036aab30c..ec65e8365 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2200,11 +2200,6 @@ IF(MSVC) ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE) ENDIF(MSVC) -IF(APPLE) - # CC_MD5_Init() functions are deprecated on macOS 10.15, but we want to use them - ADD_DEFINITIONS(-Wno-deprecated-declarations) -ENDIF(APPLE) - OPTION(DONT_FAIL_ON_CRC_ERROR "Ignore CRC errors during parsing (For fuzzing)" OFF) IF(DONT_FAIL_ON_CRC_ERROR) ADD_DEFINITIONS(-DDONT_FAIL_ON_CRC_ERROR=1) diff --git a/libarchive/archive_digest.c b/libarchive/archive_digest.c index 3776831b2..335187408 100644 --- a/libarchive/archive_digest.c +++ b/libarchive/archive_digest.c @@ -196,6 +196,13 @@ __archive_md5final(archive_md5_ctx *ctx, void *md) #elif defined(ARCHIVE_CRYPTO_MD5_LIBSYSTEM) +// These functions are available in macOS 10.4 and later, but deprecated from 10.15 onwards. +// We need to continue supporting this feature regardless, so suppress the warnings. +#if defined(__clang__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif + static int __archive_md5init(archive_md5_ctx *ctx) { @@ -218,6 +225,10 @@ __archive_md5final(archive_md5_ctx *ctx, void *md) return (ARCHIVE_OK); } +#if defined(__clang__) +#pragma clang diagnostic pop +#endif + #elif defined(ARCHIVE_CRYPTO_MD5_MBEDTLS) static int -- 2.47.3