From 975c8fb6fd89b8d7052b88d6f50e5d4af8184e80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Thu, 3 Sep 2026 04:20:46 +0000 Subject: [PATCH] Enabled FatalWarnings. (#424) --- include/bx/inline/bx.inl | 2 +- include/bx/inline/simd32_ref.inl | 5 +++++ scripts/bx.lua | 4 ++++ scripts/genie.lua | 6 +++++- src/mutex.cpp | 1 + tests/cast_test.cpp | 2 +- tests/macros_test.cpp | 1 + tests/test.h | 3 +++ 8 files changed, 21 insertions(+), 3 deletions(-) diff --git a/include/bx/inline/bx.inl b/include/bx/inline/bx.inl index 2617290..8a4907f 100644 --- a/include/bx/inline/bx.inl +++ b/include/bx/inline/bx.inl @@ -271,7 +271,7 @@ namespace bx if (_from < mn) { - return mn; + return Ty(mn); } else if (_from > mx) { diff --git a/include/bx/inline/simd32_ref.inl b/include/bx/inline/simd32_ref.inl index cd17f00..fa42f55 100644 --- a/include/bx/inline/simd32_ref.inl +++ b/include/bx/inline/simd32_ref.inl @@ -160,6 +160,9 @@ BX_FP_PRECISE_BEGIN() BX_FP_PRECISE_END() +BX_PRAGMA_DIAGNOSTIC_PUSH(); +BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4756); // warning C4756: overflow in constant arithmetic + inline BX_CONSTEXPR_FUNC simd32_t simd32_f32_madd(simd32_t _a, simd32_t _b, simd32_t _c) { const simd32_f32_ref_t a = bitCast(_a); @@ -185,6 +188,8 @@ BX_FP_PRECISE_END() #endif // BX_CONFIG_FMA } +BX_PRAGMA_DIAGNOSTIC_POP(); + inline BX_CONSTEXPR_FUNC simd32_t simd32_f32_msub(simd32_t _a, simd32_t _b, simd32_t _c) { const simd32_t nc = simd32_f32_neg(_c); diff --git a/scripts/bx.lua b/scripts/bx.lua index c4cbd95..e7004dc 100644 --- a/scripts/bx.lua +++ b/scripts/bx.lua @@ -40,6 +40,10 @@ end project "bx" kind "StaticLib" + flags { + "FatalWarnings", + } + includedirs { path.join(BX_DIR, "include"), path.join(BX_DIR, "3rdparty"), diff --git a/scripts/genie.lua b/scripts/genie.lua index 3e11df5..3de8cc9 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -46,7 +46,7 @@ project "bx.test" debugdir (path.join(BX_DIR, "tests")) flags { --- "FatalWarnings", + "FatalWarnings", } removeflags { @@ -114,6 +114,10 @@ project "bx.test" project "bx.bench" kind "ConsoleApp" + flags { + "FatalWarnings", + } + debugdir (path.join(BX_DIR, "tests")) includedirs { diff --git a/src/mutex.cpp b/src/mutex.cpp index 0bd4e7b..a98e07d 100644 --- a/src/mutex.cpp +++ b/src/mutex.cpp @@ -159,6 +159,7 @@ namespace bx { Mutex::Mutex() { + BX_UNUSED(m_internal); } Mutex::~Mutex() diff --git a/tests/cast_test.cpp b/tests/cast_test.cpp index 5cc9a99..dc239b1 100644 --- a/tests/cast_test.cpp +++ b/tests/cast_test.cpp @@ -107,7 +107,7 @@ TEST_CASE("Saturate cast", "[cast]") STATIC_REQUIRE(saturateCastTest( 0, 65535) ); STATIC_REQUIRE(saturateCastTest( -2147483648, 2147483647) ); STATIC_REQUIRE(saturateCastTest( 0, 4294967295) ); - STATIC_REQUIRE(saturateCastTest( -9223372036854775808ll, 9223372036854775807ll) ); + STATIC_REQUIRE(saturateCastTest(-9223372036854775807ll-1, 9223372036854775807ll) ); STATIC_REQUIRE(saturateCastTest( 0, 9223372036854775807ll) ); STATIC_REQUIRE(saturateCastTest( 0, 127) ); diff --git a/tests/macros_test.cpp b/tests/macros_test.cpp index 0bfd15f..53a0862 100644 --- a/tests/macros_test.cpp +++ b/tests/macros_test.cpp @@ -33,6 +33,7 @@ void testAssert() { BX_PRAGMA_DIAGNOSTIC_PUSH(); BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4804); // warning C4804: '%': unsafe use of type 'bool' in operation) +BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4127); // warning C4127: conditional expression is constant BX_ASSERT(false % 1, "Assert works!"); diff --git a/tests/test.h b/tests/test.h index 5279a54..0b931de 100644 --- a/tests/test.h +++ b/tests/test.h @@ -37,6 +37,9 @@ #include +BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wexceptions"); // error: '~ErrorAssert' has a non-throwing exception specification but can still throw +BX_PRAGMA_DIAGNOSTIC_IGNORED_GCC("-Wterminate"); // error: 'throw' will always call 'terminate' + BX_PRAGMA_DIAGNOSTIC_PUSH(); BX_PRAGMA_DIAGNOSTIC_IGNORED_MSVC(4312); // warning C4312 : 'reinterpret_cast' : conversion from 'int' to 'const char *' of greater size //BX_PRAGMA_DIAGNOSTIC_IGNORED_CLANG("-Wnan-infinity-disabled");