Coding - Fix clang warning suppression for function pointer casts (#1059)

- Switched from `__clang_major__ >= 16` gating to `__has_warning(...)` checks
- Added fallback suppression for `-Wcast-function-type` when `-Wcast-function-type-mismatch` is unavailable
This commit is contained in:
Pasukhin Dmitry
2026-02-10 18:13:04 +00:00
committed by GitHub
parent 498e7cd173
commit 8949fd25f9

View File

@@ -24,9 +24,11 @@
//! There is no way to prevent this warning at OCCT level (until safer APIs is introduced), thus
//! 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__)
#if __clang_major__ >= 16
#if defined(__clang__) && defined(__has_warning)
#if __has_warning("-Wcast-function-type-mismatch")
#pragma clang diagnostic ignored "-Wcast-function-type-mismatch"
#elif __has_warning("-Wcast-function-type")
#pragma clang diagnostic ignored "-Wcast-function-type"
#endif
#elif defined(__GNUC__) && !defined(__INTEL_COMPILER)
#if (__GNUC__ > 8) || ((__GNUC__ == 8) && (__GNUC_MINOR__ >= 1))