diff --git a/cmake/CMakeCompiler.cmake b/cmake/CMakeCompiler.cmake index d1ea3212..b2b3d745 100644 --- a/cmake/CMakeCompiler.cmake +++ b/cmake/CMakeCompiler.cmake @@ -4,7 +4,16 @@ macro(setup_default_compiler_flags _project_name) if(MSVC) # That's also clang-cl # Replace some default compiler switches and add new ones STRING(REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Disable RTTI - STRING(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Bump warnings to W4 + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang" OR BUILD_BENCHMARK_EXE) + STRING(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Enable level 4 warnings + else() + if(MSVC_VERSION GREATER 1920) + # VS2019 and above + STRING(REPLACE "/W3" "/Wall" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Enable all warnings + else() + STRING(REPLACE "/W3" "/W4" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) # Enable level 4 warnings + endif() + endif() target_compile_options(${_project_name} PRIVATE /Zi) # Add debug info target_compile_options(${_project_name} PRIVATE /Oi) # Generate intrinsic functions target_compile_options(${_project_name} PRIVATE /WX) # Treat warnings as errors @@ -27,6 +36,21 @@ macro(setup_default_compiler_flags _project_name) add_definitions(-DRTM_NO_INTRINSICS) endif() + # Disable various warnings that are harmless + target_compile_options(${_project_name} PRIVATE /wd4514) # Unreferenced inline function removed + target_compile_options(${_project_name} PRIVATE /wd4619) # No warning with specified number + target_compile_options(${_project_name} PRIVATE /wd4820) # Padding added after data member + target_compile_options(${_project_name} PRIVATE /wd4710) # Function not inlined + target_compile_options(${_project_name} PRIVATE /wd4711) # Function selected for automatic inlining + target_compile_options(${_project_name} PRIVATE /wd4738) # Storing 32-bit float in memory leads to rounding (x86) + target_compile_options(${_project_name} PRIVATE /wd4746) # Volatile access + target_compile_options(${_project_name} PRIVATE /wd5045) # Spectre mitigation for memory load + + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang") + target_compile_options(${_project_name} PRIVATE -Wno-c++98-compat) # No need to support C++98 + target_compile_options(${_project_name} PRIVATE -Wno-c++98-compat-pedantic) # No need to support C++98 + endif() + # Add linker flags set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /DEBUG") else() @@ -65,6 +89,9 @@ macro(setup_default_compiler_flags _project_name) target_compile_options(${_project_name} PRIVATE -Wshadow) # Enable shadowing warnings target_compile_options(${_project_name} PRIVATE -Werror) # Treat warnings as errors + # Disable various warnings that are harmless + target_compile_options(${_project_name} PRIVATE -Wno-c++98-compat) # No need to support C++98 + target_compile_options(${_project_name} PRIVATE -g) # Enable debug symbols endif() endmacro() diff --git a/includes/rtm/impl/error.h b/includes/rtm/impl/error.h index 705d32f1..0e5b09af 100644 --- a/includes/rtm/impl/error.h +++ b/includes/rtm/impl/error.h @@ -115,6 +115,8 @@ RTM_IMPL_FILE_PRAGMA_PUSH class runtime_assert final : public std::runtime_error { + runtime_assert() = delete; // Default constructor not needed + using std::runtime_error::runtime_error; // Inherit constructors }; @@ -137,7 +139,7 @@ RTM_IMPL_FILE_PRAGMA_PUSH va_end(args); if (count >= 0 && count < buffer_size) - throw runtime_assert(std::string(&buffer[0], count)); + throw runtime_assert(std::string(&buffer[0], static_cast(count))); else throw runtime_assert("Failed to format assert message!\n"); } diff --git a/includes/rtm/impl/macros.vector4.impl.h b/includes/rtm/impl/macros.vector4.impl.h index 8854fdd6..bc8fb492 100644 --- a/includes/rtm/impl/macros.vector4.impl.h +++ b/includes/rtm/impl/macros.vector4.impl.h @@ -190,4 +190,22 @@ RTM_IMPL_FILE_PRAGMA_PUSH // Macros not defined for scalar code path #endif +#if defined(RTM_SSE2_INTRINSICS) + #if defined(RTM_COMPILER_MSVC) + ////////////////////////////////////////////////////////////////////////// + // Creates a vector constant from its 4 components + ////////////////////////////////////////////////////////////////////////// + #define RTM_VECTOR4F_MAKE(x, y, z, w) { { x, y, z, w } } + #else + ////////////////////////////////////////////////////////////////////////// + // Creates a vector constant from its 4 components + ////////////////////////////////////////////////////////////////////////// + #define RTM_VECTOR4F_MAKE(x, y, z, w) { x, y, z, w } + #endif +#elif defined(RTM_NEON_INTRINSICS) + // RTM_VECTOR2D_SELECT not defined for NEON yet, TODO +#else + // Macros not defined for scalar code path +#endif + RTM_IMPL_FILE_PRAGMA_POP diff --git a/includes/rtm/impl/mask_common.h b/includes/rtm/impl/mask_common.h index 577f3af9..d39b6854 100644 --- a/includes/rtm/impl/mask_common.h +++ b/includes/rtm/impl/mask_common.h @@ -52,7 +52,7 @@ namespace rtm const uint64_t z_mask = z ? 0xFFFFFFFFFFFFFFFFULL : 0; const uint64_t w_mask = w ? 0xFFFFFFFFFFFFFFFFULL : 0; - return mask4d{ _mm_castsi128_pd(_mm_set_epi64x(y_mask, x_mask)), _mm_castsi128_pd(_mm_set_epi64x(w_mask, z_mask)) }; + return mask4d{ _mm_castsi128_pd(_mm_set_epi64x(static_cast(y_mask), static_cast(x_mask))), _mm_castsi128_pd(_mm_set_epi64x(static_cast(w_mask), static_cast(z_mask))) }; #else const uint64_t x_mask = x ? 0xFFFFFFFFFFFFFFFFULL : 0; const uint64_t y_mask = y ? 0xFFFFFFFFFFFFFFFFULL : 0; @@ -71,7 +71,7 @@ namespace rtm const uint64_t z_mask = z ? 0xFFFFFFFFFFFFFFFFULL : 0; const uint64_t w_mask = w ? 0xFFFFFFFFFFFFFFFFULL : 0; - return mask4q{ _mm_set_epi64x(y_mask, x_mask), _mm_set_epi64x(w_mask, z_mask) }; + return mask4q{ _mm_set_epi64x(static_cast(y_mask), static_cast(x_mask)), _mm_set_epi64x(static_cast(w_mask), static_cast(z_mask)) }; #else const uint64_t x_mask = x ? 0xFFFFFFFFFFFFFFFFULL : 0; const uint64_t y_mask = y ? 0xFFFFFFFFFFFFFFFFULL : 0; @@ -90,7 +90,7 @@ namespace rtm const uint32_t w_mask = w ? 0xFFFFFFFFU : 0; #if defined(RTM_SSE2_INTRINSICS) - return _mm_castsi128_ps(_mm_set_epi32(w_mask, z_mask, y_mask, x_mask)); + return _mm_castsi128_ps(_mm_set_epi32(static_cast(w_mask), static_cast(z_mask), static_cast(y_mask), static_cast(x_mask))); #elif defined(RTM_NEON_INTRINSICS) float32x2_t V0 = vcreate_f32(((uint64_t)x_mask) | ((uint64_t)(y_mask) << 32)); float32x2_t V1 = vcreate_f32(((uint64_t)z_mask) | ((uint64_t)(w_mask) << 32)); @@ -108,7 +108,7 @@ namespace rtm const uint32_t w_mask = w ? 0xFFFFFFFFU : 0; #if defined(RTM_SSE2_INTRINSICS) - return _mm_set_epi32(w_mask, z_mask, y_mask, x_mask); + return _mm_set_epi32(static_cast(w_mask), static_cast(z_mask), static_cast(y_mask), static_cast(x_mask)); #elif defined(RTM_NEON_INTRINSICS) uint32x2_t V0 = vcreate_u32(((uint64_t)x_mask) | ((uint64_t)(y_mask) << 32)); uint32x2_t V1 = vcreate_u32(((uint64_t)z_mask) | ((uint64_t)(w_mask) << 32)); @@ -146,7 +146,7 @@ namespace rtm RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE RTM_SIMD_CALL operator mask4f() const RTM_NO_EXCEPT { #if defined(RTM_SSE2_INTRINSICS) - return _mm_castsi128_ps(_mm_set_epi32(w, z, y, x)); + return _mm_castsi128_ps(_mm_set_epi32(static_cast(w), static_cast(z), static_cast(y), static_cast(x))); #elif defined(RTM_NEON_INTRINSICS) float32x2_t V0 = vcreate_f32(((uint64_t)x) | ((uint64_t)(y) << 32)); float32x2_t V1 = vcreate_f32(((uint64_t)z) | ((uint64_t)(w) << 32)); @@ -159,7 +159,7 @@ namespace rtm RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE RTM_SIMD_CALL operator mask4i() const RTM_NO_EXCEPT { #if defined(RTM_SSE2_INTRINSICS) - return _mm_set_epi32(w, z, y, x); + return _mm_set_epi32(static_cast(w), static_cast(z), static_cast(y), static_cast(x)); #elif defined(RTM_NEON_INTRINSICS) uint32x2_t V0 = vcreate_u32(((uint64_t)x) | ((uint64_t)(y) << 32)); uint32x2_t V1 = vcreate_u32(((uint64_t)z) | ((uint64_t)(w) << 32)); @@ -210,9 +210,9 @@ namespace rtm const uint32_t z_mask = z ? 0xFFFFFFFFU : 0; const uint32_t w_mask = w ? 0xFFFFFFFFU : 0; - return mask4d{ _mm_castsi128_pd(_mm_set_epi32(y_mask, y_mask, x_mask, x_mask)), _mm_castsi128_pd(_mm_set_epi32(w_mask, w_mask, z_mask, z_mask)) }; + return mask4d{ _mm_castsi128_pd(_mm_set_epi32(static_cast(y_mask), static_cast(y_mask), static_cast(x_mask), static_cast(x_mask))), _mm_castsi128_pd(_mm_set_epi32(static_cast(w_mask), static_cast(w_mask), static_cast(z_mask), static_cast(z_mask))) }; #else - return mask4d{ _mm_castsi128_pd(_mm_set_epi64x(y, x)), _mm_castsi128_pd(_mm_set_epi64x(w, z)) }; + return mask4d{ _mm_castsi128_pd(_mm_set_epi64x(static_cast(y), static_cast(x))), _mm_castsi128_pd(_mm_set_epi64x(static_cast(w), static_cast(z))) }; #endif #else return mask4d{ x, y, z, w }; @@ -235,9 +235,9 @@ namespace rtm const uint32_t z_mask = z ? 0xFFFFFFFFU : 0; const uint32_t w_mask = w ? 0xFFFFFFFFU : 0; - return mask4q{ _mm_set_epi32(y_mask, y_mask, x_mask, x_mask), _mm_set_epi32(w_mask, w_mask, z_mask, z_mask) }; + return mask4q{ _mm_set_epi32(static_cast(y_mask), static_cast(y_mask), static_cast(x_mask), static_cast(x_mask)), _mm_set_epi32(static_cast(w_mask), static_cast(w_mask), static_cast(z_mask), static_cast(z_mask)) }; #else - return mask4q{ _mm_set_epi64x(y, x), _mm_set_epi64x(w, z) }; + return mask4q{ _mm_set_epi64x(static_cast(y), static_cast(x)), _mm_set_epi64x(static_cast(w), static_cast(z)) }; #endif #else return mask4q{ x, y, z, w }; diff --git a/includes/rtm/impl/matrix_cast.h b/includes/rtm/impl/matrix_cast.h index f31ec8d9..2363d053 100644 --- a/includes/rtm/impl/matrix_cast.h +++ b/includes/rtm/impl/matrix_cast.h @@ -48,6 +48,10 @@ namespace rtm struct matrix_caster { RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr explicit matrix_caster(const matrix3x3f& mtx_) RTM_NO_EXCEPT : mtx(mtx_) {} + RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr explicit matrix_caster(matrix3x3f&& mtx_) RTM_NO_EXCEPT : mtx(mtx_) {} + + matrix_caster(const matrix_caster&) = default; + matrix_caster& operator=(const matrix_caster&) = delete; RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr RTM_SIMD_CALL operator matrix3x3f() const RTM_NO_EXCEPT { @@ -61,7 +65,7 @@ namespace rtm RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE RTM_SIMD_CALL operator matrix3x4f() const RTM_NO_EXCEPT { - return matrix3x4f{ mtx.x_axis, mtx.y_axis, mtx.z_axis, vector_zero() }; + return matrix3x4f{ mtx.x_axis, mtx.y_axis, mtx.z_axis, (vector4f)vector_zero() }; } RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE RTM_SIMD_CALL operator matrix3x4d() const RTM_NO_EXCEPT @@ -88,6 +92,10 @@ namespace rtm struct matrix_caster { RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr explicit matrix_caster(const matrix3x3d& mtx_) RTM_NO_EXCEPT : mtx(mtx_) {} + RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr explicit matrix_caster(matrix3x3d&& mtx_) RTM_NO_EXCEPT : mtx(mtx_) {} + + matrix_caster(const matrix_caster&) = default; + matrix_caster& operator=(const matrix_caster&) = delete; RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE RTM_SIMD_CALL operator matrix3x3f() const RTM_NO_EXCEPT { @@ -107,7 +115,7 @@ namespace rtm RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE RTM_SIMD_CALL operator matrix3x4d() const RTM_NO_EXCEPT { - return matrix3x4d{ mtx.x_axis, mtx.y_axis, mtx.z_axis, vector_zero() }; + return matrix3x4d{ mtx.x_axis, mtx.y_axis, mtx.z_axis, (vector4d)vector_zero() }; } RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE RTM_SIMD_CALL operator matrix4x4f() const RTM_NO_EXCEPT @@ -128,6 +136,10 @@ namespace rtm struct matrix_caster { RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr explicit matrix_caster(const matrix3x4f& mtx_) RTM_NO_EXCEPT : mtx(mtx_) {} + RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr explicit matrix_caster(matrix3x4f&& mtx_) RTM_NO_EXCEPT : mtx(mtx_) {} + + matrix_caster(const matrix_caster&) = default; + matrix_caster& operator=(const matrix_caster&) = delete; RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr RTM_SIMD_CALL operator matrix3x3f() const RTM_NO_EXCEPT { @@ -170,6 +182,10 @@ namespace rtm struct matrix_caster { RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr explicit matrix_caster(const matrix3x4d& mtx_) RTM_NO_EXCEPT : mtx(mtx_) {} + RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr explicit matrix_caster(matrix3x4d&& mtx_) RTM_NO_EXCEPT : mtx(mtx_) {} + + matrix_caster(const matrix_caster&) = default; + matrix_caster& operator=(const matrix_caster&) = delete; RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE RTM_SIMD_CALL operator matrix3x3f() const RTM_NO_EXCEPT { @@ -212,6 +228,10 @@ namespace rtm struct matrix_caster { RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr explicit matrix_caster(const matrix4x4f& mtx_) RTM_NO_EXCEPT : mtx(mtx_) {} + RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr explicit matrix_caster(matrix4x4f&& mtx_) RTM_NO_EXCEPT : mtx(mtx_) {} + + matrix_caster(const matrix_caster&) = default; + matrix_caster& operator=(const matrix_caster&) = delete; RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr RTM_SIMD_CALL operator matrix3x3f() const RTM_NO_EXCEPT { @@ -250,6 +270,10 @@ namespace rtm struct matrix_caster { RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr explicit matrix_caster(const matrix4x4d& mtx_) RTM_NO_EXCEPT : mtx(mtx_) {} + RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE constexpr explicit matrix_caster(matrix4x4d&& mtx_) RTM_NO_EXCEPT : mtx(mtx_) {} + + matrix_caster(const matrix_caster&) = default; + matrix_caster& operator=(const matrix_caster&) = delete; RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE RTM_SIMD_CALL operator matrix3x3f() const RTM_NO_EXCEPT { diff --git a/includes/rtm/impl/qvs_common.h b/includes/rtm/impl/qvs_common.h index 72922b76..2c7b0028 100644 --- a/includes/rtm/impl/qvs_common.h +++ b/includes/rtm/impl/qvs_common.h @@ -90,12 +90,12 @@ namespace rtm { RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE RTM_SIMD_CALL operator qvsd() const RTM_NO_EXCEPT { - return qvsd{ quat_identity(), vector_set(0.0, 0.0, 0.0, 1.0) }; + return qvsd{ (quatd)quat_identity(), vector_set(0.0, 0.0, 0.0, 1.0) }; } RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE RTM_SIMD_CALL operator qvsf() const RTM_NO_EXCEPT { - return qvsf{ quat_identity(), vector_set(0.0F, 0.0F, 0.0F, 1.0F) }; + return qvsf{ (quatf)quat_identity(), vector_set(0.0F, 0.0F, 0.0F, 1.0F) }; } }; } diff --git a/includes/rtm/mask4d.h b/includes/rtm/mask4d.h index 699c304e..2c841917 100644 --- a/includes/rtm/mask4d.h +++ b/includes/rtm/mask4d.h @@ -46,10 +46,10 @@ namespace rtm { #if defined(RTM_SSE2_INTRINSICS) #if defined(RTM_ARCH_X64) - return _mm_cvtsi128_si64(_mm_castpd_si128(input.xy)); + return static_cast(_mm_cvtsi128_si64(_mm_castpd_si128(input.xy))); #else // Just sign extend on 32bit systems - return (uint64_t)_mm_cvtsi128_si32(_mm_castpd_si128(input.xy)); + return static_cast(_mm_cvtsi128_si32(_mm_castpd_si128(input.xy))); #endif #else return input.x; @@ -63,10 +63,10 @@ namespace rtm { #if defined(RTM_SSE2_INTRINSICS) #if defined(RTM_ARCH_X64) - return _mm_cvtsi128_si64(_mm_castpd_si128(_mm_shuffle_pd(input.xy, input.xy, 1))); + return static_cast(_mm_cvtsi128_si64(_mm_castpd_si128(_mm_shuffle_pd(input.xy, input.xy, 1)))); #else // Just sign extend on 32bit systems - return (uint64_t)_mm_cvtsi128_si32(_mm_castpd_si128(_mm_shuffle_pd(input.xy, input.xy, 1))); + return static_cast(_mm_cvtsi128_si32(_mm_castpd_si128(_mm_shuffle_pd(input.xy, input.xy, 1)))); #endif #else return input.y; @@ -80,10 +80,10 @@ namespace rtm { #if defined(RTM_SSE2_INTRINSICS) #if defined(RTM_ARCH_X64) - return _mm_cvtsi128_si64(_mm_castpd_si128(input.zw)); + return static_cast(_mm_cvtsi128_si64(_mm_castpd_si128(input.zw))); #else // Just sign extend on 32bit systems - return (uint64_t)_mm_cvtsi128_si32(_mm_castpd_si128(input.zw)); + return static_cast(_mm_cvtsi128_si32(_mm_castpd_si128(input.zw))); #endif #else return input.z; @@ -97,10 +97,10 @@ namespace rtm { #if defined(RTM_SSE2_INTRINSICS) #if defined(RTM_ARCH_X64) - return _mm_cvtsi128_si64(_mm_castpd_si128(_mm_shuffle_pd(input.zw, input.zw, 1))); + return static_cast(_mm_cvtsi128_si64(_mm_castpd_si128(_mm_shuffle_pd(input.zw, input.zw, 1)))); #else // Just sign extend on 32bit systems - return (uint64_t)_mm_cvtsi128_si32(_mm_castpd_si128(_mm_shuffle_pd(input.zw, input.zw, 1))); + return static_cast(_mm_cvtsi128_si32(_mm_castpd_si128(_mm_shuffle_pd(input.zw, input.zw, 1)))); #endif #else return input.w; diff --git a/includes/rtm/mask4f.h b/includes/rtm/mask4f.h index 8df6d778..e6f8d5a6 100644 --- a/includes/rtm/mask4f.h +++ b/includes/rtm/mask4f.h @@ -46,7 +46,7 @@ namespace rtm RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE uint32_t RTM_SIMD_CALL mask_get_x(mask4f_arg0 input) RTM_NO_EXCEPT { #if defined(RTM_SSE2_INTRINSICS) - return _mm_cvtsi128_si32(_mm_castps_si128(input)); + return static_cast(_mm_cvtsi128_si32(_mm_castps_si128(input))); #elif defined(RTM_NEON_INTRINSICS) return vgetq_lane_u32(vreinterpretq_u32_f32(input), 0); #else @@ -60,7 +60,7 @@ namespace rtm RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE uint32_t RTM_SIMD_CALL mask_get_y(mask4f_arg0 input) RTM_NO_EXCEPT { #if defined(RTM_SSE2_INTRINSICS) - return _mm_cvtsi128_si32(_mm_castps_si128(_mm_shuffle_ps(input, input, _MM_SHUFFLE(1, 1, 1, 1)))); + return static_cast(_mm_cvtsi128_si32(_mm_castps_si128(_mm_shuffle_ps(input, input, _MM_SHUFFLE(1, 1, 1, 1))))); #elif defined(RTM_NEON_INTRINSICS) return vgetq_lane_u32(vreinterpretq_u32_f32(input), 1); #else @@ -74,7 +74,7 @@ namespace rtm RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE uint32_t RTM_SIMD_CALL mask_get_z(mask4f_arg0 input) RTM_NO_EXCEPT { #if defined(RTM_SSE2_INTRINSICS) - return _mm_cvtsi128_si32(_mm_castps_si128(_mm_shuffle_ps(input, input, _MM_SHUFFLE(2, 2, 2, 2)))); + return static_cast(_mm_cvtsi128_si32(_mm_castps_si128(_mm_shuffle_ps(input, input, _MM_SHUFFLE(2, 2, 2, 2))))); #elif defined(RTM_NEON_INTRINSICS) return vgetq_lane_u32(vreinterpretq_u32_f32(input), 2); #else @@ -88,7 +88,7 @@ namespace rtm RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE uint32_t RTM_SIMD_CALL mask_get_w(mask4f_arg0 input) RTM_NO_EXCEPT { #if defined(RTM_SSE2_INTRINSICS) - return _mm_cvtsi128_si32(_mm_castps_si128(_mm_shuffle_ps(input, input, _MM_SHUFFLE(3, 3, 3, 3)))); + return static_cast(_mm_cvtsi128_si32(_mm_castps_si128(_mm_shuffle_ps(input, input, _MM_SHUFFLE(3, 3, 3, 3))))); #elif defined(RTM_NEON_INTRINSICS) return vgetq_lane_u32(vreinterpretq_u32_f32(input), 3); #else diff --git a/includes/rtm/mask4i.h b/includes/rtm/mask4i.h index b79c8f3c..a8d5e3f0 100644 --- a/includes/rtm/mask4i.h +++ b/includes/rtm/mask4i.h @@ -41,7 +41,7 @@ namespace rtm RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE uint32_t RTM_SIMD_CALL mask_get_x(mask4i_arg0 input) RTM_NO_EXCEPT { #if defined(RTM_SSE2_INTRINSICS) - return _mm_cvtsi128_si32(input); + return static_cast(_mm_cvtsi128_si32(input)); #elif defined(RTM_NEON_INTRINSICS) return vgetq_lane_u32(RTM_IMPL_MASK4i_GET(input), 0); #else @@ -55,7 +55,7 @@ namespace rtm RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE uint32_t RTM_SIMD_CALL mask_get_y(mask4i_arg0 input) RTM_NO_EXCEPT { #if defined(RTM_SSE2_INTRINSICS) - return _mm_cvtsi128_si32(_mm_shuffle_epi32(input, _MM_SHUFFLE(1, 1, 1, 1))); + return static_cast(_mm_cvtsi128_si32(_mm_shuffle_epi32(input, _MM_SHUFFLE(1, 1, 1, 1)))); #elif defined(RTM_NEON_INTRINSICS) return vgetq_lane_u32(RTM_IMPL_MASK4i_GET(input), 1); #else @@ -69,7 +69,7 @@ namespace rtm RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE uint32_t RTM_SIMD_CALL mask_get_z(mask4i_arg0 input) RTM_NO_EXCEPT { #if defined(RTM_SSE2_INTRINSICS) - return _mm_cvtsi128_si32(_mm_shuffle_epi32(input, _MM_SHUFFLE(2, 2, 2, 2))); + return static_cast(_mm_cvtsi128_si32(_mm_shuffle_epi32(input, _MM_SHUFFLE(2, 2, 2, 2)))); #elif defined(RTM_NEON_INTRINSICS) return vgetq_lane_u32(RTM_IMPL_MASK4i_GET(input), 2); #else @@ -83,7 +83,7 @@ namespace rtm RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE uint32_t RTM_SIMD_CALL mask_get_w(mask4i_arg0 input) RTM_NO_EXCEPT { #if defined(RTM_SSE2_INTRINSICS) - return _mm_cvtsi128_si32(_mm_shuffle_epi32(input, _MM_SHUFFLE(3, 3, 3, 3))); + return static_cast(_mm_cvtsi128_si32(_mm_shuffle_epi32(input, _MM_SHUFFLE(3, 3, 3, 3)))); #elif defined(RTM_NEON_INTRINSICS) return vgetq_lane_u32(RTM_IMPL_MASK4i_GET(input), 3); #else diff --git a/includes/rtm/mask4q.h b/includes/rtm/mask4q.h index 549fc9a4..e63a47ba 100644 --- a/includes/rtm/mask4q.h +++ b/includes/rtm/mask4q.h @@ -42,10 +42,10 @@ namespace rtm { #if defined(RTM_SSE2_INTRINSICS) #if defined(RTM_ARCH_X64) - return _mm_cvtsi128_si64(input.xy); + return static_cast(_mm_cvtsi128_si64(input.xy)); #else // Just sign extend on 32bit systems - return (uint64_t)_mm_cvtsi128_si32(input.xy); + return static_cast(_mm_cvtsi128_si32(input.xy)); #endif #else return input.x; @@ -59,10 +59,10 @@ namespace rtm { #if defined(RTM_SSE2_INTRINSICS) #if defined(RTM_ARCH_X64) - return _mm_cvtsi128_si64(_mm_shuffle_epi32(input.xy, _MM_SHUFFLE(3, 2, 3, 2))); + return static_cast(_mm_cvtsi128_si64(_mm_shuffle_epi32(input.xy, _MM_SHUFFLE(3, 2, 3, 2)))); #else // Just sign extend on 32bit systems - return (uint64_t)_mm_cvtsi128_si32(_mm_shuffle_epi32(input.xy, _MM_SHUFFLE(3, 2, 3, 2))); + return static_cast(_mm_cvtsi128_si32(_mm_shuffle_epi32(input.xy, _MM_SHUFFLE(3, 2, 3, 2)))); #endif #else return input.y; @@ -76,10 +76,10 @@ namespace rtm { #if defined(RTM_SSE2_INTRINSICS) #if defined(RTM_ARCH_X64) - return _mm_cvtsi128_si64(input.zw); + return static_cast(_mm_cvtsi128_si64(input.zw)); #else // Just sign extend on 32bit systems - return (uint64_t)_mm_cvtsi128_si32(input.zw); + return static_cast(_mm_cvtsi128_si32(input.zw)); #endif #else return input.z; @@ -93,10 +93,10 @@ namespace rtm { #if defined(RTM_SSE2_INTRINSICS) #if defined(RTM_ARCH_X64) - return _mm_cvtsi128_si64(_mm_shuffle_epi32(input.zw, _MM_SHUFFLE(3, 2, 3, 2))); + return static_cast(_mm_cvtsi128_si64(_mm_shuffle_epi32(input.zw, _MM_SHUFFLE(3, 2, 3, 2)))); #else // Just sign extend on 32bit systems - return (uint64_t)_mm_cvtsi128_si32(_mm_shuffle_epi32(input.zw, _MM_SHUFFLE(3, 2, 3, 2))); + return static_cast(_mm_cvtsi128_si32(_mm_shuffle_epi32(input.zw, _MM_SHUFFLE(3, 2, 3, 2)))); #endif #else return input.w; diff --git a/includes/rtm/matrix3x4d.h b/includes/rtm/matrix3x4d.h index 16c4f51d..94d75c21 100644 --- a/includes/rtm/matrix3x4d.h +++ b/includes/rtm/matrix3x4d.h @@ -46,7 +46,7 @@ namespace rtm ////////////////////////////////////////////////////////////////////////// RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE matrix3x4d RTM_SIMD_CALL matrix_from_rotation(const matrix3x3d& rotation) RTM_NO_EXCEPT { - return matrix3x4d{ rotation.x_axis, rotation.y_axis, rotation.z_axis, vector_zero() }; + return matrix3x4d{ rotation.x_axis, rotation.y_axis, rotation.z_axis, (vector4d)vector_zero() }; } ////////////////////////////////////////////////////////////////////////// diff --git a/includes/rtm/matrix3x4f.h b/includes/rtm/matrix3x4f.h index 0a10a8d3..40afcf2d 100644 --- a/includes/rtm/matrix3x4f.h +++ b/includes/rtm/matrix3x4f.h @@ -47,7 +47,7 @@ namespace rtm ////////////////////////////////////////////////////////////////////////// RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE matrix3x4f RTM_SIMD_CALL matrix_from_rotation(matrix3x3f_arg0 rotation) RTM_NO_EXCEPT { - return matrix3x4f{ rotation.x_axis, rotation.y_axis, rotation.z_axis, vector_zero() }; + return matrix3x4f{ rotation.x_axis, rotation.y_axis, rotation.z_axis, (vector4f)vector_zero() }; } ////////////////////////////////////////////////////////////////////////// diff --git a/includes/rtm/packing/quatf.h b/includes/rtm/packing/quatf.h index 02f20e0f..fef81452 100644 --- a/includes/rtm/packing/quatf.h +++ b/includes/rtm/packing/quatf.h @@ -43,7 +43,7 @@ namespace rtm RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE quatf RTM_SIMD_CALL quat_ensure_positive_w(quatf_arg0 input) RTM_NO_EXCEPT { #if defined(RTM_SSE2_INTRINSICS) - constexpr __m128 sign_bit = { -0.0F, -0.0F, -0.0F, -0.0F }; + constexpr __m128 sign_bit = RTM_VECTOR4F_MAKE(-0.0F, -0.0F, -0.0F, -0.0F); const __m128 input_sign = _mm_and_ps(input, sign_bit); const __m128 bias = _mm_shuffle_ps(input_sign, input_sign, _MM_SHUFFLE(3, 3, 3, 3)); return _mm_xor_ps(input, bias); @@ -52,7 +52,13 @@ namespace rtm const uint32x4_t sign_bit = *reinterpret_cast(&sign_bit_i[0]); const uint32x4_t input_u32 = vreinterpretq_u32_f32(input); const uint32x4_t input_sign = vandq_u32(input_u32, sign_bit); - const uint32x4_t bias = vmovq_n_u32(vgetq_lane_u32(input_sign, 3)); + const uint32_t input_sign_w = vgetq_lane_u32(input_sign, 3); +#if defined(RTM_COMPILER_MSVC) + // MSVC's intrinsic is an alias to the unsigned variant + const uint32x4_t bias = vmovq_n_u32(static_cast(input_sign_w)); +#else + const uint32x4_t bias = vmovq_n_u32(input_sign_w); +#endif return vreinterpretq_f32_u32(veorq_u32(input_u32, bias)); #else return quat_get_w(input) >= 0.f ? input : quat_neg(input); diff --git a/includes/rtm/quatf.h b/includes/rtm/quatf.h index 6c0e39f7..25db031c 100644 --- a/includes/rtm/quatf.h +++ b/includes/rtm/quatf.h @@ -430,7 +430,7 @@ namespace rtm RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE quatf RTM_SIMD_CALL quat_conjugate(quatf_arg0 input) RTM_NO_EXCEPT { #if defined(RTM_SSE2_INTRINSICS) - constexpr __m128 signs = { -0.0F, -0.0F, -0.0F, 0.0F }; + constexpr __m128 signs = RTM_VECTOR4F_MAKE(-0.0F, -0.0F, -0.0F, 0.0F); return _mm_xor_ps(input, signs); #else // On ARMv7 the scalar version performs best or among the best while on ARM64 it beats the others. @@ -447,10 +447,10 @@ namespace rtm { #if defined(RTM_SSE4_INTRINSICS) && 0 // TODO: Profile this, the accuracy is the same as with SSE2, should be binary exact - constexpr __m128 signs_x = { 1.0F, 1.0F, 1.0F, -1.0F }; - constexpr __m128 signs_y = { 1.0F, -1.0F, 1.0F, 1.0F }; - constexpr __m128 signs_z = { 1.0F, 1.0F, -1.0F, 1.0F }; - constexpr __m128 signs_w = { 1.0F, -1.0F, -1.0F, -1.0F }; + constexpr __m128 signs_x = RTM_VECTOR4F_MAKE(1.0F, 1.0F, 1.0F, -1.0F); + constexpr __m128 signs_y = RTM_VECTOR4F_MAKE(1.0F, -1.0F, 1.0F, 1.0F); + constexpr __m128 signs_z = RTM_VECTOR4F_MAKE(1.0F, 1.0F, -1.0F, 1.0F); + constexpr __m128 signs_w = RTM_VECTOR4F_MAKE(1.0F, -1.0F, -1.0F, -1.0F); // x = dot(rhs.wxyz, lhs.xwzy * signs_x) // y = dot(rhs.wxyz, lhs.yzwx * signs_y) // z = dot(rhs.wxyz, lhs.zyxw * signs_z) @@ -468,9 +468,9 @@ namespace rtm __m128 zzww = _mm_shuffle_ps(z, w, _MM_SHUFFLE(0, 0, 0, 0)); return _mm_shuffle_ps(xxyy, zzww, _MM_SHUFFLE(2, 0, 2, 0)); #elif defined(RTM_SSE2_INTRINSICS) - constexpr __m128 control_wzyx = { 0.0F, -0.0F, 0.0F, -0.0F }; - constexpr __m128 control_zwxy = { 0.0F, 0.0F, -0.0F, -0.0F }; - constexpr __m128 control_yxwz = { -0.0F, 0.0F, 0.0F, -0.0F }; + constexpr __m128 control_wzyx = RTM_VECTOR4F_MAKE(0.0F, -0.0F, 0.0F, -0.0F); + constexpr __m128 control_zwxy = RTM_VECTOR4F_MAKE(0.0F, 0.0F, -0.0F, -0.0F); + constexpr __m128 control_yxwz = RTM_VECTOR4F_MAKE(-0.0F, 0.0F, 0.0F, -0.0F); const __m128 r_xxxx = _mm_shuffle_ps(rhs, rhs, _MM_SHUFFLE(0, 0, 0, 0)); const __m128 r_yyyy = _mm_shuffle_ps(rhs, rhs, _MM_SHUFFLE(1, 1, 1, 1)); @@ -1188,7 +1188,7 @@ namespace rtm RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE quatf RTM_SIMD_CALL quat_neg(quatf_arg0 input) RTM_NO_EXCEPT { #if defined(RTM_SSE2_INTRINSICS) - constexpr __m128 signs = { -0.0F, -0.0F, -0.0F, -0.0F }; + constexpr __m128 signs = RTM_VECTOR4F_MAKE(-0.0F, -0.0F, -0.0F, -0.0F); return _mm_xor_ps(input, signs); #elif defined(RTM_NEON_INTRINSICS) return vnegq_f32(input); diff --git a/includes/rtm/qvvf.h b/includes/rtm/qvvf.h index 1e390317..5c1d3e63 100644 --- a/includes/rtm/qvvf.h +++ b/includes/rtm/qvvf.h @@ -67,7 +67,7 @@ namespace rtm result_mtx = matrix_remove_scale(result_mtx); #if defined(RTM_SSE2_INTRINSICS) - constexpr __m128 signs = { -0.0F, -0.0F, -0.0F, -0.0F }; + constexpr __m128 signs = RTM_VECTOR4F_MAKE(-0.0F, -0.0F, -0.0F, -0.0F); const __m128 sign_bits = _mm_and_ps(scale, signs); // Mask out the sign bit result_mtx.x_axis = _mm_xor_ps(result_mtx.x_axis, _mm_shuffle_ps(sign_bits, sign_bits, _MM_SHUFFLE(0, 0, 0, 0))); diff --git a/includes/rtm/scalard.h b/includes/rtm/scalard.h index 1f60bed6..5c06ce83 100644 --- a/includes/rtm/scalard.h +++ b/includes/rtm/scalard.h @@ -720,7 +720,7 @@ namespace rtm RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE scalard RTM_SIMD_CALL scalar_round_bankers(scalard input) RTM_NO_EXCEPT { #if defined(RTM_SSE4_INTRINSICS) - return scalard{ _mm_cvtsd_f64(_mm_round_sd(input.value, input.value, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC)) }; + return scalard{ _mm_round_sd(input.value, input.value, _MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC) }; #else const __m128i abs_mask = _mm_set_epi64x(0x7FFFFFFFFFFFFFFFULL, 0x7FFFFFFFFFFFFFFFULL); diff --git a/includes/rtm/vector4f.h b/includes/rtm/vector4f.h index 00fe84f3..aea8ac29 100644 --- a/includes/rtm/vector4f.h +++ b/includes/rtm/vector4f.h @@ -873,7 +873,7 @@ namespace rtm RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE vector4f RTM_SIMD_CALL vector_neg(vector4f_arg0 input) RTM_NO_EXCEPT { #if defined(RTM_SSE2_INTRINSICS) - constexpr __m128 signs = { -0.0F, -0.0F, -0.0F, -0.0F }; + constexpr __m128 signs = RTM_VECTOR4F_MAKE(-0.0F, -0.0F, -0.0F, -0.0F); return _mm_xor_ps(input, signs); #elif defined(RTM_NEON_INTRINSICS) return vnegq_f32(input); @@ -2845,8 +2845,8 @@ namespace rtm RTM_DISABLE_SECURITY_COOKIE_CHECK RTM_FORCE_INLINE vector4f RTM_SIMD_CALL vector_sign(vector4f_arg0 input) RTM_NO_EXCEPT { #if defined(RTM_SSE2_INTRINSICS) - constexpr __m128 signs = { -0.0F, -0.0F, -0.0F, -0.0F }; - constexpr __m128 one = { 1.0F, 1.0F, 1.0F, 1.0F }; + constexpr __m128 signs = RTM_VECTOR4F_MAKE(-0.0F, -0.0F, -0.0F, -0.0F); + constexpr __m128 one = RTM_VECTOR4F_MAKE(1.0F, 1.0F, 1.0F, 1.0F); const __m128 sign_bits = _mm_and_ps(input, signs); // Mask out the sign bit return _mm_or_ps(sign_bits, one); // Copy the sign bit onto +-1.0f #else diff --git a/tests/main_android/app/src/main/cpp/CMakeLists.txt b/tests/main_android/app/src/main/cpp/CMakeLists.txt index 2f696716..b6ff4f29 100644 --- a/tests/main_android/app/src/main/cpp/CMakeLists.txt +++ b/tests/main_android/app/src/main/cpp/CMakeLists.txt @@ -6,6 +6,7 @@ set(PROJECT_ROOT_DIR "${PROJECT_SOURCE_DIR}/../../../..") include_directories("${PROJECT_ROOT_DIR}/../../includes") include_directories("${PROJECT_ROOT_DIR}/../../external/catch2/single_include") +include_directories("${PROJECT_ROOT_DIR}/../sources") # Grab all of our test source files file(GLOB_RECURSE ALL_TEST_SOURCE_FILES LIST_DIRECTORIES false diff --git a/tests/main_android/app/src/main/cpp/main.cpp b/tests/main_android/app/src/main/cpp/main.cpp index fa5264c5..573274ed 100644 --- a/tests/main_android/app/src/main/cpp/main.cpp +++ b/tests/main_android/app/src/main/cpp/main.cpp @@ -23,7 +23,7 @@ //////////////////////////////////////////////////////////////////////////////// #define CATCH_CONFIG_RUNNER -#include +#include "catch2.impl.h" #include diff --git a/tests/main_emscripten/CMakeLists.txt b/tests/main_emscripten/CMakeLists.txt index 316781e6..8357f62b 100644 --- a/tests/main_emscripten/CMakeLists.txt +++ b/tests/main_emscripten/CMakeLists.txt @@ -3,6 +3,7 @@ project(rtm_unit_tests CXX) include_directories("${PROJECT_SOURCE_DIR}/../../includes") include_directories("${PROJECT_SOURCE_DIR}/../../external/catch2/single_include") +include_directories("${PROJECT_SOURCE_DIR}/../sources") # Grab all of our test source files file(GLOB_RECURSE ALL_TEST_SOURCE_FILES LIST_DIRECTORIES false diff --git a/tests/main_emscripten/main.cpp b/tests/main_emscripten/main.cpp index 332c229b..1a110767 100644 --- a/tests/main_emscripten/main.cpp +++ b/tests/main_emscripten/main.cpp @@ -23,7 +23,7 @@ //////////////////////////////////////////////////////////////////////////////// #define CATCH_CONFIG_RUNNER -#include +#include "catch2.impl.h" int main(int argc, char* argv[]) { diff --git a/tests/main_generic/CMakeLists.txt b/tests/main_generic/CMakeLists.txt index 6c977744..9c2848ef 100644 --- a/tests/main_generic/CMakeLists.txt +++ b/tests/main_generic/CMakeLists.txt @@ -3,6 +3,7 @@ project(rtm_unit_tests CXX) include_directories("${PROJECT_SOURCE_DIR}/../../includes") include_directories("${PROJECT_SOURCE_DIR}/../../external/catch2/single_include") +include_directories("${PROJECT_SOURCE_DIR}/../sources") # Grab all of our test source files file(GLOB_RECURSE ALL_TEST_SOURCE_FILES LIST_DIRECTORIES false diff --git a/tests/main_generic/main.cpp b/tests/main_generic/main.cpp index 6657d255..ecc13dff 100644 --- a/tests/main_generic/main.cpp +++ b/tests/main_generic/main.cpp @@ -23,7 +23,7 @@ //////////////////////////////////////////////////////////////////////////////// #define CATCH_CONFIG_RUNNER -#include +#include "catch2.impl.h" #ifdef _WIN32 #include diff --git a/tests/main_ios/CMakeLists.txt b/tests/main_ios/CMakeLists.txt index 2a09a658..5ef48c2b 100644 --- a/tests/main_ios/CMakeLists.txt +++ b/tests/main_ios/CMakeLists.txt @@ -17,6 +17,7 @@ set(MACOSX_BUNDLE_BUNDLE_NAME "rtm-unit-tests") include_directories("${PROJECT_SOURCE_DIR}/../../includes") include_directories("${PROJECT_SOURCE_DIR}/../../external/catch2/single_include") +include_directories("${PROJECT_SOURCE_DIR}/../sources") # Grab all of our test source files file(GLOB_RECURSE ALL_TEST_SOURCE_FILES LIST_DIRECTORIES false diff --git a/tests/main_ios/main.cpp b/tests/main_ios/main.cpp index 3142a165..286a12d3 100644 --- a/tests/main_ios/main.cpp +++ b/tests/main_ios/main.cpp @@ -23,7 +23,7 @@ //////////////////////////////////////////////////////////////////////////////// #define CATCH_CONFIG_RUNNER -#include +#include "catch2.impl.h" int main(int argc, char* argv[]) { diff --git a/tests/sources/catch2.impl.h b/tests/sources/catch2.impl.h new file mode 100644 index 00000000..8df1a053 --- /dev/null +++ b/tests/sources/catch2.impl.h @@ -0,0 +1,50 @@ +#pragma once + +//////////////////////////////////////////////////////////////////////////////// +// The MIT License (MIT) +// +// Copyright (c) 2023 Nicholas Frechette & Realtime Math contributors +// +// Permission is hereby granted, free of charge, to any person obtaining a copy +// of this software and associated documentation files (the "Software"), to deal +// in the Software without restriction, including without limitation the rights +// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +// copies of the Software, and to permit persons to whom the Software is +// furnished to do so, subject to the following conditions: +// +// The above copyright notice and this permission notice shall be included in all +// copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +// SOFTWARE. +//////////////////////////////////////////////////////////////////////////////// + +// We disable various informational warnings with using /Wall with MSVC caused by Catch2 + +#if defined(_MSC_VER) && !defined(__clang__) + #pragma warning(push) + #pragma warning(disable : 4365) // Signed/unsigned mismatch + #pragma warning(disable : 4388) // Signed/unsigned comparison + #pragma warning(disable : 4583) // Destructor is not implicitly called + #pragma warning(disable : 4623) // Default constructor implicitly deleted + #pragma warning(disable : 4625) // Copy constructor implicitly deleted + #pragma warning(disable : 4626) // Copy assignment operator implicitly deleted + #pragma warning(disable : 4868) // May not enforce left to right order in initializer + #pragma warning(disable : 5026) // Move constructor implicitly deleted + #pragma warning(disable : 5027) // Move assignment operator implicitly deleted + #pragma warning(disable : 5039) // Pointer to potentially throwing function passed to extern C + #pragma warning(disable : 5204) // Class has virtual functions but no virtual destructor + #pragma warning(disable : 5219) // Implicit conversion, possible loss of data + #pragma warning(disable : 5267) // Implicit copy constructor deprecated due to user destructor +#endif + +#include + +#if defined(_MSC_VER) && !defined(__clang__) + #pragma warning(pop) +#endif diff --git a/tests/sources/test_constants.cpp b/tests/sources/test_constants.cpp index 1871b4f8..9ecd069e 100644 --- a/tests/sources/test_constants.cpp +++ b/tests/sources/test_constants.cpp @@ -22,7 +22,7 @@ // SOFTWARE. //////////////////////////////////////////////////////////////////////////////// -#include +#include "catch2.impl.h" #include #include diff --git a/tests/sources/test_macros.cpp b/tests/sources/test_macros.cpp index d24f7740..c74ec011 100644 --- a/tests/sources/test_macros.cpp +++ b/tests/sources/test_macros.cpp @@ -22,7 +22,7 @@ // SOFTWARE. //////////////////////////////////////////////////////////////////////////////// -#include +#include "catch2.impl.h" #include #include diff --git a/tests/sources/test_mask4.cpp b/tests/sources/test_mask4.cpp index 29e28307..a559ca15 100644 --- a/tests/sources/test_mask4.cpp +++ b/tests/sources/test_mask4.cpp @@ -22,7 +22,7 @@ // SOFTWARE. //////////////////////////////////////////////////////////////////////////////// -#include +#include "catch2.impl.h" #include #include diff --git a/tests/sources/test_matrix3x3_impl.h b/tests/sources/test_matrix3x3_impl.h index 0605d237..87e38865 100644 --- a/tests/sources/test_matrix3x3_impl.h +++ b/tests/sources/test_matrix3x3_impl.h @@ -23,7 +23,7 @@ // SOFTWARE. //////////////////////////////////////////////////////////////////////////////// -#include +#include "catch2.impl.h" #include #include diff --git a/tests/sources/test_matrix3x4.cpp b/tests/sources/test_matrix3x4.cpp index 45ccd130..2c1bd35a 100644 --- a/tests/sources/test_matrix3x4.cpp +++ b/tests/sources/test_matrix3x4.cpp @@ -23,7 +23,7 @@ // SOFTWARE. //////////////////////////////////////////////////////////////////////////////// -#include +#include "catch2.impl.h" #include #include diff --git a/tests/sources/test_matrix4x4.cpp b/tests/sources/test_matrix4x4.cpp index 6d89dc1b..ddbbb428 100644 --- a/tests/sources/test_matrix4x4.cpp +++ b/tests/sources/test_matrix4x4.cpp @@ -23,7 +23,7 @@ // SOFTWARE. //////////////////////////////////////////////////////////////////////////////// -#include +#include "catch2.impl.h" #include #include diff --git a/tests/sources/test_memory_utils.cpp b/tests/sources/test_memory_utils.cpp index ae21b977..61e12130 100644 --- a/tests/sources/test_memory_utils.cpp +++ b/tests/sources/test_memory_utils.cpp @@ -23,7 +23,7 @@ // SOFTWARE. //////////////////////////////////////////////////////////////////////////////// -#include +#include "catch2.impl.h" #include diff --git a/tests/sources/test_packing_quat.cpp b/tests/sources/test_packing_quat.cpp index 74bf4d52..e00d8305 100644 --- a/tests/sources/test_packing_quat.cpp +++ b/tests/sources/test_packing_quat.cpp @@ -22,7 +22,7 @@ // SOFTWARE. //////////////////////////////////////////////////////////////////////////////// -#include +#include "catch2.impl.h" #include #include diff --git a/tests/sources/test_quat.cpp b/tests/sources/test_quat.cpp index b309f828..abe1ce29 100644 --- a/tests/sources/test_quat.cpp +++ b/tests/sources/test_quat.cpp @@ -23,7 +23,7 @@ // SOFTWARE. //////////////////////////////////////////////////////////////////////////////// -#include +#include "catch2.impl.h" #include #include diff --git a/tests/sources/test_qv.cpp b/tests/sources/test_qv.cpp index b07318bb..dc350991 100644 --- a/tests/sources/test_qv.cpp +++ b/tests/sources/test_qv.cpp @@ -22,7 +22,7 @@ // SOFTWARE. //////////////////////////////////////////////////////////////////////////////// -#include +#include "catch2.impl.h" #include #include diff --git a/tests/sources/test_qvs.cpp b/tests/sources/test_qvs.cpp index 7594c782..e3c75aff 100644 --- a/tests/sources/test_qvs.cpp +++ b/tests/sources/test_qvs.cpp @@ -22,7 +22,7 @@ // SOFTWARE. //////////////////////////////////////////////////////////////////////////////// -#include +#include "catch2.impl.h" #include #include diff --git a/tests/sources/test_qvv.cpp b/tests/sources/test_qvv.cpp index 1c32bd87..acf4895c 100644 --- a/tests/sources/test_qvv.cpp +++ b/tests/sources/test_qvv.cpp @@ -23,7 +23,7 @@ // SOFTWARE. //////////////////////////////////////////////////////////////////////////////// -#include +#include "catch2.impl.h" #include #include diff --git a/tests/sources/test_scalar.cpp b/tests/sources/test_scalar.cpp index c772fec9..58b3da31 100644 --- a/tests/sources/test_scalar.cpp +++ b/tests/sources/test_scalar.cpp @@ -23,7 +23,7 @@ // SOFTWARE. //////////////////////////////////////////////////////////////////////////////// -#include +#include "catch2.impl.h" #include #include diff --git a/tests/sources/test_vector4_impl.h b/tests/sources/test_vector4_impl.h index cea7ff12..a165ead7 100644 --- a/tests/sources/test_vector4_impl.h +++ b/tests/sources/test_vector4_impl.h @@ -25,7 +25,7 @@ // SOFTWARE. //////////////////////////////////////////////////////////////////////////////// -#include +#include "catch2.impl.h" #include #include diff --git a/tests/sources/vector_mix/test_vector4_mix_impl.h b/tests/sources/vector_mix/test_vector4_mix_impl.h index f79c40cc..156b11cf 100644 --- a/tests/sources/vector_mix/test_vector4_mix_impl.h +++ b/tests/sources/vector_mix/test_vector4_mix_impl.h @@ -24,7 +24,7 @@ // SOFTWARE. //////////////////////////////////////////////////////////////////////////////// -#include +#include "catch2.impl.h" #include #include