From b19471dc8a1802da371fb9ff984e2d0e2bb552f1 Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Mon, 31 May 2021 10:00:01 +0100 Subject: [PATCH] Updates to mem_cast --- include/etl/{experimental => }/mem_cast.h | 24 +++++++++---------- test/sanity-check/c++03/CMakeLists.txt | 1 + test/sanity-check/c++11/CMakeLists.txt | 1 + test/sanity-check/c++14/CMakeLists.txt | 1 + test/sanity-check/c++17/CMakeLists.txt | 1 + test/sanity-check/mem_cast.h.t.cpp | 29 +++++++++++++++++++++++ test/test_mem_cast.cpp | 2 +- test/test_mem_cast_ptr.cpp | 2 +- test/vs2019/etl.vcxproj | 8 +++++++ test/vs2019/etl.vcxproj.filters | 5 +++- 10 files changed, 59 insertions(+), 15 deletions(-) rename include/etl/{experimental => }/mem_cast.h (96%) create mode 100644 test/sanity-check/mem_cast.h.t.cpp diff --git a/include/etl/experimental/mem_cast.h b/include/etl/mem_cast.h similarity index 96% rename from include/etl/experimental/mem_cast.h rename to include/etl/mem_cast.h index 539beeaf..cc73cd66 100644 --- a/include/etl/experimental/mem_cast.h +++ b/include/etl/mem_cast.h @@ -34,22 +34,22 @@ SOFTWARE. #include #include -#include "../platform.h" -#include "../memory.h" -#include "../static_assert.h" -#include "../largest.h" -#include "../utility.h" -#include "../placement_new.h" -#include "../exception.h" -#include "../error_handler.h" -#include "../file_error_numbers.h" +#include "platform.h" +#include "memory.h" +#include "static_assert.h" +#include "largest.h" +#include "utility.h" +#include "placement_new.h" +#include "exception.h" +#include "error_handler.h" +#include "file_error_numbers.h" namespace etl { //*************************************************************************** /// The base class for array_wrapper exceptions. //*************************************************************************** - class mem_cast_exception : public exception + class mem_cast_exception : public etl::exception { public: @@ -62,7 +62,7 @@ namespace etl //*************************************************************************** /// The exception thrown when the buffer pointer alignment is not compatible. //*************************************************************************** - class mem_cast_alignment_exception : public mem_cast_exception + class mem_cast_alignment_exception : public etl::mem_cast_exception { public: @@ -75,7 +75,7 @@ namespace etl //*************************************************************************** /// The exception thrown when the pointer is null. //*************************************************************************** - class mem_cast_nullptr_exception : public mem_cast_exception + class mem_cast_nullptr_exception : public etl::mem_cast_exception { public: diff --git a/test/sanity-check/c++03/CMakeLists.txt b/test/sanity-check/c++03/CMakeLists.txt index 9c029fda..dea14a49 100644 --- a/test/sanity-check/c++03/CMakeLists.txt +++ b/test/sanity-check/c++03/CMakeLists.txt @@ -151,6 +151,7 @@ target_sources(t98 PRIVATE etl_profile.h ../map.h.t.cpp ../math_constants.h.t.cpp ../mean.h.t.cpp + ../mem_cast.h.t.cpp ../memory.h.t.cpp ../memory_model.h.t.cpp ../message.h.t.cpp diff --git a/test/sanity-check/c++11/CMakeLists.txt b/test/sanity-check/c++11/CMakeLists.txt index c34ccaea..09193372 100644 --- a/test/sanity-check/c++11/CMakeLists.txt +++ b/test/sanity-check/c++11/CMakeLists.txt @@ -151,6 +151,7 @@ target_sources(t11 PRIVATE etl_profile.h ../map.h.t.cpp ../math_constants.h.t.cpp ../mean.h.t.cpp + ../mem_cast.h.t.cpp ../memory.h.t.cpp ../memory_model.h.t.cpp ../message.h.t.cpp diff --git a/test/sanity-check/c++14/CMakeLists.txt b/test/sanity-check/c++14/CMakeLists.txt index 02fc1823..e514d386 100644 --- a/test/sanity-check/c++14/CMakeLists.txt +++ b/test/sanity-check/c++14/CMakeLists.txt @@ -151,6 +151,7 @@ target_sources(t14 PRIVATE etl_profile.h ../map.h.t.cpp ../math_constants.h.t.cpp ../mean.h.t.cpp + ../mem_cast.h.t.cpp ../memory.h.t.cpp ../memory_model.h.t.cpp ../message.h.t.cpp diff --git a/test/sanity-check/c++17/CMakeLists.txt b/test/sanity-check/c++17/CMakeLists.txt index 91193e63..dd6b754a 100644 --- a/test/sanity-check/c++17/CMakeLists.txt +++ b/test/sanity-check/c++17/CMakeLists.txt @@ -151,6 +151,7 @@ target_sources(t17 PRIVATE etl_profile.h ../map.h.t.cpp ../math_constants.h.t.cpp ../mean.h.t.cpp + ../mem_cast.h.t.cpp ../memory.h.t.cpp ../memory_model.h.t.cpp ../message.h.t.cpp diff --git a/test/sanity-check/mem_cast.h.t.cpp b/test/sanity-check/mem_cast.h.t.cpp new file mode 100644 index 00000000..d62b8b27 --- /dev/null +++ b/test/sanity-check/mem_cast.h.t.cpp @@ -0,0 +1,29 @@ +/****************************************************************************** +The MIT License(MIT) + +Embedded Template Library. +https://github.com/ETLCPP/etl +https://www.etlcpp.com + +Copyright(c) 2021 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. +******************************************************************************/ + +#include diff --git a/test/test_mem_cast.cpp b/test/test_mem_cast.cpp index 11d10af4..cb9105ee 100644 --- a/test/test_mem_cast.cpp +++ b/test/test_mem_cast.cpp @@ -28,7 +28,7 @@ SOFTWARE. #include "unit_test_framework.h" -#include "etl/experimental/mem_cast.h" +#include "etl/mem_cast.h" #include "etl/largest.h" #include diff --git a/test/test_mem_cast_ptr.cpp b/test/test_mem_cast_ptr.cpp index 08f8cebc..4bbebfac 100644 --- a/test/test_mem_cast_ptr.cpp +++ b/test/test_mem_cast_ptr.cpp @@ -28,7 +28,7 @@ SOFTWARE. #include "unit_test_framework.h" -#include "etl/experimental/mem_cast.h" +#include "etl/mem_cast.h" #include "etl/largest.h" #include diff --git a/test/vs2019/etl.vcxproj b/test/vs2019/etl.vcxproj index 37c264bc..430c64ab 100644 --- a/test/vs2019/etl.vcxproj +++ b/test/vs2019/etl.vcxproj @@ -3231,6 +3231,14 @@ true true + + true + true + true + true + true + true + true true diff --git a/test/vs2019/etl.vcxproj.filters b/test/vs2019/etl.vcxproj.filters index b66174cf..2a763f13 100644 --- a/test/vs2019/etl.vcxproj.filters +++ b/test/vs2019/etl.vcxproj.filters @@ -1111,7 +1111,7 @@ ETL\Private - ETL\Experimental + ETL\Utilities @@ -2540,6 +2540,9 @@ Source Files + + Source Files\Sanity Checks +