Skip to content

Commit

Permalink
Disable -Wsign-compare on Windows.
Browse files Browse the repository at this point in the history
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 #321.
  • Loading branch information
Lastique committed Aug 25, 2024
1 parent 41a990e commit bfb0636
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/error_handling.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit bfb0636

Please sign in to comment.