From 94654689e8cc964555ee66d21e35799ceb88e26e Mon Sep 17 00:00:00 2001 From: John Wellbelove Date: Tue, 29 Aug 2023 09:25:58 +0100 Subject: [PATCH] Removed semicolon warnings --- include/etl/circular_buffer.h | 4 ++-- include/etl/debug_count.h | 34 +++++++++++++++++++--------------- include/etl/error_handler.h | 26 +++++++++++++------------- include/etl/platform.h | 12 +++++++++++- include/etl/static_assert.h | 2 +- include/etl/utility.h | 2 +- test/etl_profile.h | 2 +- 7 files changed, 48 insertions(+), 34 deletions(-) diff --git a/include/etl/circular_buffer.h b/include/etl/circular_buffer.h index c796f28e..a099ca4a 100644 --- a/include/etl/circular_buffer.h +++ b/include/etl/circular_buffer.h @@ -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 diff --git a/include/etl/debug_count.h b/include/etl/debug_count.h index af359df3..ebbfb13e 100644 --- a/include/etl/debug_count.h +++ b/include/etl/debug_count.h @@ -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 diff --git a/include/etl/error_handler.h b/include/etl/error_handler.h index 13897057..b08a0d4b 100644 --- a/include/etl/error_handler.h +++ b/include/etl/error_handler.h @@ -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. diff --git a/include/etl/platform.h b/include/etl/platform.h index 7c80dfe7..d53d5460 100644 --- a/include/etl/platform.h +++ b/include/etl/platform.h @@ -63,6 +63,9 @@ SOFTWARE. #include "etl_profile.h" #endif +// Null statement +#define ETL_DO_NOTHING static_cast(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); - } } diff --git a/include/etl/static_assert.h b/include/etl/static_assert.h index 4c281ade..d443ec86 100644 --- a/include/etl/static_assert.h +++ b/include/etl/static_assert.h @@ -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(Condition)>) \ } #endif diff --git a/include/etl/utility.h b/include/etl/utility.h index 08097a75..bae739f1 100644 --- a/include/etl/utility.h +++ b/include/etl/utility.h @@ -578,7 +578,7 @@ namespace etl //************************* template struct in_place_type_t { - explicit ETL_CONSTEXPR in_place_type_t() {}; + explicit ETL_CONSTEXPR in_place_type_t() {} }; #if ETL_USING_CPP17 diff --git a/test/etl_profile.h b/test/etl_profile.h index c7240422..079e24ad 100644 --- a/test/etl_profile.h +++ b/test/etl_profile.h @@ -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