mirror of
https://github.com/HandmadeMath/HandmadeMath.git
synced 2025-09-07 02:38:15 +00:00
Suppress float equality warnings (#113)
* Add a macro to help with deprecations * Suppress warnings about float equality
This commit is contained in:
@@ -115,14 +115,23 @@
|
||||
#pragma warning(disable:4201)
|
||||
#endif
|
||||
|
||||
#ifdef __clang__
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wfloat-equal"
|
||||
#if defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ < 8)
|
||||
#pragma GCC diagnostic ignored "-Wmissing-braces"
|
||||
#endif
|
||||
#ifdef __clang__
|
||||
#pragma GCC diagnostic ignored "-Wgnu-anonymous-struct"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ < 8)
|
||||
#pragma GCC diagnostic push
|
||||
#pragma GCC diagnostic ignored "-Wmissing-braces"
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#define HMM_DEPRECATED(msg) __attribute__((deprecated(msg)))
|
||||
#elif defined(_MSC_VER)
|
||||
#define HMM_DEPRECATED(msg) __declspec(deprecated(msg))
|
||||
#else
|
||||
#define HMM_DEPRECATED(msg)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -337,8 +346,7 @@ typedef union hmm_mat4
|
||||
#ifdef HANDMADE_MATH__USE_SSE
|
||||
__m128 Columns[4];
|
||||
|
||||
// DEPRECATED. Our matrices are column-major, so this was named
|
||||
// incorrectly. Use Columns instead.
|
||||
HMM_DEPRECATED("Our matrices are column-major, so this was named incorrectly. Use Columns instead.")
|
||||
__m128 Rows[4];
|
||||
#endif
|
||||
|
||||
@@ -3133,11 +3141,7 @@ HMM_INLINE hmm_bool operator!=(hmm_vec4 Left, hmm_vec4 Right)
|
||||
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ < 8)
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
#pragma GCC diagnostic pop
|
||||
#endif
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
BUILD_DIR=./build
|
||||
|
||||
CXXFLAGS+=-g -Wall -Wextra -pthread -Wno-missing-braces -Wno-missing-field-initializers
|
||||
CXXFLAGS+=-g -Wall -Wextra -pthread -Wno-missing-braces -Wno-missing-field-initializers -Wfloat-equal
|
||||
|
||||
all: c c_no_sse cpp cpp_no_sse build_c_without_coverage build_cpp_without_coverage
|
||||
|
||||
|
@@ -81,9 +81,9 @@ TEST(ScalarMath, Power)
|
||||
|
||||
TEST(ScalarMath, PowerF)
|
||||
{
|
||||
EXPECT_FLOAT_EQ(HMM_PowerF(2.0f, 0), 1.0f);
|
||||
EXPECT_NEAR(HMM_PowerF(2.0f, 4.1), 17.148376f, 0.0001f);
|
||||
EXPECT_NEAR(HMM_PowerF(2.0f, -2.5), 0.176777f, 0.0001f);
|
||||
EXPECT_FLOAT_EQ(HMM_PowerF(2.0f, 0.0f), 1.0f);
|
||||
EXPECT_NEAR(HMM_PowerF(2.0f, 4.1f), 17.148376f, 0.0001f);
|
||||
EXPECT_NEAR(HMM_PowerF(2.0f, -2.5f), 0.176777f, 0.0001f);
|
||||
}
|
||||
|
||||
TEST(ScalarMath, Lerp)
|
||||
|
Reference in New Issue
Block a user