Skip to content

Commit

Permalink
Fix and ignore warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
christophe-lunarg committed Feb 8, 2024
1 parent 0d9f5cf commit 072917f
Show file tree
Hide file tree
Showing 6 changed files with 106 additions and 248 deletions.
14 changes: 7 additions & 7 deletions glm/detail/compute_vector_decl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ namespace glm {
GLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<L, T, Q> call(vec<L, T, Q> const& a, vec<L, T, Q> const& b)
{
vec<L, T, Q> v(a);
for (int i = 0; i < L; ++i)
for (length_t i = 0; i < L; ++i)
v[i] &= static_cast<T>(b[i]);
return v;
}
Expand All @@ -111,7 +111,7 @@ namespace glm {
GLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<L, T, Q> call(vec<L, T, Q> const& a, vec<L, T, Q> const& b)
{
vec<L, T, Q> v(a);
for (int i = 0; i < L; ++i)
for (length_t i = 0; i < L; ++i)
v[i] |= static_cast<T>(b[i]);
return v;
}
Expand All @@ -123,7 +123,7 @@ namespace glm {
GLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<L, T, Q> call(vec<L, T, Q> const& a, vec<L, T, Q> const& b)
{
vec<L, T, Q> v(a);
for (int i = 0; i < L; ++i)
for (length_t i = 0; i < L; ++i)
v[i] ^= static_cast<T>(b[i]);
return v;
}
Expand All @@ -135,7 +135,7 @@ namespace glm {
GLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<L, T, Q> call(vec<L, T, Q> const& a, vec<L, T, Q> const& b)
{
vec<L, T, Q> v(a);
for (int i = 0; i < L; ++i)
for (length_t i = 0; i < L; ++i)
v[i] <<= static_cast<T>(b[i]);
return v;
}
Expand All @@ -147,7 +147,7 @@ namespace glm {
GLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<L, T, Q> call(vec<L, T, Q> const& a, vec<L, T, Q> const& b)
{
vec<L, T, Q> v(a);
for (int i = 0; i < L; ++i)
for (length_t i = 0; i < L; ++i)
v[i] >>= static_cast<T>(b[i]);
return v;
}
Expand All @@ -159,7 +159,7 @@ namespace glm {
GLM_FUNC_QUALIFIER GLM_CONSTEXPR static bool call(vec<L, T, Q> const& v1, vec<L, T, Q> const& v2)
{
bool b = true;
for (int i = 0; i < L; ++i)
for (length_t i = 0; i < L; ++i)
b = b && detail::compute_equal<T, std::numeric_limits<T>::is_iec559>::call(v1.x, v2.x);
return b;
}
Expand All @@ -180,7 +180,7 @@ namespace glm {
GLM_FUNC_QUALIFIER GLM_CONSTEXPR static vec<L, T, Q> call(vec<L, T, Q> const& a)
{
vec<L, T, Q> v(a);
for (int i = 0; i < L; ++i)
for (length_t i = 0; i < L; ++i)
v[i] = ~v[i];
return v;
}
Expand Down
1 change: 1 addition & 0 deletions glm/detail/type_vec3.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ namespace glm
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wgnu-anonymous-struct"
# pragma clang diagnostic ignored "-Wnested-anon-types"
# pragma clang diagnostic ignored "-Wpadded"
# elif GLM_COMPILER & GLM_COMPILER_VC
# pragma warning(push)
# pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union
Expand Down
10 changes: 0 additions & 10 deletions glm/detail/type_vec4.inl
Original file line number Diff line number Diff line change
Expand Up @@ -361,13 +361,8 @@ namespace detail
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T& vec<4, T, Q>::operator[](typename vec<4, T, Q>::length_type i)
{
<<<<<<< HEAD
GLM_ASSERT_LENGTH(i, this->length());
switch(i)
=======
assert(i >= 0 && i < this->length());
switch (i)
>>>>>>> 5c1da05b (Simd improvement)
{
default:
case 0:
Expand All @@ -384,13 +379,8 @@ namespace detail
template<typename T, qualifier Q>
GLM_FUNC_QUALIFIER GLM_CONSTEXPR T const& vec<4, T, Q>::operator[](typename vec<4, T, Q>::length_type i) const
{
<<<<<<< HEAD
GLM_ASSERT_LENGTH(i, this->length());
switch(i)
=======
assert(i >= 0 && i < this->length());
switch (i)
>>>>>>> 5c1da05b (Simd improvement)
{
default:
case 0:
Expand Down
125 changes: 0 additions & 125 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,122 +2,6 @@ option(GLM_QUIET "No CMake Message" OFF)

option(GLM_TEST_ENABLE "Build unit tests" ON)
option(GLM_PERF_TEST_ENABLE "Build perf tests" OFF)
<<<<<<< HEAD
=======
option(GLM_TEST_ENABLE_SIMD_SSE2 "Enable SSE2 optimizations" OFF)
option(GLM_TEST_ENABLE_SIMD_SSE3 "Enable SSE3 optimizations" OFF)
option(GLM_TEST_ENABLE_SIMD_SSSE3 "Enable SSSE3 optimizations" OFF)
option(GLM_TEST_ENABLE_SIMD_SSE4_1 "Enable SSE 4.1 optimizations" OFF)
option(GLM_TEST_ENABLE_SIMD_SSE4_2 "Enable SSE 4.2 optimizations" OFF)
option(GLM_TEST_ENABLE_SIMD_AVX "Enable AVX optimizations" OFF)
option(GLM_TEST_ENABLE_SIMD_AVX2 "Enable AVX2 optimizations" OFF)
option(GLM_TEST_ENABLE_SIMD_NEON "Enable ARM NEON optimizations" OFF)
option(GLM_TEST_ENABLE_SIMD_FMA "Enable FMA optimizations" OFF)
option(GLM_TEST_FORCE_PURE "Force 'pure' instructions" OFF)

if(GLM_TEST_FORCE_PURE)
add_definitions(-DGLM_FORCE_PURE)

if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
add_compile_options(-mfpmath=387)
endif()
message(STATUS "GLM: No SIMD instruction set")

elseif(GLM_TEST_ENABLE_SIMD_AVX2)
add_definitions(-DGLM_FORCE_INTRINSICS)

if((CMAKE_CXX_COMPILER_ID MATCHES "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
add_compile_options(-mavx2)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
add_compile_options(/QxAVX2)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
add_compile_options(/arch:AVX2)
endif()
message(STATUS "GLM: AVX2 instruction set")

elseif(GLM_TEST_ENABLE_SIMD_AVX)
add_definitions(-DGLM_FORCE_INTRINSICS)

if((CMAKE_CXX_COMPILER_ID MATCHES "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
add_compile_options(-mavx)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
add_compile_options(/QxAVX)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
add_compile_options(/arch:AVX)
endif()
message(STATUS "GLM: AVX instruction set")

elseif(GLM_TEST_ENABLE_SIMD_SSE4_2)
add_definitions(-DGLM_FORCE_INTRINSICS)

if((CMAKE_CXX_COMPILER_ID MATCHES "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
add_compile_options(-msse4.2)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
add_compile_options(/QxSSE4.2)
elseif((CMAKE_CXX_COMPILER_ID MATCHES "MSVC") AND NOT CMAKE_CL_64)
add_compile_options(/arch:SSE2) # VC doesn't support SSE4.2
endif()
message(STATUS "GLM: SSE4.2 instruction set")

elseif(GLM_TEST_ENABLE_SIMD_SSE4_1)
add_definitions(-DGLM_FORCE_INTRINSICS)

if((CMAKE_CXX_COMPILER_ID MATCHES "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
add_compile_options(-msse4.1)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
add_compile_options(/QxSSE4.1)
elseif((CMAKE_CXX_COMPILER_ID MATCHES "MSVC") AND NOT CMAKE_CL_64)
add_compile_options(/arch:SSE2) # VC doesn't support SSE4.1
endif()
message(STATUS "GLM: SSE4.1 instruction set")

elseif(GLM_TEST_ENABLE_SIMD_SSSE3)
add_definitions(-DGLM_FORCE_INTRINSICS)

if((CMAKE_CXX_COMPILER_ID MATCHES "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
add_compile_options(-mssse3)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
add_compile_options(/QxSSSE3)
elseif((CMAKE_CXX_COMPILER_ID MATCHES "MSVC") AND NOT CMAKE_CL_64)
add_compile_options(/arch:SSE2) # VC doesn't support SSSE3
endif()
message(STATUS "GLM: SSSE3 instruction set")

elseif(GLM_TEST_ENABLE_SIMD_SSE3)
add_definitions(-DGLM_FORCE_INTRINSICS)

if((CMAKE_CXX_COMPILER_ID MATCHES "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
add_compile_options(-msse3)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
add_compile_options(/QxSSE3)
elseif((CMAKE_CXX_COMPILER_ID MATCHES "MSVC") AND NOT CMAKE_CL_64)
add_compile_options(/arch:SSE2) # VC doesn't support SSE3
endif()
message(STATUS "GLM: SSE3 instruction set")

elseif(GLM_TEST_ENABLE_SIMD_SSE2)
add_definitions(-DGLM_FORCE_INTRINSICS)

if((CMAKE_CXX_COMPILER_ID MATCHES "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
add_compile_options(-msse2)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Intel")
add_compile_options(/QxSSE2)
elseif((CMAKE_CXX_COMPILER_ID MATCHES "MSVC") AND NOT CMAKE_CL_64)
add_compile_options(/arch:SSE2)
endif()
message(STATUS "GLM: SSE2 instruction set")
elseif(GLM_TEST_ENABLE_SIMD_NEON)
add_definitions(-DGLM_FORCE_NEON)
message(STATUS "GLM: ARM NEON instruction set")
endif()

if (GLM_TEST_ENABLE_SIMD_FMA)
add_definitions(-DGLM_FORCE_FMA)
if((CMAKE_CXX_COMPILER_ID MATCHES "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang"))
add_compile_options(-mfma)
endif()
endif()
>>>>>>> 5c1da05b (Simd improvement)

# Compiler and default options

Expand All @@ -130,15 +14,6 @@ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
if(NOT GLM_DISABLE_AUTO_DETECTION)
add_compile_options(-Werror -Weverything)
endif()
<<<<<<< HEAD
=======
if (NOT APPLE)
add_compile_options(-Wno-unsafe-buffer-usage) #this option makes MacOS compilation fail but prevent error on windows
endif()

add_compile_options(-Wno-c++98-compat -Wno-c++98-compat-pedantic -Wno-c++11-long-long -Wno-padded -Wno-gnu-anonymous-struct -Wno-nested-anon-types)
add_compile_options(-Wno-undefined-reinterpret-cast -Wno-sign-conversion -Wno-unused-variable -Wno-missing-prototypes -Wno-unreachable-code -Wno-missing-variable-declarations -Wno-sign-compare -Wno-global-constructors -Wno-unused-macros -Wno-format-nonliteral -Wno-float-equal)
>>>>>>> 5c1da05b (Simd improvement)

elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
if(NOT GLM_QUIET)
Expand Down
1 change: 1 addition & 0 deletions test/core/core_force_compiler_unknown.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
#elif defined(_MSC_VER)
# pragma warning(push)
# pragma warning(disable: 4201) // nonstandard extension used : nameless struct/union
# pragma warning(disable: 4324) // structure was padded due to alignment specifier
#endif

#include <glm/glm.hpp>
Expand Down
Loading

0 comments on commit 072917f

Please sign in to comment.