From 8015f28aa775a649d61d14917ea717da7cb840b3 Mon Sep 17 00:00:00 2001 From: Peter Kardos Date: Thu, 15 Apr 2021 16:40:33 +0200 Subject: [PATCH] weeded out internal compiler errors and warnings --- CMakeLists.txt | 8 +--- include/dspbb/Primitives/SignalArithmetic.hpp | 42 +++++++++---------- .../dspbb/Vectorization/ComplexFunctions.hpp | 3 ++ include/dspbb/Vectorization/Kernels.hpp | 3 ++ include/dspbb/Vectorization/MathFunctions.hpp | 3 ++ test/Test_Polyphase.cpp | 2 +- 6 files changed, 32 insertions(+), 29 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 035d741..7ec798f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,15 +17,9 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-instr-generate -fcoverage-mapping -mllvm -enable-name-compression=false") endif() elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2 -lpthread") - if (CMAKE_SYSTEM_NAME MATCHES "Windows") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wa,-mbig-obj") - endif() elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel") elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP /permissive-") - set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS} /PROFILE") - add_compile_definitions("-D_ITERATOR_DEBUG_LEVEL=1") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") endif() set(THREADS_PREFER_PTHREAD_FLAG ON) diff --git a/include/dspbb/Primitives/SignalArithmetic.hpp b/include/dspbb/Primitives/SignalArithmetic.hpp index fc8dbaa..88ebe5c 100644 --- a/include/dspbb/Primitives/SignalArithmetic.hpp +++ b/include/dspbb/Primitives/SignalArithmetic.hpp @@ -34,21 +34,21 @@ void CheckSizes(const SignalR& r, const SignalT& a) { template auto Multiply(SignalR&& r, const SignalT& a, const SignalU& b) - -> std::enable_if_t && is_same_domain_v, void> { + -> std::enable_if_t && is_same_domain_v, void> { CheckSizes(r, a, b); Multiply(r.Data(), a.Data(), b.Data(), r.Length()); } template auto Multiply(SignalR&& r, const T& a, const SignalU& b) - -> std::enable_if_t && is_same_domain_v && !is_signal_like_v, void> { + -> std::enable_if_t && is_same_domain_v && !is_signal_like_v, void> { CheckSizes(r, b); Multiply(r.Data(), a, b.Data(), r.Length()); } template auto Multiply(SignalR&& r, const SignalT& a, const U& b) - -> std::enable_if_t && is_same_domain_v && !is_signal_like_v, void> { + -> std::enable_if_t && is_same_domain_v && !is_signal_like_v, void> { CheckSizes(r, a); Multiply(r.Data(), a.Data(), b, r.Length()); } @@ -56,21 +56,21 @@ auto Multiply(SignalR&& r, const SignalT& a, const U& b) template auto Divide(SignalR&& r, const SignalT& a, const SignalU& b) - -> std::enable_if_t && is_same_domain_v, void> { + -> std::enable_if_t && is_same_domain_v, void> { CheckSizes(r, a, b); Divide(r.Data(), a.Data(), b.Data(), r.Length()); } template auto Divide(SignalR&& r, const T& a, const SignalU& b) - -> std::enable_if_t && is_same_domain_v && !is_signal_like_v, void> { + -> std::enable_if_t && is_same_domain_v && !is_signal_like_v, void> { CheckSizes(r, b); Divide(r.Data(), a, b.Data(), r.Length()); } template auto Divide(SignalR&& r, const SignalT& a, const U& b) - -> std::enable_if_t && is_same_domain_v && !is_signal_like_v, void> { + -> std::enable_if_t && is_same_domain_v && !is_signal_like_v, void> { CheckSizes(r, a); Divide(r.Data(), a.Data(), b, r.Length()); } @@ -78,21 +78,21 @@ auto Divide(SignalR&& r, const SignalT& a, const U& b) template auto Add(SignalR&& r, const SignalT& a, const SignalU& b) - -> std::enable_if_t && is_same_domain_v, void> { + -> std::enable_if_t && is_same_domain_v, void> { CheckSizes(r, a, b); Add(r.Data(), a.Data(), b.Data(), r.Length()); } template auto Add(SignalR&& r, const T& a, const SignalU& b) - -> std::enable_if_t && is_same_domain_v && !is_signal_like_v, void> { + -> std::enable_if_t && is_same_domain_v && !is_signal_like_v, void> { CheckSizes(r, b); Add(r.Data(), a, b.Data(), r.Length()); } template auto Add(SignalR&& r, const SignalT& a, const U& b) - -> std::enable_if_t && is_same_domain_v && !is_signal_like_v, void> { + -> std::enable_if_t && is_same_domain_v && !is_signal_like_v, void> { CheckSizes(r, a); Add(r.Data(), a.Data(), b, r.Length()); } @@ -100,21 +100,21 @@ auto Add(SignalR&& r, const SignalT& a, const U& b) template auto Subtract(SignalR&& r, const SignalT& a, const SignalU& b) - -> std::enable_if_t && is_same_domain_v, void> { + -> std::enable_if_t && is_same_domain_v, void> { CheckSizes(r, a, b); Subtract(r.Data(), a.Data(), b.Data(), r.Length()); } template auto Subtract(SignalR&& r, const T& a, const SignalU& b) - -> std::enable_if_t && is_same_domain_v && !is_signal_like_v, void> { + -> std::enable_if_t && is_same_domain_v && !is_signal_like_v, void> { CheckSizes(r, b); Subtract(r.Data(), a, b.Data(), r.Length()); } template auto Subtract(SignalR&& r, const SignalT& a, const U& b) - -> std::enable_if_t && is_same_domain_v && !is_signal_like_v, void> { + -> std::enable_if_t && is_same_domain_v && !is_signal_like_v, void> { CheckSizes(r, a); Subtract(r.Data(), a.Data(), b, r.Length()); } @@ -134,7 +134,7 @@ auto operator*(const SignalT& a, const SignalU& b) { using R = decltype(std::declval::type>() * std::declval::type>()); constexpr auto Domain = signal_traits::domain; Signal r(a.Size()); - Multiply(r, a, b); + Multiply&, SignalT, SignalU>(r, a, b); return r; } @@ -250,28 +250,28 @@ auto operator-(const T& a, const SignalU& b) { template auto operator*=(SignalT&& a, const SignalU& b) - -> std::enable_if_t && is_same_domain_v, SignalT&> { + -> std::enable_if_t && is_same_domain_v, SignalT&> { Multiply(a, a, b); return a; } template auto operator/=(SignalT&& a, const SignalU& b) - -> std::enable_if_t && is_same_domain_v, SignalT&> { + -> std::enable_if_t && is_same_domain_v, SignalT&> { Divide(a, a, b); return a; } template auto operator+=(SignalT&& a, const SignalU& b) - -> std::enable_if_t && is_same_domain_v, SignalT&> { + -> std::enable_if_t && is_same_domain_v, SignalT&> { Add(a, a, b); return a; } template auto operator-=(SignalT&& a, const SignalU& b) - -> std::enable_if_t && is_same_domain_v, SignalT&> { + -> std::enable_if_t && is_same_domain_v, SignalT&> { Subtract(a, a, b); return a; } @@ -283,28 +283,28 @@ auto operator-=(SignalT&& a, const SignalU& b) template auto operator*=(SignalT&& a, const U& b) - -> std::enable_if_t && is_signal_like_v> && !is_signal_like_v, SignalT&> { + -> std::enable_if_t && is_signal_like_v> && !is_signal_like_v, SignalT&> { Multiply(a, a, b); return a; } template auto operator/=(SignalT&& a, const U& b) - -> std::enable_if_t && is_signal_like_v> && !is_signal_like_v, SignalT&> { + -> std::enable_if_t && is_signal_like_v> && !is_signal_like_v, SignalT&> { Divide(a, a, b); return a; } template auto operator+=(SignalT&& a, const U& b) - -> std::enable_if_t && is_signal_like_v> && !is_signal_like_v, SignalT&> { + -> std::enable_if_t && is_signal_like_v> && !is_signal_like_v, SignalT&> { Add(a, a, b); return a; } template auto operator-=(SignalT&& a, const U& b) - -> std::enable_if_t && is_signal_like_v> && !is_signal_like_v, SignalT&> { + -> std::enable_if_t && is_signal_like_v> && !is_signal_like_v, SignalT&> { Subtract(a, a, b); return a; } diff --git a/include/dspbb/Vectorization/ComplexFunctions.hpp b/include/dspbb/Vectorization/ComplexFunctions.hpp index 498ca8e..6b2869d 100644 --- a/include/dspbb/Vectorization/ComplexFunctions.hpp +++ b/include/dspbb/Vectorization/ComplexFunctions.hpp @@ -1,6 +1,9 @@ #pragma once +#pragma warning(push) +#pragma warning(disable: 4800) #include +#pragma warning(pop) namespace dspbb { namespace complex_functions { diff --git a/include/dspbb/Vectorization/Kernels.hpp b/include/dspbb/Vectorization/Kernels.hpp index 91c887f..2eb41e7 100644 --- a/include/dspbb/Vectorization/Kernels.hpp +++ b/include/dspbb/Vectorization/Kernels.hpp @@ -1,6 +1,9 @@ #pragma once +#pragma warning(push) +#pragma warning(disable : 4800) #include +#pragma warning(pop) namespace dspbb { diff --git a/include/dspbb/Vectorization/MathFunctions.hpp b/include/dspbb/Vectorization/MathFunctions.hpp index 6d1d2a6..5abfb84 100644 --- a/include/dspbb/Vectorization/MathFunctions.hpp +++ b/include/dspbb/Vectorization/MathFunctions.hpp @@ -1,7 +1,10 @@ #pragma once #include +#pragma warning(push) +#pragma warning(disable : 4800) #include +#pragma warning(pop) namespace dspbb { namespace math_functions { diff --git a/test/Test_Polyphase.cpp b/test/Test_Polyphase.cpp index 1570866..f898808 100644 --- a/test/Test_Polyphase.cpp +++ b/test/Test_Polyphase.cpp @@ -10,7 +10,7 @@ using namespace dspbb; TEST_CASE("Polyphase upsample", "[Polyphase]") { - constexpr int factor = 4; + constexpr unsigned factor = 4; const auto filter = FirLowPassWindowed(22050.f, factor * 44100, HammingWindow(128)); const PolyphaseFilter polyphase{ AsConstView(filter), factor };