Merge branch 'hotfix/#749-Code-change-causes-warning-with-armcc-compiler' into development

This commit is contained in:
John Wellbelove 2023-09-21 18:25:01 +01:00
commit 40df32148e
7 changed files with 48 additions and 34 deletions

View File

@ -883,7 +883,7 @@ namespace etl
}
else
{
ETL_INCREMENT_DEBUG_COUNT;;
ETL_INCREMENT_DEBUG_COUNT;
}
}
@ -907,7 +907,7 @@ namespace etl
}
else
{
ETL_INCREMENT_DEBUG_COUNT;;
ETL_INCREMENT_DEBUG_COUNT;
}
}
#endif

View File

@ -45,8 +45,8 @@ SOFTWARE.
#define ETL_DECLARE_DEBUG_COUNT etl::debug_count etl_debug_count
#define ETL_SET_DEBUG_COUNT(n) etl_debug_count.set(n)
#define ETL_GET_DEBUG_COUNT etl_debug_count.get()
#define ETL_INCREMENT_DEBUG_COUNT ++etl_debug_count;
#define ETL_DECREMENT_DEBUG_COUNT --etl_debug_count;
#define ETL_INCREMENT_DEBUG_COUNT ++etl_debug_count
#define ETL_DECREMENT_DEBUG_COUNT --etl_debug_count
#define ETL_ADD_DEBUG_COUNT(n) etl_debug_count += (n)
#define ETL_SUBTRACT_DEBUG_COUNT(n) etl_debug_count -= (n)
#define ETL_RESET_DEBUG_COUNT etl_debug_count.clear()
@ -62,8 +62,6 @@ namespace etl
/// Does nothing in a non-debug build.
///\ingroup reference
//***************************************************************************
class debug_count
{
public:
@ -154,23 +152,29 @@ namespace etl
};
} // namespace etl
inline void swap(etl::debug_count& lhs, etl::debug_count& rhs)
{
lhs.swap(rhs);
}
#else
#define ETL_DECLARE_DEBUG_COUNT
#define ETL_SET_DEBUG_COUNT(n)
#define ETL_GET_DEBUG_COUNT
#define ETL_INCREMENT_DEBUG_COUNT
#define ETL_DECREMENT_DEBUG_COUNT
#define ETL_ADD_DEBUG_COUNT(n)
#define ETL_SUBTRACT_DEBUG_COUNT(n)
#define ETL_RESET_DEBUG_COUNT
#define ETL_OBJECT_RESET_DEBUG_COUNT(object)
#define ETL_OBJECT_GET_DEBUG_COUNT(object)
#define ETL_DECLARE_DEBUG_COUNT etl::debug_count etl_debug_count
#define ETL_SET_DEBUG_COUNT(n) ETL_DO_NOTHING
#define ETL_GET_DEBUG_COUNT ETL_DO_NOTHING
#define ETL_INCREMENT_DEBUG_COUNT ETL_DO_NOTHING
#define ETL_DECREMENT_DEBUG_COUNT ETL_DO_NOTHING
#define ETL_ADD_DEBUG_COUNT(n) ETL_DO_NOTHING
#define ETL_SUBTRACT_DEBUG_COUNT(n) ETL_DO_NOTHING
#define ETL_RESET_DEBUG_COUNT ETL_DO_NOTHING
#define ETL_OBJECT_RESET_DEBUG_COUNT(object) ETL_DO_NOTHING
#define ETL_OBJECT_GET_DEBUG_COUNT(object) ETL_DO_NOTHING
namespace etl
{
class debug_count
{
};
}
#endif // ETL_DEBUG_COUNT
#endif

View File

