diff --git a/arduino/library-arduino.json b/arduino/library-arduino.json index 41574884e..2ccb92b3f 100644 --- a/arduino/library-arduino.json +++ b/arduino/library-arduino.json @@ -1,6 +1,6 @@ { "name": "Embedded Template Library - Arduino", - "version": "20.35.12", + "version": "20.35.13", "authors": { "name": "John Wellbelove", "email": "john.wellbelove@etlcpp.com" diff --git a/arduino/library-arduino.properties b/arduino/library-arduino.properties index 42e912560..24c15beac 100644 --- a/arduino/library-arduino.properties +++ b/arduino/library-arduino.properties @@ -1,5 +1,5 @@ name=Embedded Template Library - Arduino -version=20.35.12 +version=20.35.13 author= John Wellbelove maintainer=John Wellbelove license=MIT diff --git a/include/etl/exception.h b/include/etl/exception.h index 862e829a8..90ab6e722 100644 --- a/include/etl/exception.h +++ b/include/etl/exception.h @@ -66,11 +66,10 @@ namespace etl /// Constructor. //************************************************************************* ETL_CONSTEXPR - exception(string_type reason_, string_type file_, numeric_type line_) + exception(string_type reason_, string_type /*file_*/, numeric_type line_) : reason_text(reason_), line(line_) { - (void)file_; } #endif diff --git a/include/etl/fixed_sized_memory_block_allocator.h b/include/etl/fixed_sized_memory_block_allocator.h index 8f8b87bba..e48a278a2 100644 --- a/include/etl/fixed_sized_memory_block_allocator.h +++ b/include/etl/fixed_sized_memory_block_allocator.h @@ -46,6 +46,7 @@ namespace etl class fixed_sized_memory_block_allocator : public imemory_block_allocator { public: + static ETL_CONSTANT size_t Block_Size = VBlock_Size; static ETL_CONSTANT size_t Alignment = VAlignment; static ETL_CONSTANT size_t Size = VSize; @@ -57,13 +58,7 @@ namespace etl { } - private: - - /// A structure that has the size Block_Size. - struct block - { - char data[Block_Size]; - }; + protected: //************************************************************************* /// The overridden virtual function to allocate a block. @@ -71,8 +66,8 @@ namespace etl virtual void* allocate_block(size_t required_size, size_t required_alignment) ETL_OVERRIDE { if ((required_alignment <= Alignment) && - (required_size <= Block_Size) && - !pool.full()) + (required_size <= Block_Size) && + !pool.full()) { return pool.template allocate(); } @@ -106,6 +101,14 @@ namespace etl return pool.is_in_pool(pblock); } + private: + + /// A structure that has the size Block_Size. + struct block + { + char data[Block_Size]; + }; + /// The generic pool from which allocate memory blocks. etl::generic_pool pool; }; diff --git a/include/etl/message_packet.h b/include/etl/message_packet.h index 94665e8a6..248e2daa4 100644 --- a/include/etl/message_packet.h +++ b/include/etl/message_packet.h @@ -286,9 +286,6 @@ namespace etl new (p) etl::remove_reference_t((etl::forward(msg))); } - typename etl::aligned_storage::type data; - bool valid; - //******************************************** template bool add_new_message_type(const etl::imessage& msg) @@ -320,6 +317,9 @@ namespace etl return false; } } + + typename etl::aligned_storage::type data; + bool valid; }; #else @@ -543,7 +543,7 @@ namespace etl private: //******************************************** -#include "etl/private/diagnostic_uninitialized_push.h" + #include "etl/private/diagnostic_uninitialized_push.h" void delete_current_message() { if (valid) @@ -553,7 +553,7 @@ namespace etl pmsg->~imessage(); } } -#include "etl/private/diagnostic_pop.h" + #include "etl/private/diagnostic_pop.h" //******************************************** void add_new_message(const etl::imessage& msg) @@ -836,7 +836,7 @@ namespace etl private: //******************************************** -#include "etl/private/diagnostic_uninitialized_push.h" + #include "etl/private/diagnostic_uninitialized_push.h" void delete_current_message() { if (valid) @@ -846,7 +846,7 @@ namespace etl pmsg->~imessage(); } } -#include "etl/private/diagnostic_pop.h" + #include "etl/private/diagnostic_pop.h" //******************************************** void add_new_message(const etl::imessage& msg) @@ -1127,7 +1127,7 @@ namespace etl private: //******************************************** -#include "etl/private/diagnostic_uninitialized_push.h" + #include "etl/private/diagnostic_uninitialized_push.h" void delete_current_message() { if (valid) @@ -1137,7 +1137,7 @@ namespace etl pmsg->~imessage(); } } -#include "etl/private/diagnostic_pop.h" + #include "etl/private/diagnostic_pop.h" //******************************************** void add_new_message(const etl::imessage& msg) @@ -1416,7 +1416,7 @@ namespace etl private: //******************************************** -#include "etl/private/diagnostic_uninitialized_push.h" + #include "etl/private/diagnostic_uninitialized_push.h" void delete_current_message() { if (valid) @@ -1426,7 +1426,7 @@ namespace etl pmsg->~imessage(); } } -#include "etl/private/diagnostic_pop.h" + #include "etl/private/diagnostic_pop.h" //******************************************** void add_new_message(const etl::imessage& msg) @@ -1699,7 +1699,7 @@ namespace etl private: //******************************************** -#include "etl/private/diagnostic_uninitialized_push.h" + #include "etl/private/diagnostic_uninitialized_push.h" void delete_current_message() { if (valid) @@ -1709,7 +1709,7 @@ namespace etl pmsg->~imessage(); } } -#include "etl/private/diagnostic_pop.h" + #include "etl/private/diagnostic_pop.h" //******************************************** void add_new_message(const etl::imessage& msg) @@ -1980,7 +1980,7 @@ namespace etl private: //******************************************** -#include "etl/private/diagnostic_uninitialized_push.h" + #include "etl/private/diagnostic_uninitialized_push.h" void delete_current_message() { if (valid) @@ -1990,7 +1990,7 @@ namespace etl pmsg->~imessage(); } } -#include "etl/private/diagnostic_pop.h" + #include "etl/private/diagnostic_pop.h" //******************************************** void add_new_message(const etl::imessage& msg) @@ -2259,7 +2259,7 @@ namespace etl private: //******************************************** -#include "etl/private/diagnostic_uninitialized_push.h" + #include "etl/private/diagnostic_uninitialized_push.h" void delete_current_message() { if (valid) @@ -2269,7 +2269,7 @@ namespace etl pmsg->~imessage(); } } -#include "etl/private/diagnostic_pop.h" + #include "etl/private/diagnostic_pop.h" //******************************************** void add_new_message(const etl::imessage& msg) @@ -2536,7 +2536,7 @@ namespace etl private: //******************************************** -#include "etl/private/diagnostic_uninitialized_push.h" + #include "etl/private/diagnostic_uninitialized_push.h" void delete_current_message() { if (valid) @@ -2546,7 +2546,7 @@ namespace etl pmsg->~imessage(); } } -#include "etl/private/diagnostic_pop.h" + #include "etl/private/diagnostic_pop.h" //******************************************** void add_new_message(const etl::imessage& msg) @@ -2807,7 +2807,7 @@ namespace etl private: //******************************************** -#include "etl/private/diagnostic_uninitialized_push.h" + #include "etl/private/diagnostic_uninitialized_push.h" void delete_current_message() { if (valid) @@ -2817,7 +2817,7 @@ namespace etl pmsg->~imessage(); } } -#include "etl/private/diagnostic_pop.h" + #include "etl/private/diagnostic_pop.h" //******************************************** void add_new_message(const etl::imessage& msg) @@ -3076,7 +3076,7 @@ namespace etl private: //******************************************** -#include "etl/private/diagnostic_uninitialized_push.h" + #include "etl/private/diagnostic_uninitialized_push.h" void delete_current_message() { if (valid) @@ -3086,7 +3086,7 @@ namespace etl pmsg->~imessage(); } } -#include "etl/private/diagnostic_pop.h" + #include "etl/private/diagnostic_pop.h" //******************************************** void add_new_message(const etl::imessage& msg) @@ -3343,7 +3343,7 @@ namespace etl private: //******************************************** -#include "etl/private/diagnostic_uninitialized_push.h" + #include "etl/private/diagnostic_uninitialized_push.h" void delete_current_message() { if (valid) @@ -3353,7 +3353,7 @@ namespace etl pmsg->~imessage(); } } -#include "etl/private/diagnostic_pop.h" + #include "etl/private/diagnostic_pop.h" //******************************************** void add_new_message(const etl::imessage& msg) @@ -3608,7 +3608,7 @@ namespace etl private: //******************************************** -#include "etl/private/diagnostic_uninitialized_push.h" + #include "etl/private/diagnostic_uninitialized_push.h" void delete_current_message() { if (valid) @@ -3618,7 +3618,7 @@ namespace etl pmsg->~imessage(); } } -#include "etl/private/diagnostic_pop.h" + #include "etl/private/diagnostic_pop.h" //******************************************** void add_new_message(const etl::imessage& msg) @@ -3867,7 +3867,7 @@ namespace etl private: //******************************************** -#include "etl/private/diagnostic_uninitialized_push.h" + #include "etl/private/diagnostic_uninitialized_push.h" void delete_current_message() { if (valid) @@ -3877,7 +3877,7 @@ namespace etl pmsg->~imessage(); } } -#include "etl/private/diagnostic_pop.h" + #include "etl/private/diagnostic_pop.h" //******************************************** void add_new_message(const etl::imessage& msg) @@ -4124,7 +4124,7 @@ namespace etl private: //******************************************** -#include "etl/private/diagnostic_uninitialized_push.h" + #include "etl/private/diagnostic_uninitialized_push.h" void delete_current_message() { if (valid) @@ -4134,7 +4134,7 @@ namespace etl pmsg->~imessage(); } } -#include "etl/private/diagnostic_pop.h" + #include "etl/private/diagnostic_pop.h" //******************************************** void add_new_message(const etl::imessage& msg) @@ -4379,7 +4379,7 @@ namespace etl private: //******************************************** -#include "etl/private/diagnostic_uninitialized_push.h" + #include "etl/private/diagnostic_uninitialized_push.h" void delete_current_message() { if (valid) @@ -4389,7 +4389,7 @@ namespace etl pmsg->~imessage(); } } -#include "etl/private/diagnostic_pop.h" + #include "etl/private/diagnostic_pop.h" //******************************************** void add_new_message(const etl::imessage& msg) @@ -4632,7 +4632,7 @@ namespace etl private: //******************************************** -#include "etl/private/diagnostic_uninitialized_push.h" + #include "etl/private/diagnostic_uninitialized_push.h" void delete_current_message() { if (valid) @@ -4642,7 +4642,7 @@ namespace etl pmsg->~imessage(); } } -#include "etl/private/diagnostic_pop.h" + #include "etl/private/diagnostic_pop.h" //******************************************** void add_new_message(const etl::imessage& msg) diff --git a/include/etl/optional.h b/include/etl/optional.h index 159f1ddb5..5843188f0 100644 --- a/include/etl/optional.h +++ b/include/etl/optional.h @@ -60,7 +60,7 @@ namespace etl private: // Can't take address of nullopt. - void operator&() const; + void operator&() const ETL_DELETE; }; //***************************************************************************** @@ -115,7 +115,6 @@ namespace etl { public: -#include "etl/private/diagnostic_uninitialized_push.h" //*************************************************************************** /// Constructor. //*************************************************************************** @@ -188,7 +187,6 @@ namespace etl { storage.destroy(); } -#include "etl/private/diagnostic_pop.h" //*************************************************************************** /// Assignment operator from nullopt. @@ -282,7 +280,7 @@ namespace etl ETL_ASSERT(has_value(), ETL_ERROR(optional_invalid)); #endif - return &storage.value; + return &storage.u.value; } //*************************************************************************** @@ -295,7 +293,7 @@ namespace etl ETL_ASSERT(has_value(), ETL_ERROR(optional_invalid)); #endif - return &storage.value; + return &storage.u.value; } //*************************************************************************** @@ -308,7 +306,7 @@ namespace etl ETL_ASSERT(has_value(), ETL_ERROR(optional_invalid)); #endif - return storage.value; + return storage.u.value; } //*************************************************************************** @@ -321,7 +319,7 @@ namespace etl ETL_ASSERT(has_value(), ETL_ERROR(optional_invalid)); #endif - return storage.value; + return storage.u.value; } //*************************************************************************** @@ -422,7 +420,10 @@ namespace etl storage.destroy(); } - ::new (&storage.value) T(value1); + T* p = ::new (&storage.u.value) T(value1); + storage.valid = true; + + return *p; } //************************************************************************* @@ -438,7 +439,10 @@ namespace etl storage.destroy(); } - ::new (&storage.value) T(value1, value2); + T* p = ::new (&storage.u.value) T(value1, value2); + storage.valid = true; + + return *p; } //************************************************************************* @@ -454,7 +458,10 @@ namespace etl storage.destroy(); } - ::new (&storage.value) T(value1, value2, value3); + T* p = ::new (&storage.u.value) T(value1, value2, value3); + storage.valid = true; + + return *p; } //************************************************************************* @@ -470,7 +477,10 @@ namespace etl storage.destroy(); } - ::new (&storage.value) T(value1, value2, value3, value4); + T* p = ::new (&storage.u.value) T(value1, value2, value3, value4); + storage.valid = true; + + return *p; } #endif @@ -484,7 +494,6 @@ namespace etl : u() , valid(false) { - u.dummy = 0; } //******************************* @@ -878,17 +887,19 @@ namespace etl T storage; }; +#include "etl/private/diagnostic_uninitialized_push.h" + //*************************************************************************** /// Equality operator. cppreference 1 //*************************************************************************** template ETL_CONSTEXPR14 bool operator ==(const etl::optional& lhs, const etl::optional& rhs) { - if (bool(lhs) != bool(rhs)) + if (lhs.has_value() != rhs.has_value()) { return false; } - else if (!bool(lhs) && !bool(rhs)) + else if (!lhs.has_value() && !rhs.has_value()) { return true; } @@ -913,11 +924,11 @@ namespace etl template ETL_CONSTEXPR14 bool operator <(const etl::optional& lhs, const etl::optional& rhs) { - if (!bool(rhs)) + if (!rhs.has_value()) { return false; } - else if (!bool(lhs)) + else if (!lhs.has_value()) { return true; } @@ -933,18 +944,20 @@ namespace etl template ETL_CONSTEXPR14 bool operator <=(const etl::optional& lhs, const etl::optional& rhs) { - if (!bool(lhs)) - { - return true; - } - else if (!bool(rhs)) - { - return false; - } - else - { - return lhs.value() <= rhs.value(); - } + return !(rhs < lhs); + + //if (!lhs.has_value()) + //{ + // return true; + //} + //else if (!rhs.has_value()) + //{ + // return false; + //} + //else + //{ + // return lhs.value() <= rhs.value(); + //} } //*************************************************************************** @@ -953,18 +966,20 @@ namespace etl template ETL_CONSTEXPR14 bool operator >(const etl::optional& lhs, const etl::optional& rhs) { - if (!bool(lhs)) - { - return false; - } - else if (!bool(rhs)) - { - return true; - } - else - { - return lhs.value() > rhs.value(); - } + return (rhs < lhs); + + //if (!lhs.has_value()) + //{ + // return false; + //} + //else if (!rhs.has_value()) + //{ + // return true; + //} + //else + //{ + // return lhs.value() > rhs.value(); + //} } //*************************************************************************** @@ -973,18 +988,20 @@ namespace etl template ETL_CONSTEXPR14 bool operator >=(const etl::optional& lhs, const etl::optional& rhs) { - if (!bool(rhs)) - { - return true; - } - else if (!bool(lhs)) - { - return false; - } - else - { - return lhs.value() >= rhs.value(); - } + return !(lhs < rhs); + + //if (!rhs.has_value()) + //{ + // return true; + //} + //else if (!lhs.has_value()) + //{ + // return false; + //} + //else + //{ + // return lhs.value() >= rhs.value(); + //} } //*************************************************************************** @@ -993,7 +1010,7 @@ namespace etl template ETL_CONSTEXPR14 bool operator ==(const etl::optional& lhs, etl::nullopt_t) { - return !bool(lhs); + return !lhs.has_value(); } //*************************************************************************** @@ -1002,7 +1019,7 @@ namespace etl template ETL_CONSTEXPR14 bool operator ==(etl::nullopt_t, const etl::optional& rhs) { - return !bool(rhs); + return !rhs.has_value(); } //*************************************************************************** @@ -1038,7 +1055,7 @@ namespace etl template ETL_CONSTEXPR14 bool operator <(etl::nullopt_t, const etl::optional& rhs) { - return bool(rhs); + return rhs.has_value(); } //*************************************************************************** @@ -1047,7 +1064,7 @@ namespace etl template ETL_CONSTEXPR14 bool operator <=(const etl::optional& lhs, etl::nullopt_t) { - return !bool(lhs); + return !lhs.has_value(); } //*************************************************************************** @@ -1065,7 +1082,7 @@ namespace etl template ETL_CONSTEXPR14 bool operator >(const etl::optional& lhs, etl::nullopt_t) { - return bool(lhs); + return lhs.has_value(); } //*************************************************************************** @@ -1092,7 +1109,7 @@ namespace etl template ETL_CONSTEXPR14 bool operator >=(etl::nullopt_t, const etl::optional& rhs) { - return !bool(rhs); + return !rhs.has_value(); } //*************************************************************************** @@ -1101,7 +1118,7 @@ namespace etl template ETL_CONSTEXPR14 bool operator ==(const etl::optional& lhs, const U& rhs) { - return bool(lhs) ? lhs.value() == rhs : false; + return lhs.has_value() ? lhs.value() == rhs : false; } //*************************************************************************** @@ -1119,7 +1136,7 @@ namespace etl template ETL_CONSTEXPR14 bool operator ==(const U& lhs, const etl::optional& rhs) { - return bool(rhs) ? rhs.value() == lhs : false; + return rhs.has_value() ? rhs.value() == lhs : false; } //*************************************************************************** @@ -1137,7 +1154,7 @@ namespace etl template ETL_CONSTEXPR14 bool operator <(const etl::optional& lhs, const U& rhs) { - return bool(lhs) ? lhs.value() < rhs : true; + return lhs.has_value() ? lhs.value() < rhs : true; } //*************************************************************************** @@ -1146,7 +1163,7 @@ namespace etl template ETL_CONSTEXPR14 bool operator <(const U& lhs, const etl::optional& rhs) { - return bool(rhs) ? lhs < rhs.value() : false; + return rhs.has_value() ? lhs < rhs.value() : false; } //*************************************************************************** @@ -1155,7 +1172,7 @@ namespace etl template ETL_CONSTEXPR14 bool operator <=(const etl::optional& lhs, const U& rhs) { - return bool(lhs) ? lhs.value() <= rhs : true; + return lhs.has_value() ? lhs.value() <= rhs : true; } //*************************************************************************** @@ -1164,7 +1181,7 @@ namespace etl template ETL_CONSTEXPR14 bool operator <=(const U& lhs, const etl::optional& rhs) { - return bool(rhs) ? lhs <= rhs.value() : false; + return rhs.has_value() ? lhs <= rhs.value() : false; } //*************************************************************************** @@ -1173,7 +1190,7 @@ namespace etl template ETL_CONSTEXPR14 bool operator >(const etl::optional& lhs, const U& rhs) { - return bool(lhs) ? lhs.value() > rhs : false; + return lhs.has_value() ? lhs.value() > rhs : false; } //*************************************************************************** @@ -1182,7 +1199,7 @@ namespace etl template ETL_CONSTEXPR14 bool operator >(const U& lhs, const etl::optional& rhs) { - return bool(rhs) ? lhs > rhs.value() : true; + return rhs.has_value() ? lhs > rhs.value() : true; } //*************************************************************************** @@ -1191,7 +1208,7 @@ namespace etl template ETL_CONSTEXPR14 bool operator >=(const etl::optional& lhs, const U& rhs) { - return bool(lhs) ? lhs.value() >= rhs : false; + return lhs.has_value() ? lhs.value() >= rhs : false; } //*************************************************************************** @@ -1200,9 +1217,11 @@ namespace etl template ETL_CONSTEXPR14 bool operator >=(const U& lhs, const etl::optional& rhs) { - return bool(rhs) ? lhs >= rhs.value() : true; + return rhs.has_value() ? lhs >= rhs.value() : true; } +#include "etl/private/diagnostic_pop.h" + //*************************************************************************** /// Make an optional. //*************************************************************************** diff --git a/include/etl/private/diagnostic_array_bounds_push.h b/include/etl/private/diagnostic_array_bounds_push.h new file mode 100644 index 000000000..40e720689 --- /dev/null +++ b/include/etl/private/diagnostic_array_bounds_push.h @@ -0,0 +1,44 @@ +///\file + +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +https://www.etlcpp.com + +Copyright(c) 2023 John Wellbelove + +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. +******************************************************************************/ + +/* + * The header include guard has been intentionally omitted. + * This file is intended to evaluated multiple times by design. + */ + +#if defined(__GNUC__) && !defined(__clang__) && !defined(__llvm__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Warray-bounds" +#endif + +#if defined(__clang__) || defined(__llvm__) +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warray-bounds" +#endif diff --git a/include/etl/private/pvoidvector.h b/include/etl/private/pvoidvector.h index 882dc110f..558b95849 100644 --- a/include/etl/private/pvoidvector.h +++ b/include/etl/private/pvoidvector.h @@ -439,19 +439,24 @@ namespace etl //********************************************************************* iterator insert(const_iterator position, value_type value) { + + iterator position_ = to_iterator(position); ETL_ASSERT(size() != CAPACITY, ETL_ERROR(vector_full)); - if (position_ != end()) + if (size() != CAPACITY) { - ++p_end; - etl::copy_backward(position_, end() - 1, end()); - *position_ = value; - } - else - { - *p_end++ = value; + if (position_ != end()) + { + ++p_end; + etl::copy_backward(position_, end() - 1, end()); + *position_ = value; + } + else + { + *p_end++ = value; + } } return position_; diff --git a/include/etl/version.h b/include/etl/version.h index 61429066a..01f8bb2ef 100644 --- a/include/etl/version.h +++ b/include/etl/version.h @@ -40,7 +40,7 @@ SOFTWARE. #define ETL_VERSION_MAJOR 20 #define ETL_VERSION_MINOR 35 -#define ETL_VERSION_PATCH 12 +#define ETL_VERSION_PATCH 13 #define ETL_VERSION ETL_STRING(ETL_VERSION_MAJOR) "." ETL_STRING(ETL_VERSION_MINOR) "." ETL_STRING(ETL_VERSION_PATCH) #define ETL_VERSION_W ETL_WIDE_STRING(ETL_VERSION_MAJOR) L"." ETL_WIDE_STRING(ETL_VERSION_MINOR) L"." ETL_WIDE_STRING(ETL_VERSION_PATCH) diff --git a/library.json b/library.json index ae04d7502..cc351f4a2 100644 --- a/library.json +++ b/library.json @@ -1,6 +1,6 @@ { "name": "Embedded Template Library", - "version": "20.35.12", + "version": "20.35.13", "authors": { "name": "John Wellbelove", "email": "john.wellbelove@etlcpp.com" diff --git a/library.properties b/library.properties index 677b2304c..8dfbbca08 100644 --- a/library.properties +++ b/library.properties @@ -1,5 +1,5 @@ name=Embedded Template Library -version=20.35.12 +version=20.35.13 author= John Wellbelove maintainer=John Wellbelove license=MIT diff --git a/support/Release notes.txt b/support/Release notes.txt index 0d11c2ac5..e4c08796f 100644 --- a/support/Release notes.txt +++ b/support/Release notes.txt @@ -1,3 +1,9 @@ +=============================================================================== +20.35.13 +#649 Fixed the false positive 'array-bounds' errors for ETL unit tests. +#652 Fixed false positives 'maybe-uninitialized' errors for ETL unit tests. +Moved virtual functions in etl::fixed_sized_memory_block_allocator from 'private' to 'protected'. + =============================================================================== 20.35.12 #615 Addition of etl::expected diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0c9d4ee87..30f27209f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -321,7 +321,6 @@ target_link_libraries(etl_tests PRIVATE UnitTestpp) if ((CMAKE_CXX_COMPILER_ID MATCHES "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) target_compile_options(etl_tests PRIVATE - -pipe -fsanitize=address,undefined,bounds -fno-omit-frame-pointer -Wall diff --git a/test/etl_error_handler/exceptions/CMakeLists.txt b/test/etl_error_handler/exceptions/CMakeLists.txt index 670fc179f..779624711 100644 --- a/test/etl_error_handler/exceptions/CMakeLists.txt +++ b/test/etl_error_handler/exceptions/CMakeLists.txt @@ -37,7 +37,6 @@ target_include_directories(etl_tests if ((CMAKE_CXX_COMPILER_ID MATCHES "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) target_compile_options(etl_tests PRIVATE - -pipe -fsanitize=address,undefined,bounds -fno-omit-frame-pointer -Wall diff --git a/test/etl_error_handler/log_errors/CMakeLists.txt b/test/etl_error_handler/log_errors/CMakeLists.txt index 72a09131c..296ffe581 100644 --- a/test/etl_error_handler/log_errors/CMakeLists.txt +++ b/test/etl_error_handler/log_errors/CMakeLists.txt @@ -37,7 +37,6 @@ target_include_directories(etl_tests if ((CMAKE_CXX_COMPILER_ID MATCHES "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) target_compile_options(etl_tests PRIVATE - -pipe -fsanitize=address,undefined,bounds -fno-omit-frame-pointer -Wall diff --git a/test/etl_error_handler/log_errors_and_exceptions/CMakeLists.txt b/test/etl_error_handler/log_errors_and_exceptions/CMakeLists.txt index 373b8912f..9112d5193 100644 --- a/test/etl_error_handler/log_errors_and_exceptions/CMakeLists.txt +++ b/test/etl_error_handler/log_errors_and_exceptions/CMakeLists.txt @@ -38,7 +38,6 @@ target_include_directories(etl_tests if ((CMAKE_CXX_COMPILER_ID MATCHES "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) target_compile_options(etl_tests PRIVATE - -pipe -fsanitize=address,undefined,bounds -fno-omit-frame-pointer -Wall diff --git a/test/etl_initializer_list/CMakeLists.txt b/test/etl_initializer_list/CMakeLists.txt index 5195a238d..bf660abdb 100644 --- a/test/etl_initializer_list/CMakeLists.txt +++ b/test/etl_initializer_list/CMakeLists.txt @@ -38,7 +38,6 @@ target_include_directories(etl_tests if ((CMAKE_CXX_COMPILER_ID MATCHES "GNU") OR (CMAKE_CXX_COMPILER_ID MATCHES "Clang")) target_compile_options(etl_tests PRIVATE - -pipe -fsanitize=address,undefined,bounds -fno-omit-frame-pointer -Wall diff --git a/test/runtests-01.sh b/test/runtests-01.sh new file mode 100644 index 000000000..59bc4062a --- /dev/null +++ b/test/runtests-01.sh @@ -0,0 +1,238 @@ +#!/bin/sh +clear + +mkdir -p build-make || exit 1 +cd build-make || exit 1 + +echo "ETL Tests" > log.txt + +opt="-O1" + +#****************************************************************************** +# GCC +#****************************************************************************** +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " GCC - STL" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +rm * -rf +gcc --version | grep gcc | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="g++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed Compilation >>>>" +else + echo "****************\n**** Failed ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed ****\n****************" | tee -a ../log.txt + exit $? +fi + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " GCC - Initializer list test" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +cd ../etl_initializer_list/ +mkdir -p build-make || exit 1 +cd build-make || exit 1 +rm * -rf +gcc --version | grep gcc | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed initializer_list Compilation >>>>" +else + echo "****************\n**** Failed initializer_list ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed ****\n****************" | tee -a ../log.txt + exit $? +fi + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " Clang - Initializer list test" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +rm * -rf +clang --version | grep clang | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed initializer_list Compilation >>>>" +else + echo "****************\n**** Failed initializer_list ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed ****\n****************" | tee -a ../log.txt + exit $? +fi + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " GCC - Error macros 'log_errors' test" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +cd ../../etl_error_handler/log_errors +mkdir -p build-make || exit 1 +cd build-make || exit 1 +rm * -rf +gcc --version | grep gcc | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed Error macros 'log_errors' Compilation >>>>" +else + echo "****************\n**** Failed Error macros 'log_errors' ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed Error macros 'log_errors' ****\n****************" | tee -a ../log.txt + exit $? +fi + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " GCC - Error macros 'exceptions' test" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +cd ../../../etl_error_handler/exceptions +mkdir -p build-make || exit 1 +cd build-make || exit 1 +rm * -rf +gcc --version | grep gcc | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed Error macros 'exceptions' Compilation >>>>" +else + echo "****************\n**** Failed Error macros 'exceptions' ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed Error macros 'exceptions' ****\n****************" | tee -a ../log.txt + exit $? +fi + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " GCC - Error macros 'log_errors and exceptions' test" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +cd ../../../etl_error_handler/log_errors_and_exceptions +mkdir -p build-make || exit 1 +cd build-make || exit 1 +rm * -rf +gcc --version | grep gcc | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed Error macros 'log_errors and exceptions' Compilation >>>>" +else + echo "****************\n**** Failed Error macros 'log_errors and exceptions' ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed Error macros 'log_errors and exceptions' ****\n****************" | tee -a ../log.txt + exit $? +fi + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " Clang - Error macros 'log_errors' test" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +cd ../../../etl_error_handler/log_errors +mkdir -p build-make || exit 1 +cd build-make || exit 1 +rm * -rf +clang --version | grep clang | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed Error macros 'log_errors' Compilation >>>>" +else + echo "****************\n**** Failed Error macros 'log_errors' ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed Error macros 'log_errors' ****\n****************" | tee -a ../log.txt + exit $? +fi + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " Clang - Error macros 'exceptions' test" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +cd ../../../etl_error_handler/exceptions +mkdir -p build-make || exit 1 +cd build-make || exit 1 +rm * -rf +clang --version | grep clang | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed Error macros 'exceptions' Compilation >>>>" +else + echo "****************\n**** Failed Error macros 'exceptions' ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed Error macros 'exceptions' ****\n****************" | tee -a ../log.txt + exit $? +fi + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " Clang - Error macros 'log_errors and exceptions' test" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +cd ../../../etl_error_handler/log_errors_and_exceptions +mkdir -p build-make || exit 1 +cd build-make || exit 1 +rm * -rf +clang --version | grep clang | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed Error macros 'log_errors and exceptions' Compilation >>>>" +else + echo "****************\n**** Failed Error macros 'log_errors and exceptions' ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed Error macros 'log_errors and exceptions' ****\n****************" | tee -a ../log.txt + exit $? +fi + +cd ../.. + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " All Tests Completed OK" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt diff --git a/test/runtests-03.sh b/test/runtests-03.sh new file mode 100644 index 000000000..4550ca108 --- /dev/null +++ b/test/runtests-03.sh @@ -0,0 +1,238 @@ +#!/bin/sh +clear + +mkdir -p build-make || exit 1 +cd build-make || exit 1 + +echo "ETL Tests" > log.txt + +opt="-O3" + +#****************************************************************************** +# GCC +#****************************************************************************** +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " GCC - STL" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +rm * -rf +gcc --version | grep gcc | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="g++" -DNO_STL=OFF -DETL_USE_TYPE_TRAITS_BUILTINS=OFF -DETL_USER_DEFINED_TYPE_TRAITS=OFF -DETL_FORCE_TEST_CPP03_IMPLEMENTATION=OFF -DETL_OPTIMISATION=$opt .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed Compilation >>>>" +else + echo "****************\n**** Failed ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed ****\n****************" | tee -a ../log.txt + exit $? +fi + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " GCC - Initializer list test" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +cd ../etl_initializer_list/ +mkdir -p build-make || exit 1 +cd build-make || exit 1 +rm * -rf +gcc --version | grep gcc | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed initializer_list Compilation >>>>" +else + echo "****************\n**** Failed initializer_list ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed ****\n****************" | tee -a ../log.txt + exit $? +fi + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " Clang - Initializer list test" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +rm * -rf +clang --version | grep clang | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed initializer_list Compilation >>>>" +else + echo "****************\n**** Failed initializer_list ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed ****\n****************" | tee -a ../log.txt + exit $? +fi + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " GCC - Error macros 'log_errors' test" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +cd ../../etl_error_handler/log_errors +mkdir -p build-make || exit 1 +cd build-make || exit 1 +rm * -rf +gcc --version | grep gcc | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed Error macros 'log_errors' Compilation >>>>" +else + echo "****************\n**** Failed Error macros 'log_errors' ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed Error macros 'log_errors' ****\n****************" | tee -a ../log.txt + exit $? +fi + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " GCC - Error macros 'exceptions' test" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +cd ../../../etl_error_handler/exceptions +mkdir -p build-make || exit 1 +cd build-make || exit 1 +rm * -rf +gcc --version | grep gcc | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed Error macros 'exceptions' Compilation >>>>" +else + echo "****************\n**** Failed Error macros 'exceptions' ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed Error macros 'exceptions' ****\n****************" | tee -a ../log.txt + exit $? +fi + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " GCC - Error macros 'log_errors and exceptions' test" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +cd ../../../etl_error_handler/log_errors_and_exceptions +mkdir -p build-make || exit 1 +cd build-make || exit 1 +rm * -rf +gcc --version | grep gcc | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="g++" -DETL_OPTIMISATION=$opt .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed Error macros 'log_errors and exceptions' Compilation >>>>" +else + echo "****************\n**** Failed Error macros 'log_errors and exceptions' ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed Error macros 'log_errors and exceptions' ****\n****************" | tee -a ../log.txt + exit $? +fi + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " Clang - Error macros 'log_errors' test" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +cd ../../../etl_error_handler/log_errors +mkdir -p build-make || exit 1 +cd build-make || exit 1 +rm * -rf +clang --version | grep clang | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed Error macros 'log_errors' Compilation >>>>" +else + echo "****************\n**** Failed Error macros 'log_errors' ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed Error macros 'log_errors' ****\n****************" | tee -a ../log.txt + exit $? +fi + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " Clang - Error macros 'exceptions' test" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +cd ../../../etl_error_handler/exceptions +mkdir -p build-make || exit 1 +cd build-make || exit 1 +rm * -rf +clang --version | grep clang | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed Error macros 'exceptions' Compilation >>>>" +else + echo "****************\n**** Failed Error macros 'exceptions' ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed Error macros 'exceptions' ****\n****************" | tee -a ../log.txt + exit $? +fi + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " Clang - Error macros 'log_errors and exceptions' test" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt +cd ../../../etl_error_handler/log_errors_and_exceptions +mkdir -p build-make || exit 1 +cd build-make || exit 1 +rm * -rf +clang --version | grep clang | tee -a log.txt +cmake -DCMAKE_CXX_COMPILER="clang++" -DETL_OPTIMISATION=$opt .. +make -j4 +if [ $? -eq 0 ]; then + echo "<<<< Passed Error macros 'log_errors and exceptions' Compilation >>>>" +else + echo "****************\n**** Failed Error macros 'log_errors and exceptions' ****\n****************" | tee -a ../log.txt + exit $? +fi +./etl_tests +if [ $? -eq 0 ]; then + echo "<<<< Passed Tests >>>>" +else + echo "****************\n**** Failed Error macros 'log_errors and exceptions' ****\n****************" | tee -a ../log.txt + exit $? +fi + +cd ../.. + +echo "" +echo "-----------------------------------------------" | tee -a log.txt +echo " All Tests Completed OK" | tee -a log.txt +echo "-----------------------------------------------" | tee -a log.txt diff --git a/test/test_fixed_sized_memory_block_allocator.cpp b/test/test_fixed_sized_memory_block_allocator.cpp index 3128372d2..f77cc39a2 100644 --- a/test/test_fixed_sized_memory_block_allocator.cpp +++ b/test/test_fixed_sized_memory_block_allocator.cpp @@ -36,6 +36,47 @@ namespace using Allocator16 = etl::fixed_sized_memory_block_allocator; using Allocator32 = etl::fixed_sized_memory_block_allocator; + class CustomAllocator8 : public Allocator8 + { + public: + + bool allocate_block_called = false; + bool release_block_called = false; + mutable bool is_owner_of_block_called = false; + + protected: + + //************************************************************************* + /// The overridden virtual function to allocate a block. + //************************************************************************* + void* allocate_block(size_t required_size, size_t required_alignment) override + { + allocate_block_called = true; + + return Allocator8::allocate_block(required_size, required_alignment); + } + + //************************************************************************* + /// The overridden virtual function to release a block. + //************************************************************************* + bool release_block(const void* const pblock) override + { + release_block_called = true; + + return Allocator8::release_block(pblock); + } + + //************************************************************************* + /// Returns true if the allocator is the owner of the block. + //************************************************************************* + bool is_owner_of_block(const void* const pblock) const override + { + is_owner_of_block_called = true; + + return Allocator8::is_owner_of_block(pblock); + } + }; + SUITE(test_fixed_sized_memory_block_allocator) { //************************************************************************* @@ -230,5 +271,19 @@ namespace CHECK(allocator8.release(p10)); CHECK(allocator8.release(p11)); } + + //************************************************************************* + TEST(test_custom_allocator) + { + CustomAllocator8 allocator8; + + int8_t* p1 = static_cast(allocator8.allocate(sizeof(int8_t), alignof(int8_t))); + CHECK(allocator8.allocate_block_called); + CHECK(p1 != nullptr); + CHECK(allocator8.is_owner_of(p1)); + CHECK(allocator8.is_owner_of_block_called); + CHECK(allocator8.release(p1)); + CHECK(allocator8.release_block_called); + } } } diff --git a/test/test_optional.cpp b/test/test_optional.cpp index 997ebb00b..f17273426 100644 --- a/test/test_optional.cpp +++ b/test/test_optional.cpp @@ -56,364 +56,359 @@ namespace { SUITE(test_optional) { -// //************************************************************************* -// TEST(test_initialisation) -// { -// etl::optional data1; -// etl::optional data2; -// -// CHECK(!bool(data1)); -// CHECK(!bool(data2)); -// CHECK(!data1.has_value()); -// CHECK(!data2.has_value()); -// -// data1 = Data("Hello"); -// CHECK(bool(data1)); -// CHECK(data1.has_value()); -// CHECK_EQUAL(Data("Hello"), data1); -// -// data1 = data2; -// CHECK(!bool(data1)); -// CHECK(!bool(data2)); -// CHECK(!data1.has_value()); -// CHECK(!data2.has_value()); -// -// data1 = Data("World"); -// data2 = data1; -// CHECK(bool(data1)); -// CHECK(bool(data2)); -// CHECK(data1.has_value()); -// CHECK(data2.has_value()); -// -// etl::optional data3(data1); -// CHECK(bool(data3)); -// CHECK(data3.has_value()); -// CHECK_EQUAL(data1, data3); -// -// etl::optional data4; -// data4 = Data("Hello"); -// data4 = etl::nullopt; -// CHECK(!bool(data4)); -// CHECK(!data4.has_value()); -// } -// -// //************************************************************************* -// TEST(test_deduced_initialisation) -// { -// Data data("Hello"); -// -// etl::optional opt{ data }; -// -// CHECK(opt.has_value()); -// CHECK(bool(opt)); -// CHECK_EQUAL(data, opt); -// } -// -// //************************************************************************* -// TEST(test_emplace) -// { -// etl::optional data; -// -// data.emplace(1U); -// CHECK_EQUAL(1U, data.value().value); -// -// data.emplace(2U); -// CHECK_EQUAL(2U, data.value().value); -// -// data.emplace(3U); -// CHECK_EQUAL(3U, data.value().value); -// -// CHECK_EQUAL(1, DataM::get_instance_count()); -// } -// -// //************************************************************************* -// TEST(test_moveable) -// { -//#include "etl/private/diagnostic_pessimizing_move_push.h" -// etl::optional data(std::move(DataM(1))); -// CHECK_EQUAL(1U, data.value().value); -// CHECK(bool(data)); -// -// data = std::move(etl::optional(std::move(DataM(2)))); -// CHECK_EQUAL(2U, data.value().value); -// CHECK(bool(data)); -// -// etl::optional data2(etl::move(data)); -// CHECK_EQUAL(2U, data2.value().value); -// CHECK(bool(data2)); -//#include "etl/private/diagnostic_pop.h" -// } -// -// //************************************************************************* -// TEST(test_nullopt) -// { -// etl::optional data; -// data = Data("Hello"); -// data = etl::nullopt; -// CHECK(!bool(data)); -// } -// -// //************************************************************************* -// TEST(test_value_or) -// { -// etl::optional data; -// -// Data result = data.value_or(Data("Default")); -// CHECK_EQUAL(Data("Default"), result); -// -// data = Data("Value"); -// result = data.value_or(Data("Default")); -// CHECK_EQUAL(Data("Value"), result); -// } -// -// //************************************************************************* -// TEST(test_equality) -// { -// etl::optional data1; -// etl::optional data2; -// -// CHECK(data1 == data2); -// CHECK(data2 == data1); -// -// data1 = Data("Data1"); -// CHECK(!(data1 == data2)); -// CHECK(!(data2 == data1)); -// -// data1 = etl::nullopt; -// data2 = Data("Data2"); -// CHECK(!(data1 == data2)); -// CHECK(!(data2 == data1)); -// -// data1 = Data("Data1"); -// data2 = Data("Data1"); -// CHECK(data1 == data2); -// CHECK(data2 == data1); -// -// data1 = Data("Data1"); -// data2 = Data("Data2"); -// CHECK(!(data1 == data2)); -// CHECK(!(data2 == data1)); -// -// CHECK(!(etl::nullopt == data2)); -// CHECK(!(data1 == etl::nullopt)); -// -// CHECK(data1 == Data("Data1")); -// CHECK(!(data1 == Data("Data2"))); -// CHECK(Data("Data1") == data1); -// CHECK(!(Data("Data2") == data1)); -// } -// -// //************************************************************************* -// TEST(test_inequality) -// { -// etl::optional data1; -// etl::optional data2; -// -// CHECK(!(data1 != data2)); -// CHECK(!(data2 != data1)); -// -// data1 = Data("Data1"); -// CHECK(data1 != data2); -// CHECK(data2 != data1); -// -// data1 = etl::nullopt; -// data2 = Data("Data2"); -// CHECK(data1 != data2); -// CHECK(data2 != data1); -// -// data1 = Data("Data1"); -// data2 = Data("Data1"); -// CHECK(!(data1 != data2)); -// CHECK(!(data2 != data1)); -// -// data1 = Data("Data1"); -// data2 = Data("Data2"); -// CHECK(data1 != data2); -// CHECK(data2 != data1); -// -// CHECK(etl::nullopt != data2); -// CHECK(data1 != etl::nullopt); -// -// CHECK(!(data1 != Data("Data1"))); -// CHECK(data1 != Data("Data2")); -// CHECK(!(Data("Data1") != data1)); -// CHECK(Data("Data2") != data1); -// } + //************************************************************************* + TEST(test_initialisation) + { + etl::optional data1; + etl::optional data2; + + CHECK(!bool(data1)); + CHECK(!bool(data2)); + CHECK(!data1.has_value()); + CHECK(!data2.has_value()); + + data1 = Data("Hello"); + CHECK(bool(data1)); + CHECK(data1.has_value()); + CHECK_EQUAL(Data("Hello"), data1); + + data1 = data2; + CHECK(!bool(data1)); + CHECK(!bool(data2)); + CHECK(!data1.has_value()); + CHECK(!data2.has_value()); + + data1 = Data("World"); + data2 = data1; + CHECK(bool(data1)); + CHECK(bool(data2)); + CHECK(data1.has_value()); + CHECK(data2.has_value()); + + etl::optional data3(data1); + CHECK(bool(data3)); + CHECK(data3.has_value()); + CHECK_EQUAL(data1, data3); + + etl::optional data4; + data4 = Data("Hello"); + data4 = etl::nullopt; + CHECK(!bool(data4)); + CHECK(!data4.has_value()); + } + + //************************************************************************* + TEST(test_deduced_initialisation) + { + Data data("Hello"); + + etl::optional opt{ data }; + + CHECK(opt.has_value()); + CHECK(bool(opt)); + CHECK_EQUAL(data, opt); + } + + //************************************************************************* + TEST(test_emplace) + { + etl::optional data; + + data.emplace(1U); + CHECK_EQUAL(1U, data.value().value); + + data.emplace(2U); + CHECK_EQUAL(2U, data.value().value); + + data.emplace(3U); + CHECK_EQUAL(3U, data.value().value); + + CHECK_EQUAL(1, DataM::get_instance_count()); + } + + //************************************************************************* + TEST(test_moveable) + { +#include "etl/private/diagnostic_pessimizing_move_push.h" + etl::optional data(std::move(DataM(1))); + CHECK_EQUAL(1U, data.value().value); + CHECK(bool(data)); + + data = std::move(etl::optional(std::move(DataM(2)))); + CHECK_EQUAL(2U, data.value().value); + CHECK(bool(data)); + + etl::optional data2(etl::move(data)); + CHECK_EQUAL(2U, data2.value().value); + CHECK(bool(data2)); +#include "etl/private/diagnostic_pop.h" + } //************************************************************************* -//#include "etl/private/diagnostic_uninitialized_push.h" + TEST(test_nullopt) + { + etl::optional data; + data = Data("Hello"); + data = etl::nullopt; + CHECK(!bool(data)); + } + + //************************************************************************* + TEST(test_value_or) + { + etl::optional data; + + Data result = data.value_or(Data("Default")); + CHECK_EQUAL(Data("Default"), result); + + data = Data("Value"); + result = data.value_or(Data("Default")); + CHECK_EQUAL(Data("Value"), result); + } + + //************************************************************************* + TEST(test_equality) + { + etl::optional data1; + etl::optional data2; + + CHECK(data1 == data2); + CHECK(data2 == data1); + + data1 = Data("Data1"); + CHECK(!(data1 == data2)); + CHECK(!(data2 == data1)); + + data1 = etl::nullopt; + data2 = Data("Data2"); + CHECK(!(data1 == data2)); + CHECK(!(data2 == data1)); + + data1 = Data("Data1"); + data2 = Data("Data1"); + CHECK(data1 == data2); + CHECK(data2 == data1); + + data1 = Data("Data1"); + data2 = Data("Data2"); + CHECK(!(data1 == data2)); + CHECK(!(data2 == data1)); + + CHECK(!(etl::nullopt == data2)); + CHECK(!(data1 == etl::nullopt)); + + CHECK(data1 == Data("Data1")); + CHECK(!(data1 == Data("Data2"))); + CHECK(Data("Data1") == data1); + CHECK(!(Data("Data2") == data1)); + } + + //************************************************************************* + TEST(test_inequality) + { + etl::optional data1; + etl::optional data2; + + CHECK(!(data1 != data2)); + CHECK(!(data2 != data1)); + + data1 = Data("Data1"); + CHECK(data1 != data2); + CHECK(data2 != data1); + + data1 = etl::nullopt; + data2 = Data("Data2"); + CHECK(data1 != data2); + CHECK(data2 != data1); + + data1 = Data("Data1"); + data2 = Data("Data1"); + CHECK(!(data1 != data2)); + CHECK(!(data2 != data1)); + + data1 = Data("Data1"); + data2 = Data("Data2"); + CHECK(data1 != data2); + CHECK(data2 != data1); + + CHECK(etl::nullopt != data2); + CHECK(data1 != etl::nullopt); + + CHECK(!(data1 != Data("Data1"))); + CHECK(data1 != Data("Data2")); + CHECK(!(Data("Data1") != data1)); + CHECK(Data("Data2") != data1); + } + + //************************************************************************* +#include "etl/private/diagnostic_uninitialized_push.h" TEST(test_less_than) { - struct S - { - std::string str; - }; - - etl::optional data1; - etl::optional data2; - - //CHECK(!(data2 < data1)); - //CHECK(!(data1 < data2)); - - //data1 = Data("Data1"); - //CHECK(!(data1 < data2)); - //CHECK(data2 < data1); - - //data1 = etl::nullopt; - //data2 = Data("Data2"); - //CHECK(data1 < data2); - //CHECK(!(data2 < data2)); - - //data1 = Data("Data1"); - //data2 = Data("Data2"); - //CHECK(data1 < data2); - //CHECK(!(data2 < data1)); - - //CHECK(etl::nullopt < data2); - //CHECK(!(data1 < etl::nullopt)); - - //CHECK(data1 < Data("Data2")); - //CHECK(!(data1 < Data("Data1"))); - //CHECK(!(Data("Data2") < data1)); - //CHECK(Data("Data1") < data2); + etl::optional data1; + etl::optional data2; + + CHECK(!(data2 < data1)); + CHECK(!(data1 < data2)); + + data1 = Data("Data1"); + CHECK(!(data1 < data2)); + CHECK(data2 < data1); + + data1 = etl::nullopt; + data2 = Data("Data2"); + CHECK(data1 < data2); + CHECK(!(data2 < data2)); + + data1 = Data("Data1"); + data2 = Data("Data2"); + CHECK(data1 < data2); + CHECK(!(data2 < data1)); + + CHECK(etl::nullopt < data2); + CHECK(!(data1 < etl::nullopt)); + + CHECK(data1 < Data("Data2")); + CHECK(!(data1 < Data("Data1"))); + CHECK(!(Data("Data2") < data1)); + CHECK(Data("Data1") < data2); + } +#include "etl/private/diagnostic_pop.h" + + //************************************************************************* + TEST(test_less_than_equal) + { + etl::optional data1; + etl::optional data2; + + CHECK(data1 <= data2); + CHECK(data2 <= data1); + + data1 = Data("Data1"); + CHECK(!(data1 <= data2)); + CHECK(data2 <= data1); + + data1 = etl::nullopt; + data2 = Data("Data2"); + CHECK(data1 <= data2); + CHECK(!(data2 <= data1)); + + data1 = Data("Data1"); + data2 = Data("Data2"); + CHECK(data1 <= data2); + CHECK(!(data2 <= data1)); + + CHECK(etl::nullopt <= data2); + CHECK(!(data1 <= etl::nullopt)); + + CHECK(data1 <= Data("Data2")); + CHECK(!(data2 <= Data("Data1"))); + CHECK(data1 <= Data("Data1")); + CHECK(!(Data("Data2") <= data1)); + CHECK(Data("Data1") <= data2); + CHECK(Data("Data1") <= data1); + } + + //************************************************************************* + TEST(test_greater_than) + { + etl::optional data1; + etl::optional data2; + + CHECK(!(data1 > data2)); + CHECK(!(data2 > data1)); + + data1 = Data("Data1"); + CHECK(data1 > data2); + CHECK(!(data2 > data1)); + + data1 = etl::nullopt; + data2 = Data("Data2"); + CHECK(!(data1 > data2)); + CHECK(data2 > data1); + + data1 = Data("Data1"); + data2 = Data("Data2"); + CHECK(data2 > data1); + CHECK(!(data1 > data2)); + + CHECK(!(etl::nullopt > data2)); + CHECK(data1 > etl::nullopt); + + CHECK(!(data1 > Data("Data2"))); + CHECK(data2 > Data("Data1")); + CHECK(Data("Data2") > data1); + CHECK(!(Data("Data1") > data2)); + } + + //************************************************************************* + TEST(test_greater_than_equal) + { + etl::optional data1; + etl::optional data2; + + CHECK(data1 >= data2); + CHECK(data2 >= data1); + + data1 = Data("Data1"); + CHECK(data1 >= data2); + CHECK(!(data2 >= data1)); + + data1 = etl::nullopt; + data2 = Data("Data2"); + CHECK(!(data1 >= data2)); + CHECK(data2 >= data1); + + data1 = Data("Data1"); + data2 = Data("Data2"); + CHECK(!(data1 >= data2)); + CHECK(data2 >= data1); + + CHECK(!(etl::nullopt >= data2)); + CHECK(data1 >= etl::nullopt); + + CHECK(!(data1 >= Data("Data2"))); + CHECK(data2 >= Data("Data1")); + CHECK(data1 >= Data("Data1")); + CHECK(Data("Data2") >= data1); + CHECK(!(Data("Data1") >= data2)); + CHECK(Data("Data1") >= data1); + } + + //************************************************************************* + TEST(test_container_of_optional) + { + etl::vector, 10> container; + + container.resize(5, Data("1")); + + CHECK(bool(container[0])); + CHECK(bool(container[1])); + CHECK(bool(container[2])); + CHECK(bool(container[3])); + CHECK(bool(container[4])); + } + + //************************************************************************* + TEST(test_optional_container) + { + // The indexed access doesn't work in Linux for some reason!!! +#ifndef ETL_PLATFORM_LINUX + etl::optional> container; + CHECK(!bool(container));// + + container = etl::vector(); + CHECK(bool(container)); + + container.value().resize(5, Data("1")); + CHECK_EQUAL(5U, container.value().size()); + + CHECK_EQUAL(Data("1"), container.value()[0]); + CHECK_EQUAL(Data("1"), container.value()[1]); + CHECK_EQUAL(Data("1"), container.value()[2]); + CHECK_EQUAL(Data("1"), container.value()[3]); + CHECK_EQUAL(Data("1"), container.value()[4]); +#endif } -//#include "etl/private/diagnostic_pop.h" - -// //************************************************************************* -// TEST(test_less_than_equal) -// { -// etl::optional data1; -// etl::optional data2; -// -// CHECK(data1 <= data2); -// CHECK(data2 <= data1); -// -// data1 = Data("Data1"); -// CHECK(!(data1 <= data2)); -// CHECK(data2 <= data1); -// -// data1 = etl::nullopt; -// data2 = Data("Data2"); -// CHECK(data1 <= data2); -// CHECK(!(data2 <= data1)); -// -// data1 = Data("Data1"); -// data2 = Data("Data2"); -// CHECK(data1 <= data2); -// CHECK(!(data2 <= data1)); -// -// CHECK(etl::nullopt <= data2); -// CHECK(!(data1 <= etl::nullopt)); -// -// CHECK(data1 <= Data("Data2")); -// CHECK(!(data2 <= Data("Data1"))); -// CHECK(data1 <= Data("Data1")); -// CHECK(!(Data("Data2") <= data1)); -// CHECK(Data("Data1") <= data2); -// CHECK(Data("Data1") <= data1); -// } -// -// //************************************************************************* -// TEST(test_greater_than) -// { -// etl::optional data1; -// etl::optional data2; -// -// CHECK(!(data1 > data2)); -// CHECK(!(data2 > data1)); -// -// data1 = Data("Data1"); -// CHECK(data1 > data2); -// CHECK(!(data2 > data1)); -// -// data1 = etl::nullopt; -// data2 = Data("Data2"); -// CHECK(!(data1 > data2)); -// CHECK(data2 > data1); -// -// data1 = Data("Data1"); -// data2 = Data("Data2"); -// CHECK(data2 > data1); -// CHECK(!(data1 > data2)); -// -// CHECK(!(etl::nullopt > data2)); -// CHECK(data1 > etl::nullopt); -// -// CHECK(!(data1 > Data("Data2"))); -// CHECK(data2 > Data("Data1")); -// CHECK(Data("Data2") > data1); -// CHECK(!(Data("Data1") > data2)); -// } -// -// //************************************************************************* -// TEST(test_greater_than_equal) -// { -// etl::optional data1; -// etl::optional data2; -// -// CHECK(data1 >= data2); -// CHECK(data2 >= data1); -// -// data1 = Data("Data1"); -// CHECK(data1 >= data2); -// CHECK(!(data2 >= data1)); -// -// data1 = etl::nullopt; -// data2 = Data("Data2"); -// CHECK(!(data1 >= data2)); -// CHECK(data2 >= data1); -// -// data1 = Data("Data1"); -// data2 = Data("Data2"); -// CHECK(!(data1 >= data2)); -// CHECK(data2 >= data1); -// -// CHECK(!(etl::nullopt >= data2)); -// CHECK(data1 >= etl::nullopt); -// -// CHECK(!(data1 >= Data("Data2"))); -// CHECK(data2 >= Data("Data1")); -// CHECK(data1 >= Data("Data1")); -// CHECK(Data("Data2") >= data1); -// CHECK(!(Data("Data1") >= data2)); -// CHECK(Data("Data1") >= data1); -// } -// -// //************************************************************************* -// TEST(test_container_of_optional) -// { -// etl::vector, 10> container; -// -// container.resize(5, Data("1")); -// -// CHECK(bool(container[0])); -// CHECK(bool(container[1])); -// CHECK(bool(container[2])); -// CHECK(bool(container[3])); -// CHECK(bool(container[4])); -// } -// -// //************************************************************************* -// TEST(test_optional_container) -// { -// // The indexed access doesn't work in Linux for some reason!!! -//#ifndef ETL_PLATFORM_LINUX -// etl::optional> container; -// CHECK(!bool(container));// -// -// container = etl::vector(); -// CHECK(bool(container)); -// -// container.value().resize(5, Data("1")); -// CHECK_EQUAL(5U, container.value().size()); -// -// CHECK_EQUAL(Data("1"), container.value()[0]); -// CHECK_EQUAL(Data("1"), container.value()[1]); -// CHECK_EQUAL(Data("1"), container.value()[2]); -// CHECK_EQUAL(Data("1"), container.value()[3]); -// CHECK_EQUAL(Data("1"), container.value()[4]); -//#endif -// } //************************************************************************* TEST(test_exception) @@ -423,83 +418,83 @@ namespace CHECK_THROW(data1.value(), etl::optional_invalid); } - ////************************************************************************* - //TEST(test_swap) - //{ - // etl::optional original1(Data("1")); - // etl::optional original2(Data("2")); - - // etl::optional data1; - // etl::optional data2; - - // // Both invalid. - // swap(data1, data2); - // CHECK(!bool(data1)); - // CHECK(!bool(data2)); - - // // Data1 valid; - // data1 = original1; - // data2 = etl::nullopt; - // swap(data1, data2); - // CHECK(!bool(data1)); - // CHECK(bool(data2)); - // CHECK_EQUAL(data2, original1); - - // // Data2 valid; - // data1 = etl::nullopt; - // data2 = original2; - // swap(data1, data2); - // CHECK(bool(data1)); - // CHECK(!bool(data2)); - // CHECK_EQUAL(data1, original2); - - // // Both valid; - // data1 = original1; - // data2 = original2; - // swap(data1, data2); - // CHECK(bool(data1)); - // CHECK(bool(data2)); - // CHECK_EQUAL(data1, original2); - // CHECK_EQUAL(data2, original1); - //} - - ////************************************************************************* - //TEST(test_reset) - //{ - // etl::optional data(Data("1")); - // CHECK(bool(data)); - - // data.reset(); - // CHECK(!bool(data)); - //} - - ////************************************************************************* - //etl::optional get_optional_test_bug_634() - //{ - // etl::optional result = 8; - // result.reset(); - // - // return result; - //} - - //TEST(test_bug_634) - //{ - // etl::optional result; - - // result = get_optional_test_bug_634(); - - // CHECK_EQUAL(false, result.has_value()); - //} - - ////************************************************************************* - //TEST(test_optional_emplace_bug_636) - //{ - // etl::optional result = 1; - // result.emplace(2); - - // CHECK_TRUE(result.has_value()); - // CHECK_EQUAL(2, result.value()); - //} + //************************************************************************* + TEST(test_swap) + { + etl::optional original1(Data("1")); + etl::optional original2(Data("2")); + + etl::optional data1; + etl::optional data2; + + // Both invalid. + swap(data1, data2); + CHECK(!bool(data1)); + CHECK(!bool(data2)); + + // Data1 valid; + data1 = original1; + data2 = etl::nullopt; + swap(data1, data2); + CHECK(!bool(data1)); + CHECK(bool(data2)); + CHECK_EQUAL(data2, original1); + + // Data2 valid; + data1 = etl::nullopt; + data2 = original2; + swap(data1, data2); + CHECK(bool(data1)); + CHECK(!bool(data2)); + CHECK_EQUAL(data1, original2); + + // Both valid; + data1 = original1; + data2 = original2; + swap(data1, data2); + CHECK(bool(data1)); + CHECK(bool(data2)); + CHECK_EQUAL(data1, original2); + CHECK_EQUAL(data2, original1); + } + + //************************************************************************* + TEST(test_reset) + { + etl::optional data(Data("1")); + CHECK(bool(data)); + + data.reset(); + CHECK(!bool(data)); + } + + //************************************************************************* + etl::optional get_optional_test_bug_634() + { + etl::optional result = 8; + result.reset(); + + return result; + } + + TEST(test_bug_634) + { + etl::optional result; + + result = get_optional_test_bug_634(); + + CHECK_EQUAL(false, result.has_value()); + } + + //************************************************************************* + TEST(test_optional_emplace_bug_636) + { + etl::optional result = 1; + result.emplace(2); + + CHECK_TRUE(result.has_value()); + CHECK_EQUAL(2, result.value()); + } }; } diff --git a/test/test_vector.cpp b/test/test_vector.cpp index facf99cc8..a31e3ea6a 100644 --- a/test/test_vector.cpp +++ b/test/test_vector.cpp @@ -796,6 +796,7 @@ namespace } //************************************************************************* +#include "etl/private/diagnostic_array_bounds_push.h" TEST_FIXTURE(SetupFixture, test_insert_position_value_excess) { const size_t INITIAL_SIZE = SIZE; @@ -815,6 +816,7 @@ namespace CHECK_THROW(data.insert(data.cbegin() + offset, INITIAL_VALUE), etl::vector_full); } +#include "etl/private/diagnostic_pop.h" //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_n_value) diff --git a/test/test_vector_external_buffer.cpp b/test/test_vector_external_buffer.cpp index f1e6e8234..595eccff1 100644 --- a/test/test_vector_external_buffer.cpp +++ b/test/test_vector_external_buffer.cpp @@ -782,6 +782,7 @@ namespace } //************************************************************************* +#include "etl/private/diagnostic_array_bounds_push.h" TEST_FIXTURE(SetupFixture, test_insert_position_value_excess) { const size_t INITIAL_SIZE = SIZE; @@ -801,6 +802,7 @@ namespace CHECK_THROW(data.insert(data.begin() + offset, INITIAL_VALUE), etl::vector_full); } +#include "etl/private/diagnostic_pop.h" //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_n_value) diff --git a/test/test_vector_non_trivial.cpp b/test/test_vector_non_trivial.cpp index ccc58775b..9a76b87a7 100644 --- a/test/test_vector_non_trivial.cpp +++ b/test/test_vector_non_trivial.cpp @@ -963,6 +963,7 @@ namespace } //************************************************************************* +#include "etl/private/diagnostic_array_bounds_push.h" TEST_FIXTURE(SetupFixture, test_insert_position_value_excess) { const size_t INITIAL_SIZE = SIZE; @@ -983,6 +984,7 @@ namespace CHECK_THROW(data.insert(data.begin() + offset, INITIAL_VALUE), etl::vector_full); } +#include "etl/private/diagnostic_pop.h" //************************************************************************* TEST_FIXTURE(SetupFixture, test_insert_position_n_value) diff --git a/test/test_vector_pointer.cpp b/test/test_vector_pointer.cpp index f41528046..d07f53fb5 100644 --- a/test/test_vector_pointer.cpp +++ b/test/test_vector_pointer.cpp @@ -1179,10 +1179,11 @@ namespace } //************************************************************************* +#include "etl/private/diagnostic_array_bounds_push.h" TEST_FIXTURE(SetupFixture, test_insert_position_value_excess) { - const size_t INITIAL_SIZE = SIZE; - int INITIAL_VALUE = 1; + const size_t INITIAL_SIZE = SIZE; + int INITIAL_VALUE = 1; Data data(INITIAL_SIZE, &INITIAL_VALUE); @@ -1198,6 +1199,7 @@ namespace CHECK_THROW(data.insert(data.begin() + offset, &INITIAL_VALUE), etl::vector_full); } +#include "etl/private/diagnostic_pop.h" //************************************************************************* TEST_FIXTURE(SetupFixture, test_emplace_position_value) diff --git a/test/test_vector_pointer_external_buffer.cpp b/test/test_vector_pointer_external_buffer.cpp index 97c6fe9dc..65afe8ead 100644 --- a/test/test_vector_pointer_external_buffer.cpp +++ b/test/test_vector_pointer_external_buffer.cpp @@ -1165,6 +1165,7 @@ namespace } //************************************************************************* +#include "etl/private/diagnostic_array_bounds_push.h" TEST_FIXTURE(SetupFixture, test_insert_position_value_excess) { const size_t INITIAL_SIZE = SIZE; @@ -1184,6 +1185,7 @@ namespace CHECK_THROW(data.insert(data.begin() + offset, &INITIAL_VALUE), etl::vector_full); } +#include "etl/private/diagnostic_pop.h" //************************************************************************* TEST_FIXTURE(SetupFixture, test_emplace_position_value) diff --git a/test/vs2019/etl.vcxproj b/test/vs2019/etl.vcxproj index 3a56c2c04..a81c7ffbd 100644 --- a/test/vs2019/etl.vcxproj +++ b/test/vs2019/etl.vcxproj @@ -2525,6 +2525,7 @@ + @@ -12697,6 +12698,9 @@ + + + diff --git a/test/vs2019/etl.vcxproj.filters b/test/vs2019/etl.vcxproj.filters index c6818ba42..0be9eb800 100644 --- a/test/vs2019/etl.vcxproj.filters +++ b/test/vs2019/etl.vcxproj.filters @@ -1344,6 +1344,9 @@ ETL\Utilities + + ETL\Private + @@ -3514,6 +3517,15 @@ Tests\Test Support + + Tests\Scripts + + + Tests\Scripts + + + Tests\Scripts + diff --git a/version.txt b/version.txt index 7c0f3691d..8890873f9 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -20.35.12 +20.35.13