diff --git a/include/etl/basic_string.h b/include/etl/basic_string.h
index 93fcd197..e20a0067 100644
--- a/include/etl/basic_string.h
+++ b/include/etl/basic_string.h
@@ -2230,7 +2230,7 @@ namespace etl
return *this;
}
-#ifdef ETL_ISTRING_REPAIR_ENABLE
+#if ETL_ISTRING_REPAIR_ENABLED
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
diff --git a/include/etl/byte.h b/include/etl/byte.h
index 3b4a11d4..69cc0fdf 100644
--- a/include/etl/byte.h
+++ b/include/etl/byte.h
@@ -1,4 +1,27 @@
+///\file
+/******************************************************************************
+The MIT License(MIT)
+Embedded Template Library.
+https://github.com/ETLCPP/etl
+https://www.etlcpp.com
+Copyright(c) 2022 jwellbelove
+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.
+******************************************************************************/
#ifndef ETL_BYTE_INCLUDED
#define ETL_BYTE_INCLUDED
@@ -6,7 +29,6 @@
#include "platform.h"
#include "type_traits.h"
-
namespace etl
{
#if ETL_CPP11_SUPPORTED && !defined(ETL_BYTE_FORCE_CPP03_IMPLEMENTATION)
diff --git a/include/etl/initializer_list.h b/include/etl/initializer_list.h
index 03e5cd29..e8175b27 100644
--- a/include/etl/initializer_list.h
+++ b/include/etl/initializer_list.h
@@ -235,4 +235,13 @@ namespace std
#endif // ETL_USE_INITIALIZER_LIST
+namespace etl
+{
+ namespace library_traits
+ {
+ static ETL_CONSTANT bool has_initializer_list = (ETL_USING_INITIALIZER_LIST == 1);
+ }
+}
+
+#endif // ETL_INITIALIZER_LIST_INCLUDED
#endif // ETL_INITIALIZER_LIST_INCLUDED
diff --git a/include/etl/platform.h b/include/etl/platform.h
index eddf1155..4535a1cc 100644
--- a/include/etl/platform.h
+++ b/include/etl/platform.h
@@ -40,6 +40,9 @@ SOFTWARE.
// Define a debug macro
#if (defined(_DEBUG) || defined(DEBUG)) && !defined(ETL_DEBUG)
#define ETL_DEBUG
+ #define ETL_IS_DEBUG_BUILD 1
+#else
+ #define ETL_IS_DEBUG_BUILD 0
#endif
// Determine the bit width of the platform.
@@ -146,6 +149,7 @@ SOFTWARE.
#define ETL_STRING_CLEAR_AFTER_USE_ENABLED 1
#endif
+
//*************************************
// The macros below are dependent on the profile.
// C++11
@@ -269,4 +273,30 @@ SOFTWARE.
// Sort out namespaces for STL/No STL options.
#include "private/choose_namespace.h"
+namespace etl
+{
+ namespace library_traits
+ {
+ static ETL_CONSTANT bool using_stl = (ETL_USING_STL == 1);
+ static ETL_CONSTANT bool using_stlport = (ETL_USING_STLPORT == 1);
+ static ETL_CONSTANT bool using_cpp11 = (ETL_CPP11_SUPPORTED == 1);
+ static ETL_CONSTANT bool using_cpp14 = (ETL_CPP14_SUPPORTED == 1);
+ static ETL_CONSTANT bool using_cpp17 = (ETL_CPP17_SUPPORTED == 1);
+ static ETL_CONSTANT bool using_cpp20 = (ETL_CPP20_SUPPORTED == 1);
+ static ETL_CONSTANT bool has_8bit_types = (ETL_USING_8BIT_TYPES == 1);
+ static ETL_CONSTANT bool has_64bit_types = (ETL_USING_64BIT_TYPES == 1);
+ static ETL_CONSTANT bool has_atomic = (ETL_HAS_ATOMIC == 1);
+ static ETL_CONSTANT bool has_nullptr = (ETL_NO_NULLPTR_SUPPORT == 0);
+ static ETL_CONSTANT bool has_large_char = (ETL_NO_LARGE_CHAR_SUPPORT == 0);
+ static ETL_CONSTANT bool has_string_truncation_checks = (ETL_STRING_TRUNCATION_CHECKS_ENABLED == 1);
+ static ETL_CONSTANT bool has_string_clear_after_use = (ETL_STRING_CLEAR_AFTER_USE_ENABLED == 1);
+ static ETL_CONSTANT bool has_istring_repair = (ETL_ISTRING_REPAIR_ENABLED == 1);
+ static ETL_CONSTANT bool has_ivector_repair = (ETL_IVECTOR_REPAIR_ENABLED == 1);
+ static ETL_CONSTANT bool has_ideque_repair = (ETL_IDEQUE_REPAIR_ENABLED == 1);
+ static ETL_CONSTANT bool is_debug_build = (ETL_IS_DEBUG_BUILD == 1);
+ static ETL_CONSTANT bool has_polymorphic_messages = (ETL_HAS_POLYMORPHIC_MESSAGES == 1);
+ static ETL_CONSTANT bool error_on_string_truncation = (ETL_ERROR_ON_STRING_TRUNCATION == 1);
+ };
+}
+
#endif
diff --git a/include/etl/profiles/determine_builtin_support.h b/include/etl/profiles/determine_builtin_support.h
index afaddc7b..3a5d6a3f 100644
--- a/include/etl/profiles/determine_builtin_support.h
+++ b/include/etl/profiles/determine_builtin_support.h
@@ -146,4 +146,19 @@ SOFTWARE.
#define ETL_USING_BUILTIN_IS_TRIVIALLY_COPYABLE 0
#endif
+namespace etl
+{
+ namespace library_traits
+ {
+ static ETL_CONSTANT bool using_builtin_memcmp = (ETL_USING_BUILTIN_MEMCMP == 1);
+ static ETL_CONSTANT bool using_builtin_memmove = (ETL_USING_BUILTIN_MEMMOVE == 1);
+ static ETL_CONSTANT bool USING_BUILTIN_MEMSET = (ETL_USING_BUILTIN_MEMSET == 1);
+ static ETL_CONSTANT bool USING_BUILTIN_IS_ASSIGNABLE = (ETL_USING_BUILTIN_IS_ASSIGNABLE == 1);
+ static ETL_CONSTANT bool USING_BUILTIN_IS_CONSTRUCTIBLE = (ETL_USING_BUILTIN_IS_CONSTRUCTIBLE == 1);
+ static ETL_CONSTANT bool USING_BUILTIN_IS_TRIVIALLY_CONSTRUCTIBLE = (ETL_USING_BUILTIN_IS_TRIVIALLY_CONSTRUCTIBLE == 1);
+ static ETL_CONSTANT bool USING_BUILTIN_IS_TRIVIALLY_DESTRUCTIBLE = (ETL_USING_BUILTIN_IS_TRIVIALLY_DESTRUCTIBLE == 1);
+ static ETL_CONSTANT bool USING_BUILTIN_IS_TRIVIALLY_COPYABLE = (ETL_USING_BUILTIN_IS_TRIVIALLY_COPYABLE == 1);
+ }
+}
+
#endif
diff --git a/include/etl/string.h b/include/etl/string.h
index 765d2200..35bddbb4 100644
--- a/include/etl/string.h
+++ b/include/etl/string.h
@@ -234,7 +234,7 @@ namespace etl
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair()
-#ifdef ETL_ISTRING_REPAIR_ENABLE
+#if ETL_ISTRING_REPAIR_ENABLED
ETL_OVERRIDE
#endif
{
@@ -419,7 +419,7 @@ namespace etl
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair()
-#ifdef ETL_ISTRING_REPAIR_ENABLE
+#if ETL_ISTRING_REPAIR_ENABLED
ETL_OVERRIDE
#endif
{
diff --git a/include/etl/u16string.h b/include/etl/u16string.h
index f332f443..c67c556e 100644
--- a/include/etl/u16string.h
+++ b/include/etl/u16string.h
@@ -218,7 +218,7 @@ namespace etl
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair()
-#ifdef ETL_ISTRING_REPAIR_ENABLE
+#if ETL_ISTRING_REPAIR_ENABLED
ETL_OVERRIDE
#endif
{
@@ -402,7 +402,7 @@ namespace etl
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair()
-#ifdef ETL_ISTRING_REPAIR_ENABLE
+#if ETL_ISTRING_REPAIR_ENABLED
ETL_OVERRIDE
#endif
{
diff --git a/include/etl/u32string.h b/include/etl/u32string.h
index a2dad598..3f31d79b 100644
--- a/include/etl/u32string.h
+++ b/include/etl/u32string.h
@@ -218,7 +218,7 @@ namespace etl
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair()
-#ifdef ETL_ISTRING_REPAIR_ENABLE
+#if ETL_ISTRING_REPAIR_ENABLED
ETL_OVERRIDE
#endif
{
@@ -402,7 +402,7 @@ namespace etl
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair()
-#ifdef ETL_ISTRING_REPAIR_ENABLE
+#if ETL_ISTRING_REPAIR_ENABLED
ETL_OVERRIDE
#endif
{
diff --git a/include/etl/wstring.h b/include/etl/wstring.h
index eac43e18..f4016a0a 100644
--- a/include/etl/wstring.h
+++ b/include/etl/wstring.h
@@ -217,7 +217,7 @@ namespace etl
//*************************************************************************
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
-#ifdef ETL_ISTRING_REPAIR_ENABLE
+#if ETL_ISTRING_REPAIR_ENABLED
virtual
#endif
void repair()
@@ -402,7 +402,7 @@ namespace etl
/// Fix the internal pointers after a low level memory copy.
//*************************************************************************
void repair()
-#ifdef ETL_ISTRING_REPAIR_ENABLE
+#if ETL_ISTRING_REPAIR_ENABLED
ETL_OVERRIDE
#endif
{
diff --git a/test/test_library_traits.cpp b/test/test_library_traits.cpp
new file mode 100644
index 00000000..21e44bfb
--- /dev/null
+++ b/test/test_library_traits.cpp
@@ -0,0 +1,54 @@
+/******************************************************************************
+The MIT License(MIT)
+
+Embedded Template Library.
+https://github.com/ETLCPP/etl
+https://www.etlcpp.com
+
+Copyright(c) 2022 jwellbelove
+
+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 "unit_test_framework.h"
+
+#include "etl/platform.h"
+
+namespace
+{
+ SUITE(test_library_traits)
+ {
+ TEST(test_library_traits)
+ {
+ CHECK_EQUAL(false, etl::library_traits::error_on_string_truncation);
+ CHECK_EQUAL(true, etl::library_traits::has_64bit_types);
+ CHECK_EQUAL(true, etl::library_traits::has_8bit_types);
+ CHECK_EQUAL(true, etl::library_traits::has_atomic);
+ CHECK_EQUAL(true, etl::library_traits::has_ideque_repair);
+ CHECK_EQUAL(true, etl::library_traits::has_istring_repair);
+ CHECK_EQUAL(true, etl::library_traits::has_ivector_repair);
+ CHECK_EQUAL(true, etl::library_traits::has_large_char);
+ CHECK_EQUAL(true, etl::library_traits::has_nullptr);
+ CHECK_EQUAL(false, etl::library_traits::has_polymorphic_messages);
+ CHECK_EQUAL(true, etl::library_traits::has_string_clear_after_use);
+ CHECK_EQUAL(true, etl::library_traits::has_string_truncation_checks);
+ CHECK_EQUAL(true, etl::library_traits::is_debug_build);
+ }
+ };
+}
diff --git a/test/vs2019/etl.vcxproj b/test/vs2019/etl.vcxproj
index aa94f25b..c615c59a 100644
--- a/test/vs2019/etl.vcxproj
+++ b/test/vs2019/etl.vcxproj
@@ -10677,6 +10677,7 @@
+
diff --git a/test/vs2019/etl.vcxproj.filters b/test/vs2019/etl.vcxproj.filters
index c47f77b9..76da2137 100644
--- a/test/vs2019/etl.vcxproj.filters
+++ b/test/vs2019/etl.vcxproj.filters
@@ -3116,9 +3116,6 @@
Tests\Sanity Checks
-
- Tests\Sanity Checks
-
Tests\Sanity Checks
@@ -3140,6 +3137,9 @@
Tests\Sanity Checks
+
+ Tests\Misc
+
Tests\Callback Timers
@@ -3380,4 +3380,4 @@
Resource Files
-
\ No newline at end of file
+