From 72c97699536f615406b7faa08e840eb9ddc0bc25 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Wed, 8 May 2024 22:22:13 +0200 Subject: [PATCH] src: avoid warnings when compiling with llvm-mingw-nightly --- src/compress/compress_lzma.cpp | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/compress/compress_lzma.cpp b/src/compress/compress_lzma.cpp index 0dd22a0b..e4e047d1 100644 --- a/src/compress/compress_lzma.cpp +++ b/src/compress/compress_lzma.cpp @@ -37,9 +37,6 @@ #if (ACC_CC_MSC) #pragma warning(disable : 4456) // -Wno-shadow #endif -#if (ACC_CC_MSC && (_MSC_VER < 1900)) -#pragma warning(disable : 4127) // warning C4127: conditional expression is constant -#endif void lzma_compress_config_t::reset() noexcept { pos_bits.reset(); @@ -206,15 +203,12 @@ error: // compress - cruft because of pseudo-COM layer **************************************************************************/ -// ensure proper nullptr usage -// TODO later: examine why we need this in the first place -#undef NULL -// NOLINTBEGIN(clang-analyzer-optin.cplusplus.*) -#define NULL nullptr -// NOLINTEND(clang-analyzer-optin.cplusplus.*) -#if defined(__GNUC__) -#undef __null -#define __null nullptr +#if (ACC_CC_CLANG >= 0x080000) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wzero-as-null-pointer-constant" +#elif (ACC_CC_GNUC >= 0x040700) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wzero-as-null-pointer-constant" #endif #undef MSDOS @@ -316,6 +310,12 @@ STDMETHODIMP ProgressInfo::SetRatioInfo(const UInt64 *inSize, const UInt64 *outS #include #undef RC_NORMALIZE +#if (ACC_CC_CLANG >= 0x080000) +#pragma clang diagnostic pop +#elif (ACC_CC_GNUC >= 0x040700) +#pragma GCC diagnostic pop +#endif + int upx_lzma_compress(const upx_bytep src, unsigned src_len, upx_bytep dst, unsigned *dst_len, upx_callback_t *cb, int method, int level, const upx_compress_config_t *cconf_parm, upx_compress_result_t *cresult) {