mirror of
				https://github.com/HandmadeMath/HandmadeMath.git
				synced 2025-10-26 12:26:59 +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) | #pragma warning(disable:4201) | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifdef __clang__ | #if defined(__GNUC__) || defined(__clang__) | ||||||
| #pragma GCC diagnostic push | #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" | #pragma GCC diagnostic ignored "-Wgnu-anonymous-struct" | ||||||
| #endif | #endif | ||||||
|  | #endif | ||||||
|  |  | ||||||
| #if defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ < 8) | #if defined(__GNUC__) || defined(__clang__) | ||||||
| #pragma GCC diagnostic push | #define HMM_DEPRECATED(msg) __attribute__((deprecated(msg))) | ||||||
| #pragma GCC diagnostic ignored "-Wmissing-braces" | #elif defined(_MSC_VER) | ||||||
|  | #define HMM_DEPRECATED(msg) __declspec(deprecated(msg)) | ||||||
|  | #else | ||||||
|  | #define HMM_DEPRECATED(msg) | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| #ifdef __cplusplus | #ifdef __cplusplus | ||||||
| @@ -337,8 +346,7 @@ typedef union hmm_mat4 | |||||||
| #ifdef HANDMADE_MATH__USE_SSE | #ifdef HANDMADE_MATH__USE_SSE | ||||||
|     __m128 Columns[4]; |     __m128 Columns[4]; | ||||||
|  |  | ||||||
|     // DEPRECATED. Our matrices are column-major, so this was named |     HMM_DEPRECATED("Our matrices are column-major, so this was named incorrectly. Use Columns instead.") | ||||||
|     // incorrectly. Use Columns instead. |  | ||||||
|     __m128 Rows[4]; |     __m128 Rows[4]; | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
| @@ -3133,11 +3141,7 @@ HMM_INLINE hmm_bool operator!=(hmm_vec4 Left, hmm_vec4 Right) | |||||||
|  |  | ||||||
| #endif /* __cplusplus */ | #endif /* __cplusplus */ | ||||||
|  |  | ||||||
| #ifdef __clang__ | #if defined(__GNUC__) || defined(__clang__) | ||||||
| #pragma GCC diagnostic pop |  | ||||||
| #endif |  | ||||||
|  |  | ||||||
| #if defined(__GNUC__) && (__GNUC__ == 4 && __GNUC_MINOR__ < 8) |  | ||||||
| #pragma GCC diagnostic pop | #pragma GCC diagnostic pop | ||||||
| #endif | #endif | ||||||
|  |  | ||||||
|   | |||||||
| @@ -1,6 +1,6 @@ | |||||||
| BUILD_DIR=./build | 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 | 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) | TEST(ScalarMath, PowerF) | ||||||
| { | { | ||||||
|     EXPECT_FLOAT_EQ(HMM_PowerF(2.0f, 0), 1.0f); |     EXPECT_FLOAT_EQ(HMM_PowerF(2.0f, 0.0f), 1.0f); | ||||||
|     EXPECT_NEAR(HMM_PowerF(2.0f, 4.1), 17.148376f, 0.0001f); |     EXPECT_NEAR(HMM_PowerF(2.0f, 4.1f), 17.148376f, 0.0001f); | ||||||
|     EXPECT_NEAR(HMM_PowerF(2.0f, -2.5), 0.176777f, 0.0001f); |     EXPECT_NEAR(HMM_PowerF(2.0f, -2.5f), 0.176777f, 0.0001f); | ||||||
| } | } | ||||||
|  |  | ||||||
| TEST(ScalarMath, Lerp) | TEST(ScalarMath, Lerp) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 Ben Visness
					Ben Visness