From bfb06365b3b5b1c83bde3ca84fe3e58c5dbd7cf1 Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Sun, 25 Aug 2024 16:12:07 +0300 Subject: [PATCH] Disable -Wsign-compare on Windows. STATUS_* constants defined in ntstatus.h are defined as DWORDs, and NTSTATUS is long. This results in signed/unsigned mismatch warnings emitted by gcc and clang. Consider that a platform bug and disable the warning. Closes https://github.com/boostorg/filesystem/issues/321. --- src/error_handling.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/error_handling.hpp b/src/error_handling.hpp index a83d92e97..5f410705b 100644 --- a/src/error_handling.hpp +++ b/src/error_handling.hpp @@ -51,6 +51,12 @@ typedef boost::winapi::DWORD_ err_t; #define BOOST_ERROR_ALREADY_EXISTS boost::winapi::ERROR_ALREADY_EXISTS_ #define BOOST_ERROR_NOT_SUPPORTED boost::winapi::ERROR_NOT_SUPPORTED_ +#if defined(__GNUC__) +// STATUS_* constants defined in ntstatus.h are defined as DWORDs, and NTSTATUS is long. This results +// in signed/unsigned mismatch warnings emitted by gcc and clang. Consider that a platform bug. +#pragma GCC diagnostic ignored "-Wsign-compare" +#endif + // Note: Legacy MinGW doesn't have ntstatus.h and doesn't define NTSTATUS error codes other than STATUS_SUCCESS. #if !defined(NT_SUCCESS) #define NT_SUCCESS(Status) (((boost::winapi::NTSTATUS_)(Status)) >= 0)