From cdf660defee77feaf97753e478ecc978e782013f Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Mon, 3 Aug 2020 20:33:47 +0100 Subject: [PATCH 01/23] YAML modification --- .github/workflows/main.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a1d341a3..65b2d26a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -52,3 +52,15 @@ jobs: with: name: Testfile path: test/etl_tests + + build-clang-10-osx: + runs-on: macos-10.15 + steps: + - uses: actions/checkout@v2 + - name: Build and run + run: | + export CC=clang + export CXX=clang++ + cmake -D BUILD_TESTS=ON ./ + make + ./test/etl_tests \ No newline at end of file From 08fc80a2c5725837e7409aaaf7b2b18936d631e4 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Tue, 4 Aug 2020 11:40:31 +0100 Subject: [PATCH 02/23] Experimental atomic_gcc_sync change --- include/etl/atomic/atomic_gcc_sync.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/etl/atomic/atomic_gcc_sync.h b/include/etl/atomic/atomic_gcc_sync.h index dbd7167a..091540d6 100644 --- a/include/etl/atomic/atomic_gcc_sync.h +++ b/include/etl/atomic/atomic_gcc_sync.h @@ -469,7 +469,7 @@ namespace etl // Pre-increment T* operator ++() { - return (T*)__sync_add_and_fetch(&value, sizeof(T)); + return (T*)__sync_add_and_fetch(&(volatile void*)value, sizeof(T)); } T* operator ++() volatile From b92c3e8a1f29df2b7f510d1ebac062efebff4209 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Tue, 4 Aug 2020 11:57:53 +0100 Subject: [PATCH 03/23] Experimental atomic_gcc_sync change --- include/etl/atomic/atomic_gcc_sync.h | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/include/etl/atomic/atomic_gcc_sync.h b/include/etl/atomic/atomic_gcc_sync.h index 091540d6..de19f443 100644 --- a/include/etl/atomic/atomic_gcc_sync.h +++ b/include/etl/atomic/atomic_gcc_sync.h @@ -61,6 +61,9 @@ namespace etl memory_order_seq_cst } memory_order; + //*************************************************************************** + /// For all types except pointers + //*************************************************************************** template class atomic { @@ -436,18 +439,21 @@ namespace etl mutable volatile T value; }; + //*************************************************************************** + /// Specialisation for pointers + //*************************************************************************** template class atomic { public: atomic() - : value(ETL_NULLPTR) + : value(0U) { } atomic(T* v) - : value(v) + : value(uintptr_t(v)) { } @@ -469,7 +475,7 @@ namespace etl // Pre-increment T* operator ++() { - return (T*)__sync_add_and_fetch(&(volatile void*)value, sizeof(T)); + return (T*)__sync_add_and_fetch(&value, sizeof(T)); } T* operator ++() volatile @@ -540,7 +546,7 @@ namespace etl operator T*() volatile const { - return __sync_fetch_and_add(&value, 0); + return (T*)__sync_fetch_and_add(&value, 0); } // Is lock free? @@ -557,12 +563,12 @@ namespace etl // Store void store(T* v, etl::memory_order order = etl::memory_order_seq_cst) { - __sync_lock_test_and_set(&value, v); + __sync_lock_test_and_set(&value, uintptr_t(v)); } void store(T* v, etl::memory_order order = etl::memory_order_seq_cst) volatile { - __sync_lock_test_and_set(&value, v); + __sync_lock_test_and_set(&value, uintptr_t(v)); } // Load @@ -612,7 +618,7 @@ namespace etl // Compare exchange weak bool compare_exchange_weak(T*& expected, T* desired, etl::memory_order order = etl::memory_order_seq_cst) { - T* old = __sync_val_compare_and_swap(&value, expected, desired); + T* old = (T*)__sync_val_compare_and_swap(&value, uintptr_t(expected), uintptr_t(desired)); if (old == expected) { @@ -627,7 +633,7 @@ namespace etl bool compare_exchange_weak(T*& expected, T* desired, etl::memory_order order = etl::memory_order_seq_cst) volatile { - T* old = __sync_val_compare_and_swap(&value, expected, desired); + T* old = (T*)__sync_val_compare_and_swap(&value, uintptr_t(expected), uintptr_t(desired)); if (old == expected) { @@ -642,7 +648,7 @@ namespace etl bool compare_exchange_weak(T*& expected, T* desired, etl::memory_order success, etl::memory_order failure) { - T* old = __sync_val_compare_and_swap(&value, expected, desired); + T* old = (T*)__sync_val_compare_and_swap(&value, uintptr_t(expected), uintptr_t(desired)); if (old == expected) { @@ -657,7 +663,7 @@ namespace etl bool compare_exchange_weak(T*& expected, T* desired, etl::memory_order success, etl::memory_order failure) volatile { - T* old = __sync_val_compare_and_swap(&value, expected, desired); + T* old = (T*)__sync_val_compare_and_swap(&value, uintptr_t(expected), uintptr_t(desired)); if (old == expected) { @@ -740,7 +746,7 @@ namespace etl atomic& operator =(const atomic&); atomic& operator =(const atomic&) volatile; - mutable volatile T* value; + mutable volatile uintptr_t value; }; typedef etl::atomic atomic_char; From 8b334c8a97707e71e5093f9ec12b155cd8debe25 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Tue, 4 Aug 2020 12:01:33 +0100 Subject: [PATCH 04/23] Experimental atomic_gcc_sync change --- include/etl/atomic/atomic_gcc_sync.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/etl/atomic/atomic_gcc_sync.h b/include/etl/atomic/atomic_gcc_sync.h index de19f443..ef673eb9 100644 --- a/include/etl/atomic/atomic_gcc_sync.h +++ b/include/etl/atomic/atomic_gcc_sync.h @@ -607,12 +607,12 @@ namespace etl // Exchange T* exchange(T* v, etl::memory_order order = etl::memory_order_seq_cst) { - return (T*)__sync_lock_test_and_set(&value, v); + return (T*)__sync_lock_test_and_set(&value, uintptr_t(v)); } T* exchange(T* v, etl::memory_order order = etl::memory_order_seq_cst) volatile { - return (T*)__sync_lock_test_and_set(&value, v); + return (T*)__sync_lock_test_and_set(&value, uintptr_t(v)); } // Compare exchange weak From a0a86aa748c18f765f0ae4155c69db8444300827 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Thu, 6 Aug 2020 20:45:52 +0100 Subject: [PATCH 05/23] Added iterator comparisons --- include/etl/deque.h | 93 ++++++++++++++++++++++++++++++++++++++------- test/test_deque.cpp | 6 +++ 2 files changed, 86 insertions(+), 13 deletions(-) diff --git a/include/etl/deque.h b/include/etl/deque.h index 9f64e181..5cd57588 100644 --- a/include/etl/deque.h +++ b/include/etl/deque.h @@ -252,7 +252,7 @@ namespace etl }; public: - + //************************************************************************* /// Iterator //************************************************************************* @@ -377,12 +377,6 @@ namespace etl return &p_buffer[index]; } - //*************************************************** - bool operator <(const iterator& other) const - { - return ideque::distance(*this, other) > 0; - } - //*************************************************** friend iterator operator +(const iterator& lhs, difference_type offset) { @@ -411,6 +405,38 @@ namespace etl return !(lhs == rhs); } + //*************************************************** + friend bool operator < (const iterator& lhs, const iterator& rhs) + { + const difference_type lhs_index = lhs.get_index(); + const difference_type rhs_index = rhs.get_index(); + const difference_type reference_index = lhs.get_deque().begin().get_index(); + const size_t buffer_size = lhs.get_deque().max_size() + 1; + + const difference_type lhs_distance = (lhs_index < reference_index) ? buffer_size + lhs_index - reference_index : lhs_index - reference_index; + const difference_type rhs_distance = (rhs_index < reference_index) ? buffer_size + rhs_index - reference_index : rhs_index - reference_index; + + return lhs_distance < rhs_distance; + } + + //*************************************************** + friend bool operator <= (const iterator& lhs, const iterator& rhs) + { + return !(lhs > rhs); + } + + //*************************************************** + friend bool operator > (const iterator& lhs, const iterator& rhs) + { + return (rhs < lhs); + } + + //*************************************************** + friend bool operator >= (const iterator& lhs, const iterator& rhs) + { + return !(lhs < rhs); + } + //*************************************************** difference_type get_index() const { @@ -439,6 +465,19 @@ namespace etl private: + //*************************************************** + difference_type distance(difference_type firstIndex, difference_type index_) const + { + if (index_ < firstIndex) + { + return p_deque->BUFFER_SIZE + index_ - firstIndex; + } + else + { + return index_ - firstIndex; + } + } + //*************************************************** iterator(difference_type index_, ideque& the_deque, pointer p_buffer_) : index(index_) @@ -580,11 +619,7 @@ namespace etl return &p_buffer[index]; } - //*************************************************** - bool operator <(const const_iterator& other) const - { - return ideque::distance(*this, other) > 0; - } + //*************************************************** friend const_iterator operator +(const const_iterator& lhs, difference_type offset) @@ -614,6 +649,38 @@ namespace etl return !(lhs == rhs); } + //*************************************************** + friend bool operator < (const const_iterator& lhs, const const_iterator& rhs) + { + const difference_type lhs_index = lhs.get_index(); + const difference_type rhs_index = rhs.get_index(); + const difference_type reference_index = lhs.get_deque().begin().get_index(); + const size_t buffer_size = lhs.get_deque().max_size() + 1; + + const difference_type lhs_distance = (lhs_index < reference_index) ? buffer_size + lhs_index - reference_index : lhs_index - reference_index; + const difference_type rhs_distance = (rhs_index < reference_index) ? buffer_size + rhs_index - reference_index : rhs_index - reference_index; + + return lhs_distance < rhs_distance; + } + + //*************************************************** + friend bool operator <= (const const_iterator& lhs, const const_iterator& rhs) + { + return !(lhs > rhs); + } + + //*************************************************** + friend bool operator > (const const_iterator& lhs, const const_iterator& rhs) + { + return (rhs < lhs); + } + + //*************************************************** + friend bool operator >= (const const_iterator& lhs, const const_iterator& rhs) + { + return !(lhs < rhs); + } + //*************************************************** difference_type get_index() const { @@ -641,7 +708,7 @@ namespace etl private: //*************************************************** - difference_type distance(difference_type firstIndex, difference_type index_) + difference_type distance(difference_type firstIndex, difference_type index_) const { if (index_ < firstIndex) { diff --git a/test/test_deque.cpp b/test/test_deque.cpp index ae2cb19f..a7000d8c 100644 --- a/test/test_deque.cpp +++ b/test/test_deque.cpp @@ -538,6 +538,9 @@ namespace CHECK(first < second); CHECK(!(second < first)); + + CHECK(second > first); + CHECK(!(first > second)); } //************************************************************************* @@ -550,6 +553,9 @@ namespace CHECK(first < second); CHECK(!(second < first)); + + CHECK(second > first); + CHECK(!(first > second)); } //************************************************************************* From 5a604e1124fb22174b185924cc233b2f5eda7a54 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Fri, 7 Aug 2020 08:33:25 +0100 Subject: [PATCH 06/23] String stream test << operator --- test/test_string_stream.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/test_string_stream.cpp b/test/test_string_stream.cpp index afef8237..1ce3687a 100644 --- a/test/test_string_stream.cpp +++ b/test/test_string_stream.cpp @@ -60,6 +60,18 @@ namespace return ss; } + //*********************************** + template + std::ostream& operator << (std::ostream& os, const etl::string& str) + { + for (auto c : str) + { + os << c; + } + + return os; + } + //*********************************** std::ostream& operator << (std::ostream& os, const IString& str) { From 744618ceaaa76a823c8b534127917919f8f44ff3 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Fri, 7 Aug 2020 08:44:47 +0100 Subject: [PATCH 07/23] String stream test << operator --- test/test_string_stream.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/test/test_string_stream.cpp b/test/test_string_stream.cpp index 1ce3687a..b1066654 100644 --- a/test/test_string_stream.cpp +++ b/test/test_string_stream.cpp @@ -41,10 +41,10 @@ SOFTWARE. namespace { - using String = etl::string<50>; + using String = etl::string<50>; using IString = etl::istring; - using Stream = etl::string_stream; - using Format = etl::format_spec; + using Stream = etl::string_stream; + using Format = etl::format_spec; //*********************************** struct Custom @@ -82,7 +82,10 @@ namespace return os; } +} +namespace +{ SUITE(test_string_stream) { //************************************************************************* From cb7e224f93492ea175b6e5cbb6e0fa2b2f567667 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Fri, 7 Aug 2020 09:39:14 +0100 Subject: [PATCH 08/23] String stream test << operator --- test/test_string_stream.cpp | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/test/test_string_stream.cpp b/test/test_string_stream.cpp index b1066654..c2a7bb61 100644 --- a/test/test_string_stream.cpp +++ b/test/test_string_stream.cpp @@ -59,19 +59,10 @@ namespace ss << STR("X = ") << value.x << STR(" : Y = ") << value.y; return ss; } +} - //*********************************** - template - std::ostream& operator << (std::ostream& os, const etl::string& str) - { - for (auto c : str) - { - os << c; - } - - return os; - } - +namespace etl +{ //*********************************** std::ostream& operator << (std::ostream& os, const IString& str) { From b5bdb4f566e76e1f6b4d345c6580cab542a6fe08 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Fri, 7 Aug 2020 09:57:34 +0100 Subject: [PATCH 09/23] String stream test << operator in etl namespace --- test/test_string_stream_u16.cpp | 12 +++++++++--- test/test_string_stream_u32.cpp | 12 +++++++++--- test/test_string_stream_wchar_t.cpp | 7 +++++++ 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/test/test_string_stream_u16.cpp b/test/test_string_stream_u16.cpp index 172ec364..dc12868e 100644 --- a/test/test_string_stream_u16.cpp +++ b/test/test_string_stream_u16.cpp @@ -41,10 +41,10 @@ SOFTWARE. namespace { - using String = etl::u16string<50>; + using String = etl::u16string<50>; using IString = etl::iu16string; - using Stream = etl::u16string_stream; - using Format = etl::u16format_spec; + using Stream = etl::u16string_stream; + using Format = etl::u16format_spec; //*********************************** struct Custom @@ -59,7 +59,10 @@ namespace ss << STR("X = ") << value.x << STR(" : Y = ") << value.y; return ss; } +} +namespace etl +{ //*********************************** std::ostream& operator << (std::ostream& os, const IString& str) { @@ -70,7 +73,10 @@ namespace return os; } +} +namespace +{ SUITE(test_string_stream) { //************************************************************************* diff --git a/test/test_string_stream_u32.cpp b/test/test_string_stream_u32.cpp index e32d82cf..af26e830 100644 --- a/test/test_string_stream_u32.cpp +++ b/test/test_string_stream_u32.cpp @@ -41,10 +41,10 @@ SOFTWARE. namespace { - using String = etl::u32string<50>; + using String = etl::u32string<50>; using IString = etl::iu32string; - using Stream = etl::u32string_stream; - using Format = etl::u32format_spec; + using Stream = etl::u32string_stream; + using Format = etl::u32format_spec; //*********************************** struct Custom @@ -59,7 +59,10 @@ namespace ss << STR("X = ") << value.x << STR(" : Y = ") << value.y; return ss; } +} +namespace etl +{ //*********************************** std::ostream& operator << (std::ostream& os, const IString& str) { @@ -70,7 +73,10 @@ namespace return os; } +} +namespace +{ SUITE(test_string_stream) { //************************************************************************* diff --git a/test/test_string_stream_wchar_t.cpp b/test/test_string_stream_wchar_t.cpp index 623913b7..1ca38a37 100644 --- a/test/test_string_stream_wchar_t.cpp +++ b/test/test_string_stream_wchar_t.cpp @@ -59,7 +59,10 @@ namespace ss << STR("X = ") << value.x << STR(" : Y = ") << value.y; return ss; } +} +namespace etl +{ //*********************************** std::ostream& operator << (std::ostream& os, const IString& str) { @@ -70,6 +73,10 @@ namespace return os; } +} + +namespace +{ SUITE(test_string_stream) { From cda46033f1500a274509a49161ba59b0065a41cc Mon Sep 17 00:00:00 2001 From: finger42 <67188554+finger42@users.noreply.github.com> Date: Fri, 7 Aug 2020 19:48:16 +0200 Subject: [PATCH 10/23] cmake and make using same env with CC and CXX (#258) Each "run:" call gets a new environment. With this, the first "run:" is exporting CC and CXX. In this "run:" the cmake stuff is created. The next "run:" to make, is using the default CC and CXX, which is GCC instead of clang. And then some of the stuff is build with clang other with gcc * moved cmake, make and running tests in one "run:" command, so they are sharing the same environment * fixed indention * renamed the name to Build and run * Build build-clang-9-Linux and build-clang-10-osx are similar now. Co-authored-by: finger42 --- .github/workflows/main.yml | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 65b2d26a..e9aa1075 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -34,19 +34,14 @@ jobs: runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v2 - - - name: Setup cmake + - name: Build and run run: | - export CC=clang-9 - export CXX=clang++-9 - cmake -D BUILD_TESTS=ON ./ + export CC=clang-9 + export CXX=clang++-9 + cmake -D BUILD_TESTS=ON ./ + make + ./test/etl_tests - - name: Compile - run: make - - - name: Run tests - run: ./test/etl_tests - - name: Save artifacts uses: actions/upload-artifact@v2 with: From 2544068d643c5e0cf5b029d789ad58eeddfb0e83 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Mon, 3 Aug 2020 20:33:47 +0100 Subject: [PATCH 11/23] YAML modification --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 65b2d26a..c87fd9c6 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -63,4 +63,4 @@ jobs: export CXX=clang++ cmake -D BUILD_TESTS=ON ./ make - ./test/etl_tests \ No newline at end of file + ./test/etl_tests From 8eaeaba62286db4af96c0c682f392f9f64b324ca Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Tue, 4 Aug 2020 11:40:31 +0100 Subject: [PATCH 12/23] Experimental atomic_gcc_sync change --- include/etl/atomic/atomic_gcc_sync.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/etl/atomic/atomic_gcc_sync.h b/include/etl/atomic/atomic_gcc_sync.h index ef673eb9..7443f784 100644 --- a/include/etl/atomic/atomic_gcc_sync.h +++ b/include/etl/atomic/atomic_gcc_sync.h @@ -475,7 +475,7 @@ namespace etl // Pre-increment T* operator ++() { - return (T*)__sync_add_and_fetch(&value, sizeof(T)); + return (T*)__sync_add_and_fetch(&(volatile void*)value, sizeof(T)); } T* operator ++() volatile From ac76c7982869ab33ec7597b79f0dcf463248401b Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Tue, 4 Aug 2020 11:57:53 +0100 Subject: [PATCH 13/23] Experimental atomic_gcc_sync change --- include/etl/atomic/atomic_gcc_sync.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/etl/atomic/atomic_gcc_sync.h b/include/etl/atomic/atomic_gcc_sync.h index 7443f784..ef673eb9 100644 --- a/include/etl/atomic/atomic_gcc_sync.h +++ b/include/etl/atomic/atomic_gcc_sync.h @@ -475,7 +475,7 @@ namespace etl // Pre-increment T* operator ++() { - return (T*)__sync_add_and_fetch(&(volatile void*)value, sizeof(T)); + return (T*)__sync_add_and_fetch(&value, sizeof(T)); } T* operator ++() volatile From ae406d96863bc3c77fd1588dbcd6397632875a0a Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Fri, 7 Aug 2020 08:33:25 +0100 Subject: [PATCH 14/23] String stream test << operator --- test/test_string_stream.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/test_string_stream.cpp b/test/test_string_stream.cpp index c2a7bb61..4fbcaf92 100644 --- a/test/test_string_stream.cpp +++ b/test/test_string_stream.cpp @@ -63,6 +63,18 @@ namespace namespace etl { + //*********************************** + template + std::ostream& operator << (std::ostream& os, const etl::string& str) + { + for (auto c : str) + { + os << c; + } + + return os; + } + //*********************************** std::ostream& operator << (std::ostream& os, const IString& str) { From 9804af32888fcafb11677bfcfeab5aa338ce2911 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Fri, 7 Aug 2020 09:39:14 +0100 Subject: [PATCH 15/23] String stream test << operator --- test/test_string_stream.cpp | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/test/test_string_stream.cpp b/test/test_string_stream.cpp index 4fbcaf92..c2a7bb61 100644 --- a/test/test_string_stream.cpp +++ b/test/test_string_stream.cpp @@ -63,18 +63,6 @@ namespace namespace etl { - //*********************************** - template - std::ostream& operator << (std::ostream& os, const etl::string& str) - { - for (auto c : str) - { - os << c; - } - - return os; - } - //*********************************** std::ostream& operator << (std::ostream& os, const IString& str) { From 254a8d4035724f004f1cf652d9545fbf67b94b9c Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sat, 8 Aug 2020 11:12:52 +0100 Subject: [PATCH 16/23] String stream test << operator in etl namespace --- include/etl/version.h | 2 +- library.json | 2 +- library.properties | 2 +- support/Release notes.txt | 4 +++ test/test_deque.cpp | 70 +++++++++++++++++++++++++++++++++------ 5 files changed, 67 insertions(+), 13 deletions(-) diff --git a/include/etl/version.h b/include/etl/version.h index 088f6bdc..93d64b4a 100644 --- a/include/etl/version.h +++ b/include/etl/version.h @@ -39,7 +39,7 @@ SOFTWARE. #define ETL_VERSION_MAJOR 18 #define ETL_VERSION_MINOR 12 -#define ETL_VERSION_PATCH 3 +#define ETL_VERSION_PATCH 4 #define ETL_VERSION ETL_STRINGIFY(ETL_VERSION_MAJOR) "." ETL_STRINGIFY(ETL_VERSION_MINOR) "." ETL_STRINGIFY(ETL_VERSION_PATCH) #define ETL_VERSION_W ETL_STRINGIFY(ETL_VERSION_MAJOR) L"." ETL_STRINGIFY(ETL_VERSION_MINOR) L"." ETL_STRINGIFY(ETL_VERSION_PATCH) #define ETL_VERSION_U16 ETL_STRINGIFY(ETL_VERSION_MAJOR) u"." ETL_STRINGIFY(ETL_VERSION_MINOR) u"." ETL_STRINGIFY(ETL_VERSION_PATCH) diff --git a/library.json b/library.json index 1f10047b..ad2a269f 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "Embedded Template Library", - "version": "18.12.3", + "version": "18.12.4", "authors": { "name": "John Wellbelove", "email": "john.wellbelove@etlcpp.com" diff --git a/library.properties b/library.properties index 4a136a6d..f28974df 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Embedded Template Library -version=18.12.3 +version=18.12.4 author= John Wellbelove maintainer=John Wellbelove license=MIT diff --git a/support/Release notes.txt b/support/Release notes.txt index 8d735e4f..6e7cfa7d 100644 --- a/support/Release notes.txt +++ b/support/Release notes.txt @@ -1,3 +1,7 @@ +=============================================================================== +18.12.4 +Resolve clang 9 compatibility issues. + =============================================================================== 18.12.3 Resolve 0U constant ambiguity in string utility tests diff --git a/test/test_deque.cpp b/test/test_deque.cpp index a7000d8c..876aa4ea 100644 --- a/test/test_deque.cpp +++ b/test/test_deque.cpp @@ -533,14 +533,39 @@ namespace { DataNDC data(SIZE, N0); - DataNDC::iterator first = data.begin() + 1; - DataNDC::iterator second = data.begin() + 4; + DataNDC::iterator first = data.begin() + 1; + DataNDC::iterator second = data.begin() + 1; + DataNDC::iterator third = data.begin() + 4; - CHECK(first < second); + CHECK(first == second); + CHECK(second == first); + CHECK(!(first == third)); + CHECK(!(third == first)); + + CHECK(!(first != second)); + CHECK(!(second != first)); + CHECK(first != third); + CHECK(third != first); + + CHECK(!(first < second)); CHECK(!(second < first)); + CHECK(first < third); + CHECK(!(third < first)); - CHECK(second > first); - CHECK(!(first > second)); + CHECK(first <= second); + CHECK(second <= first); + CHECK(first <= third); + CHECK(!(third <= first)); + + CHECK(!(first > second)); + CHECK(!(second > first)); + CHECK(!(first > third)); + CHECK(third > first); + + CHECK(first >= second); + CHECK(second >= first); + CHECK(!(first >= third)); + CHECK(third >= first); } //************************************************************************* @@ -548,14 +573,39 @@ namespace { DataNDC data(SIZE, N0); - DataNDC::const_iterator first = data.cbegin() + 1; - DataNDC::const_iterator second = data.cbegin() + 4; + DataNDC::const_iterator first = data.begin() + 1; + DataNDC::const_iterator second = data.begin() + 1; + DataNDC::const_iterator third = data.begin() + 4; - CHECK(first < second); + CHECK(first == second); + CHECK(second == first); + CHECK(!(first == third)); + CHECK(!(third == first)); + + CHECK(!(first != second)); + CHECK(!(second != first)); + CHECK(first != third); + CHECK(third != first); + + CHECK(!(first < second)); CHECK(!(second < first)); + CHECK(first < third); + CHECK(!(third < first)); - CHECK(second > first); - CHECK(!(first > second)); + CHECK(first <= second); + CHECK(second <= first); + CHECK(first <= third); + CHECK(!(third <= first)); + + CHECK(!(first > second)); + CHECK(!(second > first)); + CHECK(!(first > third)); + CHECK(third > first); + + CHECK(first >= second); + CHECK(second >= first); + CHECK(!(first >= third)); + CHECK(third >= first); } //************************************************************************* From e82538eacf8cece8c9ee3429024f786ad3edb855 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Mon, 3 Aug 2020 20:33:47 +0100 Subject: [PATCH 17/23] YAML modification --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index e9aa1075..b73dbf6f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -58,4 +58,4 @@ jobs: export CXX=clang++ cmake -D BUILD_TESTS=ON ./ make - ./test/etl_tests \ No newline at end of file + ./test/etl_tests From b973b01c0811f48dc02b6da40793e1ebff49ad13 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Tue, 4 Aug 2020 11:40:31 +0100 Subject: [PATCH 18/23] Experimental atomic_gcc_sync change --- include/etl/atomic/atomic_gcc_sync.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/etl/atomic/atomic_gcc_sync.h b/include/etl/atomic/atomic_gcc_sync.h index ef673eb9..7443f784 100644 --- a/include/etl/atomic/atomic_gcc_sync.h +++ b/include/etl/atomic/atomic_gcc_sync.h @@ -475,7 +475,7 @@ namespace etl // Pre-increment T* operator ++() { - return (T*)__sync_add_and_fetch(&value, sizeof(T)); + return (T*)__sync_add_and_fetch(&(volatile void*)value, sizeof(T)); } T* operator ++() volatile From 5f0dae41def04714534676d45beb2dd1c2f72d77 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Tue, 4 Aug 2020 11:57:53 +0100 Subject: [PATCH 19/23] Experimental atomic_gcc_sync change --- include/etl/atomic/atomic_gcc_sync.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/etl/atomic/atomic_gcc_sync.h b/include/etl/atomic/atomic_gcc_sync.h index 7443f784..ef673eb9 100644 --- a/include/etl/atomic/atomic_gcc_sync.h +++ b/include/etl/atomic/atomic_gcc_sync.h @@ -475,7 +475,7 @@ namespace etl // Pre-increment T* operator ++() { - return (T*)__sync_add_and_fetch(&(volatile void*)value, sizeof(T)); + return (T*)__sync_add_and_fetch(&value, sizeof(T)); } T* operator ++() volatile From d389f06cdff2367ed22856b62d81ea23cb01461d Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Fri, 7 Aug 2020 08:33:25 +0100 Subject: [PATCH 20/23] String stream test << operator --- test/test_string_stream.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/test_string_stream.cpp b/test/test_string_stream.cpp index c2a7bb61..4fbcaf92 100644 --- a/test/test_string_stream.cpp +++ b/test/test_string_stream.cpp @@ -63,6 +63,18 @@ namespace namespace etl { + //*********************************** + template + std::ostream& operator << (std::ostream& os, const etl::string& str) + { + for (auto c : str) + { + os << c; + } + + return os; + } + //*********************************** std::ostream& operator << (std::ostream& os, const IString& str) { From 1f2fd18d8833c1cac546dd2d77c19339ed3bf069 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Fri, 7 Aug 2020 09:39:14 +0100 Subject: [PATCH 21/23] String stream test << operator --- test/test_string_stream.cpp | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/test/test_string_stream.cpp b/test/test_string_stream.cpp index 4fbcaf92..c2a7bb61 100644 --- a/test/test_string_stream.cpp +++ b/test/test_string_stream.cpp @@ -63,18 +63,6 @@ namespace namespace etl { - //*********************************** - template - std::ostream& operator << (std::ostream& os, const etl::string& str) - { - for (auto c : str) - { - os << c; - } - - return os; - } - //*********************************** std::ostream& operator << (std::ostream& os, const IString& str) { From 50b60c025de6a5f8ee4bb2544ea3ac1c8bb451e3 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sat, 8 Aug 2020 11:12:52 +0100 Subject: [PATCH 22/23] String stream test << operator in etl namespace --- include/etl/version.h | 2 +- library.json | 2 +- library.properties | 2 +- support/Release notes.txt | 4 +++ test/test_deque.cpp | 70 +++++++++++++++++++++++++++++++++------ 5 files changed, 67 insertions(+), 13 deletions(-) diff --git a/include/etl/version.h b/include/etl/version.h index 088f6bdc..93d64b4a 100644 --- a/include/etl/version.h +++ b/include/etl/version.h @@ -39,7 +39,7 @@ SOFTWARE. #define ETL_VERSION_MAJOR 18 #define ETL_VERSION_MINOR 12 -#define ETL_VERSION_PATCH 3 +#define ETL_VERSION_PATCH 4 #define ETL_VERSION ETL_STRINGIFY(ETL_VERSION_MAJOR) "." ETL_STRINGIFY(ETL_VERSION_MINOR) "." ETL_STRINGIFY(ETL_VERSION_PATCH) #define ETL_VERSION_W ETL_STRINGIFY(ETL_VERSION_MAJOR) L"." ETL_STRINGIFY(ETL_VERSION_MINOR) L"." ETL_STRINGIFY(ETL_VERSION_PATCH) #define ETL_VERSION_U16 ETL_STRINGIFY(ETL_VERSION_MAJOR) u"." ETL_STRINGIFY(ETL_VERSION_MINOR) u"." ETL_STRINGIFY(ETL_VERSION_PATCH) diff --git a/library.json b/library.json index 1f10047b..ad2a269f 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "Embedded Template Library", - "version": "18.12.3", + "version": "18.12.4", "authors": { "name": "John Wellbelove", "email": "john.wellbelove@etlcpp.com" diff --git a/library.properties b/library.properties index 4a136a6d..f28974df 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Embedded Template Library -version=18.12.3 +version=18.12.4 author= John Wellbelove maintainer=John Wellbelove license=MIT diff --git a/support/Release notes.txt b/support/Release notes.txt index 8d735e4f..6e7cfa7d 100644 --- a/support/Release notes.txt +++ b/support/Release notes.txt @@ -1,3 +1,7 @@ +=============================================================================== +18.12.4 +Resolve clang 9 compatibility issues. + =============================================================================== 18.12.3 Resolve 0U constant ambiguity in string utility tests diff --git a/test/test_deque.cpp b/test/test_deque.cpp index a7000d8c..876aa4ea 100644 --- a/test/test_deque.cpp +++ b/test/test_deque.cpp @@ -533,14 +533,39 @@ namespace { DataNDC data(SIZE, N0); - DataNDC::iterator first = data.begin() + 1; - DataNDC::iterator second = data.begin() + 4; + DataNDC::iterator first = data.begin() + 1; + DataNDC::iterator second = data.begin() + 1; + DataNDC::iterator third = data.begin() + 4; - CHECK(first < second); + CHECK(first == second); + CHECK(second == first); + CHECK(!(first == third)); + CHECK(!(third == first)); + + CHECK(!(first != second)); + CHECK(!(second != first)); + CHECK(first != third); + CHECK(third != first); + + CHECK(!(first < second)); CHECK(!(second < first)); + CHECK(first < third); + CHECK(!(third < first)); - CHECK(second > first); - CHECK(!(first > second)); + CHECK(first <= second); + CHECK(second <= first); + CHECK(first <= third); + CHECK(!(third <= first)); + + CHECK(!(first > second)); + CHECK(!(second > first)); + CHECK(!(first > third)); + CHECK(third > first); + + CHECK(first >= second); + CHECK(second >= first); + CHECK(!(first >= third)); + CHECK(third >= first); } //************************************************************************* @@ -548,14 +573,39 @@ namespace { DataNDC data(SIZE, N0); - DataNDC::const_iterator first = data.cbegin() + 1; - DataNDC::const_iterator second = data.cbegin() + 4; + DataNDC::const_iterator first = data.begin() + 1; + DataNDC::const_iterator second = data.begin() + 1; + DataNDC::const_iterator third = data.begin() + 4; - CHECK(first < second); + CHECK(first == second); + CHECK(second == first); + CHECK(!(first == third)); + CHECK(!(third == first)); + + CHECK(!(first != second)); + CHECK(!(second != first)); + CHECK(first != third); + CHECK(third != first); + + CHECK(!(first < second)); CHECK(!(second < first)); + CHECK(first < third); + CHECK(!(third < first)); - CHECK(second > first); - CHECK(!(first > second)); + CHECK(first <= second); + CHECK(second <= first); + CHECK(first <= third); + CHECK(!(third <= first)); + + CHECK(!(first > second)); + CHECK(!(second > first)); + CHECK(!(first > third)); + CHECK(third > first); + + CHECK(first >= second); + CHECK(second >= first); + CHECK(!(first >= third)); + CHECK(third >= first); } //************************************************************************* From efbfc5c8ffe724171b3467fdd63827656c31818b Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Sun, 9 Aug 2020 17:01:45 +0100 Subject: [PATCH 23/23] clang 9 compatibility --- .gitignore | 1 + include/etl/{ => experimental}/variant_new.h | 0 test/CMakeLists.txt | 8 ++- test/codeblocks/ETL.cbp | 4 ++ test/test_atomic_gcc_sync.cpp | 42 +++++++++++++ test/test_atomic_std.cpp | 63 ++++++++++++++++++++ test/test_callback_timer.cpp | 4 +- test/test_message_timer.cpp | 3 +- test/test_queue_mpmc_mutex.cpp | 2 +- test/test_queue_mpmc_mutex_small.cpp | 2 +- test/test_queue_spsc_atomic.cpp | 2 +- test/test_queue_spsc_atomic_small.cpp | 2 +- test/test_queue_spsc_isr.cpp | 5 +- test/test_queue_spsc_isr_small.cpp | 5 +- test/test_queue_spsc_locked.cpp | 5 +- test/test_queue_spsc_locked_small.cpp | 9 +-- 16 files changed, 140 insertions(+), 17 deletions(-) rename include/etl/{ => experimental}/variant_new.h (100%) diff --git a/.gitignore b/.gitignore index 4b550b45..77faf521 100644 --- a/.gitignore +++ b/.gitignore @@ -258,3 +258,4 @@ build-test-Desktop_x86_windows_msvc2019_pe_32bit-Debug test/vs2019/.vs Corel Auto-Preserve test/vs2019/Debug No Unit Tests +test/kdevelopbuild diff --git a/include/etl/variant_new.h b/include/etl/experimental/variant_new.h similarity index 100% rename from include/etl/variant_new.h rename to include/etl/experimental/variant_new.h diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index caba0ea6..06121a05 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -173,7 +173,13 @@ add_executable(etl_tests if(UNIX AND NOT APPLE) # atomic is need on Linux with Clang - target_link_libraries(etl_tests UnitTest++ atomic) + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) + target_link_libraries(etl_tests UnitTest++ atomic Threads::Threads) +elseif(NOT UNIX AND APPLE) + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads REQUIRED) + target_link_libraries(etl_tests UnitTest++) else() target_link_libraries(etl_tests UnitTest++) endif() diff --git a/test/codeblocks/ETL.cbp b/test/codeblocks/ETL.cbp index 51483503..9d532038 100644 --- a/test/codeblocks/ETL.cbp +++ b/test/codeblocks/ETL.cbp @@ -63,6 +63,7 @@ + @@ -97,6 +98,9 @@ + + + diff --git a/test/test_atomic_gcc_sync.cpp b/test/test_atomic_gcc_sync.cpp index ec6cee80..67ad4e93 100644 --- a/test/test_atomic_gcc_sync.cpp +++ b/test/test_atomic_gcc_sync.cpp @@ -32,6 +32,9 @@ SOFTWARE. #include "etl/atomic/atomic_gcc_sync.h" #include +#include + +#define REALTIME_TEST 1 namespace { @@ -480,5 +483,44 @@ namespace CHECK_EQUAL(compare_expected, test_expected); CHECK_EQUAL(compare.load(), test.load()); } + + //========================================================================= + #if REALTIME_TEST + etl::atomic_int32_t atomic_value = 0U; + etl::atomic atomic_flag = false; + + void thread1() + { + while (!atomic_flag.load()); + + for (int i = 0; i < 10000000; ++i) + { + ++atomic_value; + } + } + + void thread2() + { + while (!atomic_flag.load()); + + for (int i = 0; i < 10000000; ++i) + { + --atomic_value; + } + } + + TEST(test_atomic_multi_thread) + { + std::thread t1(thread1); + std::thread t2(thread2); + + atomic_flag.store(true); + + t1.join(); + t2.join(); + + CHECK_EQUAL(0, atomic_value.load()); + } + #endif }; } diff --git a/test/test_atomic_std.cpp b/test/test_atomic_std.cpp index d34d491d..ea98228b 100644 --- a/test/test_atomic_std.cpp +++ b/test/test_atomic_std.cpp @@ -32,6 +32,13 @@ SOFTWARE. #include "etl/atomic/atomic_std.h" #include +#include + +#if defined(ETL_TARGET_OS_WINDOWS) + #include +#endif + +#define REALTIME_TEST 1 namespace { @@ -480,5 +487,61 @@ namespace CHECK_EQUAL(compare_expected, test_expected); CHECK_EQUAL(compare.load(), test.load()); } + + //========================================================================= +#if REALTIME_TEST + +#if defined(ETL_TARGET_OS_WINDOWS) // Only Windows priority is currently supported + #define RAISE_THREAD_PRIORITY SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST) + #define FIX_PROCESSOR_AFFINITY1 SetThreadAffinityMask(GetCurrentThread(), 1) + #define FIX_PROCESSOR_AFFINITY2 SetThreadAffinityMask(GetCurrentThread(), 2) +#else + #define RAISE_THREAD_PRIORITY + #define FIX_PROCESSOR_AFFINITY1 + #define FIX_PROCESSOR_AFFINITY2 +#endif + + etl::atomic_int32_t atomic_value = 0U; + etl::atomic start = false; + + void thread1() + { + RAISE_THREAD_PRIORITY; + FIX_PROCESSOR_AFFINITY1; + + while (!start.load()); + + for (int i = 0; i < 10000000; ++i) + { + ++atomic_value; + } + } + + void thread2() + { + RAISE_THREAD_PRIORITY; + FIX_PROCESSOR_AFFINITY2; + + while (!start.load()); + + for (int i = 0; i < 10000000; ++i) + { + --atomic_value; + } + } + + TEST(test_atomic_multi_thread) + { + std::thread t1(thread1); + std::thread t2(thread2); + + start.store(true); + + t1.join(); + t2.join(); + + CHECK_EQUAL(0, atomic_value.load()); + } +#endif }; } diff --git a/test/test_callback_timer.cpp b/test/test_callback_timer.cpp index 7a047e6c..8aeb924b 100644 --- a/test/test_callback_timer.cpp +++ b/test/test_callback_timer.cpp @@ -55,6 +55,7 @@ namespace public: Test() + : p_controller(nullptr) { } @@ -684,7 +685,8 @@ namespace #define RAISE_THREAD_PRIORITY SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST) #define FIX_PROCESSOR_AFFINITY SetThreadAffinityMask(GetCurrentThread(), 1); #else - #error No thread priority modifier defined + #define RAISE_THREAD_PRIORITY + #define FIX_PROCESSOR_AFFINITY #endif etl::callback_timer<3> controller; diff --git a/test/test_message_timer.cpp b/test/test_message_timer.cpp index a5eb6b1f..064ba063 100644 --- a/test/test_message_timer.cpp +++ b/test/test_message_timer.cpp @@ -601,7 +601,8 @@ namespace #define RAISE_THREAD_PRIORITY SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST) #define FIX_PROCESSOR_AFFINITY SetThreadAffinityMask(GetCurrentThread(), 1); #else - #error No thread priority modifier defined + #define RAISE_THREAD_PRIORITY + #define FIX_PROCESSOR_AFFINITY #endif etl::message_timer<3> controller; diff --git a/test/test_queue_mpmc_mutex.cpp b/test/test_queue_mpmc_mutex.cpp index 8b48555a..ed7fb3fe 100644 --- a/test/test_queue_mpmc_mutex.cpp +++ b/test/test_queue_mpmc_mutex.cpp @@ -41,7 +41,7 @@ SOFTWARE. #if ETL_HAS_MUTEX -#if defined(ETL_COMPILER_MICROSOFT) +#if defined(ETL_TARGET_OS_WINDOWS) #include #endif diff --git a/test/test_queue_mpmc_mutex_small.cpp b/test/test_queue_mpmc_mutex_small.cpp index 2042841f..01a1d131 100644 --- a/test/test_queue_mpmc_mutex_small.cpp +++ b/test/test_queue_mpmc_mutex_small.cpp @@ -41,7 +41,7 @@ SOFTWARE. #if ETL_HAS_MUTEX -#if defined(ETL_COMPILER_MICROSOFT) +#if defined(ETL_TARGET_OS_WINDOWS) #include #endif diff --git a/test/test_queue_spsc_atomic.cpp b/test/test_queue_spsc_atomic.cpp index 4534487a..f961aa80 100644 --- a/test/test_queue_spsc_atomic.cpp +++ b/test/test_queue_spsc_atomic.cpp @@ -38,7 +38,7 @@ SOFTWARE. #if ETL_HAS_ATOMIC -#if defined(ETL_COMPILER_MICROSOFT) +#if defined(ETL_TARGET_OS_WINDOWS) #include #endif diff --git a/test/test_queue_spsc_atomic_small.cpp b/test/test_queue_spsc_atomic_small.cpp index 1f050c98..4a8ccc1d 100644 --- a/test/test_queue_spsc_atomic_small.cpp +++ b/test/test_queue_spsc_atomic_small.cpp @@ -38,7 +38,7 @@ SOFTWARE. #if ETL_HAS_ATOMIC -#if defined(ETL_COMPILER_MICROSOFT) +#if defined(ETL_TARGET_OS_WINDOWS) #include #endif diff --git a/test/test_queue_spsc_isr.cpp b/test/test_queue_spsc_isr.cpp index 269cf5e0..a3433af4 100644 --- a/test/test_queue_spsc_isr.cpp +++ b/test/test_queue_spsc_isr.cpp @@ -571,12 +571,13 @@ namespace } //************************************************************************* -#if REALTIME_TEST && defined(ETL_COMPILER_MICROSOFT) +#if REALTIME_TEST #if defined(ETL_TARGET_OS_WINDOWS) // Only Windows priority is currently supported #define RAISE_THREAD_PRIORITY SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST) #define FIX_PROCESSOR_AFFINITY SetThreadAffinityMask(GetCurrentThread(), 1); #else - #error No thread priority modifier defined + #define RAISE_THREAD_PRIORITY + #define FIX_PROCESSOR_AFFINITY #endif size_t ticks = 0; diff --git a/test/test_queue_spsc_isr_small.cpp b/test/test_queue_spsc_isr_small.cpp index 9a8efb5d..0dbc33f3 100644 --- a/test/test_queue_spsc_isr_small.cpp +++ b/test/test_queue_spsc_isr_small.cpp @@ -589,12 +589,13 @@ namespace } //************************************************************************* -#if REALTIME_TEST && defined(ETL_COMPILER_MICROSOFT) +#if REALTIME_TEST #if defined(ETL_TARGET_OS_WINDOWS) // Only Windows priority is currently supported #define RAISE_THREAD_PRIORITY SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST) #define FIX_PROCESSOR_AFFINITY SetThreadAffinityMask(GetCurrentThread(), 1); #else - #error No thread priority modifier defined + #define RAISE_THREAD_PRIORITY + #define FIX_PROCESSOR_AFFINITY #endif size_t ticks = 0; diff --git a/test/test_queue_spsc_locked.cpp b/test/test_queue_spsc_locked.cpp index ff07d575..c0e14308 100644 --- a/test/test_queue_spsc_locked.cpp +++ b/test/test_queue_spsc_locked.cpp @@ -574,12 +574,13 @@ namespace } //************************************************************************* -#if REALTIME_TEST && defined(ETL_COMPILER_MICROSOFT) +#if REALTIME_TEST #if defined(ETL_TARGET_OS_WINDOWS) // Only Windows priority is currently supported #define RAISE_THREAD_PRIORITY SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST) #define FIX_PROCESSOR_AFFINITY SetThreadAffinityMask(GetCurrentThread(), 1); #else - #error No thread priority modifier defined + #define RAISE_THREAD_PRIORITY + #define FIX_PROCESSOR_AFFINITY #endif size_t ticks = 0; diff --git a/test/test_queue_spsc_locked_small.cpp b/test/test_queue_spsc_locked_small.cpp index 6f58bd05..b8bdbb94 100644 --- a/test/test_queue_spsc_locked_small.cpp +++ b/test/test_queue_spsc_locked_small.cpp @@ -34,7 +34,7 @@ SOFTWARE. #include #include -#if defined(ETL_COMPILER_MICROSOFT) +#if defined(ETL_TARGET_OS_WINDOWS) #include #endif @@ -591,12 +591,13 @@ namespace } //************************************************************************* -#if REALTIME_TEST && defined(ETL_COMPILER_MICROSOFT) - #if defined(ETL_TARGET_OS_WINDOWS) // Only Windows priority is currently supported +#if REALTIME_TEST +#if defined(ETL_TARGET_OS_WINDOWS) // Only Windows priority is currently supported #define RAISE_THREAD_PRIORITY SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_HIGHEST) #define FIX_PROCESSOR_AFFINITY SetThreadAffinityMask(GetCurrentThread(), 1); #else - #error No thread priority modifier defined + #define RAISE_THREAD_PRIORITY + #define FIX_PROCESSOR_AFFINITY #endif size_t ticks = 0;