@ -268,22 +268,22 @@ namespace etl
///\ingroup error_handler
//***************************************************************************
#if defined(ETL_NO_CHECKS)
#define ETL_ASSERT(b, e) // Does nothing.
#define ETL_ASSERT_OR_RETURN(b, e) // Does nothing.
#define ETL_ASSERT_OR_RETURN_VALUE(b, e, v) // Does nothing.
#define ETL_ASSERT(b, e) ETL_DO_NOTHING // Does nothing.
#define ETL_ASSERT_OR_RETURN(b, e) ETL_DO_NOTHING // Does nothing.
#define ETL_ASSERT_OR_RETURN_VALUE(b, e, v) ETL_DO_NOTHING // Does nothing.
#define ETL_ASSERT_FAIL(e) // Does nothing.
#define ETL_ASSERT_FAIL_AND_RETURN(e) // Does nothing.
#define ETL_ASSERT_FAIL_AND_RETURN_VALUE(e, v) // Does nothing.
#define ETL_ASSERT_FAIL(e) ETL_DO_NOTHING // Does nothing.
#define ETL_ASSERT_FAIL_AND_RETURN(e) ETL_DO_NOTHING // Does nothing.
#define ETL_ASSERT_FAIL_AND_RETURN_VALUE(e, v) ETL_DO_NOTHING // Does nothing.
#elif ETL_USING_EXCEPTIONS
#if defined(ETL_LOG_ERRORS)
#define ETL_ASSERT(b, e) {if (!(b)) {etl::error_handler::error((e)); throw((e));}} // If the condition fails, calls the error handler then throws an exception.
#define ETL_ASSERT_OR_RETURN(b, e) {if (!(b)) {etl::error_handler::error((e)); throw((e)); return;}} // If the condition fails, calls the error handler then throws an exception.
#define ETL_ASSERT_OR_RETURN_VALUE(b, e, v) {if (!(b)) {etl::error_handler::error((e)); throw((e)); return(v);}} // If the condition fails, calls the error handler then throws an exception.
#define ETL_ASSERT_OR_RETURN(b, e) {if (!(b)) {etl::error_handler::error((e)); throw((e)); return;}} // If the condition fails, calls the error handler then throws an exception.
#define ETL_ASSERT_OR_RETURN_VALUE(b, e, v) {if (!(b)) {etl::error_handler::error((e)); throw((e)); return(v);}} // If the condition fails, calls the error handler then throws an exception.
#define ETL_ASSERT_FAIL(e) {etl::error_handler::error((e)); throw((e));} // Calls the error handler then throws an exception.
#define ETL_ASSERT_FAIL_AND_RETURN(e) {etl::error_handler::error((e)); throw((e)); return;} // Calls the error handler then throws an exception.
#define ETL_ASSERT_FAIL_AND_RETURN_VALUE(e, v) {etl::error_handler::error((e)); throw((e)); return(v);} // Calls the error handler then throws an exception.
#define ETL_ASSERT_FAIL_AND_RETURN_VALUE(e, v) {etl::error_handler::error((e)); throw((e)); return(v);} // Calls the error handler then throws an exception.
#else
#define ETL_ASSERT(b, e) {if (!(b)) {throw((e));}} // If the condition fails, throws an exception.
#define ETL_ASSERT_OR_RETURN(b, e) {if (!(b)) {throw((e));}} // If the condition fails, throws an exception.
@ -297,8 +297,8 @@ namespace etl
#else
#if defined(ETL_LOG_ERRORS)
#define ETL_ASSERT(b, e) {if(!(b)) {etl::error_handler::error((e));}} // If the condition fails, calls the error handler
#define ETL_ASSERT_OR_RETURN(b, e) {if(!(b)) {etl::error_handler::error((e)); return;}} // If the condition fails, calls the error handler and return
#define ETL_ASSERT_OR_RETURN_VALUE(b, e, v) {if(!(b)) {etl::error_handler::error((e)); return (v);}} // If the condition fails, calls the error handler and return a value
#define ETL_ASSERT_OR_RETURN(b, e) {if(!(b)) {etl::error_handler::error((e)); return;}} // If the condition fails, calls the error handler and return
#define ETL_ASSERT_OR_RETURN_VALUE(b, e, v) {if(!(b)) {etl::error_handler::error((e)); return (v);}} // If the condition fails, calls the error handler and return a value
#define ETL_ASSERT_FAIL(e) {etl::error_handler::error((e));} // Calls the error handler
#define ETL_ASSERT_FAIL_AND_RETURN(e) {etl::error_handler::error((e)); return;} // Calls the error handler and return
@ -306,8 +306,8 @@ namespace etl
#else
#if ETL_IS_DEBUG_BUILD
#define ETL_ASSERT(b, e) assert((b)) // If the condition fails, asserts.
#define ETL_ASSERT_OR_RETURN(b, e) {if (!(b)) {assert(false); return;}} // If the condition fails, asserts and return.
#define ETL_ASSERT_OR_RETURN_VALUE(b, e, v) {if (!(b)) {assert(false); return(v);}} // If the condition fails, asserts and return a value.
#define ETL_ASSERT_OR_RETURN(b, e) {if (!(b)) {assert(false); return;}} // If the condition fails, asserts and return.
#define ETL_ASSERT_OR_RETURN_VALUE(b, e, v) {if (!(b)) {assert(false); return(v);}} // If the condition fails, asserts and return a value.
#define ETL_ASSERT_FAIL(e) assert(false) // Asserts.
#define ETL_ASSERT_FAIL_AND_RETURN(e) {assert(false); return;} // Asserts.

