Coding - Fix compilation warnings (#1034)

- Added version guard for Clang compiler to conditionally apply `-Wcast-function-type-mismatch` pragma
- Wrapped deprecated `Standard_HMutex` typedef with deprecation warning suppression macros
This commit is contained in:
Pasukhin Dmitry
2026-01-28 10:20:44 +00:00
committed by GitHub
parent c47d9c06b5
commit 8a31910e06
2 changed files with 9 additions and 1 deletions

View File

@@ -173,8 +173,14 @@ private:
};
//! @deprecated Use std::shared_ptr<std::mutex> instead. Will be removed in OCCT 8.0.0.
Standard_DISABLE_DEPRECATION_WARNINGS;
Standard_DEPRECATED("Standard_HMutex is deprecated; use std::shared_ptr<std::mutex> instead. "
"Will be removed in OCCT 8.0.0")
typedef NCollection_Shared<Standard_Mutex> Standard_HMutex;
Standard_ENABLE_DEPRECATION_WARNINGS;
// Implementation of the method Unlock is inline, since it is
// just a shortcut to system function
inline void Standard_Mutex::Unlock()

View File

@@ -25,7 +25,9 @@
//! suppressing it is the only feasible way to avoid it. As this warning still can point out broken
//! places, it should be suppressed only locally, where usage of function cast has been verified.
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wcast-function-type-mismatch"
#if __clang_major__ >= 16
#pragma clang diagnostic ignored "-Wcast-function-type-mismatch"
#endif
#elif defined(__GNUC__) && !defined(__INTEL_COMPILER)
#if (__GNUC__ > 8) || ((__GNUC__ == 8) && (__GNUC_MINOR__ >= 1))
#pragma GCC diagnostic ignored "-Wcast-function-type"