View File

@ -63,6 +63,9 @@ SOFTWARE.
#include "etl_profile.h"
#endif
// Null statement
#define ETL_DO_NOTHING static_cast<void>(0)
// Determine the bit width of the platform.
#define ETL_PLATFORM_16BIT (UINT16_MAX == UINTPTR_MAX)
#define ETL_PLATFORM_32BIT (UINT32_MAX == UINTPTR_MAX)
@ -338,6 +341,14 @@ SOFTWARE.
#define ETL_CONSTEXPR20_STL
#endif
//*************************************
// C++23
#if ETL_USING_CPP23 && !defined(ETL_FORCE_NO_ADVANCED_CPP)
#define ETL_ASSUME(expression) [[assume(expression)]]
#else
#define ETL_ASSUME ETL_DO_NOTHING
#endif
//*************************************
// Determine if the ETL can use char8_t type.
#if ETL_USING_8BIT_TYPES
@ -479,7 +490,6 @@ namespace etl
// Is...
static ETL_CONSTANT bool is_debug_build = (ETL_IS_DEBUG_BUILD == 1);
}
}

View File

@ -45,7 +45,7 @@ SOFTWARE.
#define ETL_STATIC_ASSERT(Condition, Message) \
enum \
{ \
ETL_SA2(dummy, __LINE__) = sizeof(ETL_ETL_STATIC_ASSERT_FAILED<(bool)(Condition)>) \
ETL_SA2(dummy, __LINE__) = sizeof(ETL_ETL_STATIC_ASSERT_FAILED<static_cast<bool>(Condition)>) \
}
#endif

View File

@ -578,7 +578,7 @@ namespace etl
//*************************
template <typename T> struct in_place_type_t
{
explicit ETL_CONSTEXPR in_place_type_t() {};
explicit ETL_CONSTEXPR in_place_type_t() {}
};
#if ETL_USING_CPP17

View File

@ -39,7 +39,7 @@ SOFTWARE.
#define ETL_IDEQUE_REPAIR_ENABLE
#define ETL_ICIRCULAR_BUFFER_REPAIR_ENABLE
#define ETL_IN_UNIT_TEST
#define ETL_DEBUG_COUNT
//#define ETL_DEBUG_COUNT
#define ETL_ARRAY_VIEW_IS_MUTABLE
#define ETL_MESSAGE_TIMER_USE_ATOMIC_LOCK