Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion arduino/library-arduino.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Embedded Template Library ETL",
"version": "20.43.2",
"version": "20.43.4",
"authors": {
"name": "John Wellbelove",
"email": "[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion arduino/library-arduino.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Embedded Template Library ETL
version=20.43.2
version=20.43.4
author= John Wellbelove <[email protected]>
maintainer=John Wellbelove <[email protected]>
license=MIT
Expand Down
12 changes: 6 additions & 6 deletions include/etl/closure.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ namespace etl
/// \param f The delegate to be invoked.
/// \param args The arguments to bind to the delegate.
//*********************************************************************
ETL_CONSTEXPR14 closure(const delegate_type& f, const TArgs... args) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
ETL_CONSTEXPR14 closure(const delegate_type& f, const TArgs... args)
: m_f(f)
, m_args(args...)
{
Expand All @@ -81,7 +81,7 @@ namespace etl
/// Invoke the stored delegate with the bound arguments.
/// \return The result of the delegate invocation.
//*********************************************************************
ETL_CONSTEXPR14 TReturn operator()() const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
ETL_CONSTEXPR14 TReturn operator()() const
{
return execute(etl::index_sequence_for<TArgs...>{});
}
Expand All @@ -94,7 +94,7 @@ namespace etl
/// \param arg The new value to bind.
//*********************************************************************
template <size_t Index, typename UArg>
ETL_CONSTEXPR14 void bind(UArg arg) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
ETL_CONSTEXPR14 void bind(UArg arg)
{
static_assert(etl::is_convertible<UArg, etl::type_list_type_at_index_t<argument_types, Index>>::value, "Argument is not convertible");
static_assert(!etl::is_reference<UArg>::value, "Cannot bind reference arguments");
Expand All @@ -108,7 +108,7 @@ namespace etl
/// \param args The new values to bind.
///*********************************************************************
template <typename... UArgs>
ETL_CONSTEXPR14 void bind(UArgs&&... args) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
ETL_CONSTEXPR14 void bind(UArgs&&... args)
{
static_assert(sizeof...(UArgs) == sizeof...(TArgs), "Argument count mismatch");
bind_impl(etl::make_index_sequence<sizeof...(TArgs)>{}, etl::forward<UArgs>(args)...);
Expand All @@ -121,7 +121,7 @@ namespace etl
/// \param args The new values to bind.
///*********************************************************************
template <size_t... Indexes, typename... UArgs>
ETL_CONSTEXPR14 void bind_impl(etl::index_sequence<Indexes...>, UArgs&&... args) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
ETL_CONSTEXPR14 void bind_impl(etl::index_sequence<Indexes...>, UArgs&&... args)
{
// Expand the pack and call bind<Index>(arg) for each argument
int dummy[] = {0, (bind<Indexes>(etl::forward<UArgs>(args)), 0)...};
Expand All @@ -134,7 +134,7 @@ namespace etl
/// \return The result of the delegate invocation.
//*********************************************************************
template<size_t... Indexes>
ETL_CONSTEXPR14 TReturn execute(etl::index_sequence<Indexes...>) const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
ETL_CONSTEXPR14 TReturn execute(etl::index_sequence<Indexes...>) const
{
return m_f(etl::get<Indexes>(m_args)...);
}
Expand Down
14 changes: 7 additions & 7 deletions include/etl/error_handler.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,13 @@ namespace etl
///\ingroup error_handler
//***************************************************************************
#if defined(ETL_NO_CHECKS)
#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(b, e) static_cast<void>(b) // Does nothing.
#define ETL_ASSERT_OR_RETURN(b, e) static_cast<void>(b) // Does nothing.
#define ETL_ASSERT_OR_RETURN_VALUE(b, e, v) static_cast<void>(b) // 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.
#define ETL_ASSERT_FAIL(e) static_cast<void>(b) // Does nothing.
#define ETL_ASSERT_FAIL_AND_RETURN(e) static_cast<void>(b) // Does nothing.
#define ETL_ASSERT_FAIL_AND_RETURN_VALUE(e, v) static_cast<void>(b) // Does nothing.
#elif defined(ETL_USE_ASSERT_FUNCTION)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

ETL_ASSERT_FAIL macros reference undefined identifier ‘b’

These expand to static_cast(b) but ‘b’ is not a macro parameter here, causing a compile error. They should be true no‑ops and must not evaluate ‘e’.

Apply this diff to align with the existing release branch behaviour (lines 360–363):

-  #define ETL_ASSERT_FAIL(e) static_cast<void>(b)                     // Does nothing.
-  #define ETL_ASSERT_FAIL_AND_RETURN(e) static_cast<void>(b)          // Does nothing.
-  #define ETL_ASSERT_FAIL_AND_RETURN_VALUE(e, v) static_cast<void>(b) // Does nothing.
+  #define ETL_ASSERT_FAIL(e)                                          // Does nothing.
+  #define ETL_ASSERT_FAIL_AND_RETURN(e) {return;}                     // Returns.
+  #define ETL_ASSERT_FAIL_AND_RETURN_VALUE(e, v) {return (v);}        // Returns a value.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
#define ETL_ASSERT_FAIL(e) static_cast<void>(b) // Does nothing.
#define ETL_ASSERT_FAIL_AND_RETURN(e) static_cast<void>(b) // Does nothing.
#define ETL_ASSERT_FAIL_AND_RETURN_VALUE(e, v) static_cast<void>(b) // Does nothing.
#elif defined(ETL_USE_ASSERT_FUNCTION)
#define ETL_ASSERT_FAIL(e) // Does nothing.
#define ETL_ASSERT_FAIL_AND_RETURN(e) {return;} // Returns.
#define ETL_ASSERT_FAIL_AND_RETURN_VALUE(e, v) {return (v);} // Returns a value.
#elif defined(ETL_USE_ASSERT_FUNCTION)
🤖 Prompt for AI Agents
In include/etl/error_handler.h around lines 308 to 311, the ETL_ASSERT_FAIL
macros incorrectly reference an undefined identifier 'b' (static_cast<void>(b))
which causes a compile error; update each macro so it is a true no‑op that does
not evaluate 'e' (match the release branch behavior) by replacing the
static_cast(void)(b) with a safe no‑op such as static_cast<void>(0) (or (void)0)
for ETL_ASSERT_FAIL, ETL_ASSERT_FAIL_AND_RETURN and
ETL_ASSERT_FAIL_AND_RETURN_VALUE.

#define ETL_ASSERT(b, e) {if (!(b)) ETL_UNLIKELY {etl::private_error_handler::assert_handler<0>::assert_function_ptr((e));}} // If the condition fails, calls the assert function
#define ETL_ASSERT_OR_RETURN(b, e) {if (!(b)) ETL_UNLIKELY {etl::private_error_handler::assert_handler<0>::assert_function_ptr((e)); return;}} // If the condition fails, calls the assert function and return
Expand Down Expand Up @@ -353,7 +353,7 @@ namespace etl
#define ETL_ASSERT_FAIL_AND_RETURN(e) {assert(false); return;} // Asserts.
#define ETL_ASSERT_FAIL_AND_RETURN_VALUE(e, v) {assert(false); return(v);} // Asserts.
#else
#define ETL_ASSERT(b, e) // Does nothing.
#define ETL_ASSERT(b, e) static_cast<void>(b) // Does nothing.
#define ETL_ASSERT_OR_RETURN(b, e) {if (!(b)) ETL_UNLIKELY return;} // Returns.
#define ETL_ASSERT_OR_RETURN_VALUE(b, e, v) {if (!(b)) ETL_UNLIKELY return(v);} // Returns a value.

Expand Down
26 changes: 13 additions & 13 deletions include/etl/private/delegate_cpp11.h
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ namespace etl
//*************************************************************************
/// Execute the delegate.
//*************************************************************************
ETL_CONSTEXPR14 TReturn operator()(TParams... args) const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
ETL_CONSTEXPR14 TReturn operator()(TParams... args) const
{
ETL_ASSERT(is_valid(), ETL_ERROR(delegate_uninitialised));

Expand All @@ -386,7 +386,7 @@ namespace etl
template <typename TRet = TReturn>
ETL_CONSTEXPR14
typename etl::enable_if_t<etl::is_same<TRet, void>::value, bool>
call_if(TParams... args) const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
call_if(TParams... args) const
{
if (is_valid())
{
Expand All @@ -406,7 +406,7 @@ namespace etl
template <typename TRet = TReturn>
ETL_CONSTEXPR14
typename etl::enable_if_t<!etl::is_same<TRet, void>::value, etl::optional<TReturn>>
call_if(TParams... args) const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
call_if(TParams... args) const
{
etl::optional<TReturn> result;

Expand All @@ -423,7 +423,7 @@ namespace etl
/// Run time alternative.
//*************************************************************************
template <typename TAlternative>
ETL_CONSTEXPR14 TReturn call_or(TAlternative alternative, TParams... args) const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
ETL_CONSTEXPR14 TReturn call_or(TAlternative alternative, TParams... args) const
{
if (is_valid())
{
Expand All @@ -440,7 +440,7 @@ namespace etl
/// Compile time alternative.
//*************************************************************************
template <TReturn(*Method)(TParams...)>
ETL_CONSTEXPR14 TReturn call_or(TParams... args) const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
ETL_CONSTEXPR14 TReturn call_or(TParams... args) const
{
if (is_valid())
{
Expand Down Expand Up @@ -583,7 +583,7 @@ namespace etl
/// Stub call for a member function. Run time instance.
//*************************************************************************
template <typename T, TReturn(T::*Method)(TParams...)>
static ETL_CONSTEXPR14 TReturn method_stub(void* object, TParams... params) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
static ETL_CONSTEXPR14 TReturn method_stub(void* object, TParams... params)
{
T* p = static_cast<T*>(object);
return (p->*Method)(etl::forward<TParams>(params)...);
Expand All @@ -593,7 +593,7 @@ namespace etl
/// Stub call for a const member function. Run time instance.
//*************************************************************************
template <typename T, TReturn(T::*Method)(TParams...) const>
static ETL_CONSTEXPR14 TReturn const_method_stub(void* object, TParams... params) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
static ETL_CONSTEXPR14 TReturn const_method_stub(void* object, TParams... params)
{
T* const p = static_cast<T*>(object);
return (p->*Method)(etl::forward<TParams>(params)...);
Expand All @@ -603,7 +603,7 @@ namespace etl
/// Stub call for a member function. Compile time instance.
//*************************************************************************
template <typename T, TReturn(T::*Method)(TParams...), T& Instance>
static ETL_CONSTEXPR14 TReturn method_instance_stub(void*, TParams... params) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
static ETL_CONSTEXPR14 TReturn method_instance_stub(void*, TParams... params)
{
return (Instance.*Method)(etl::forward<TParams>(params)...);
}
Expand All @@ -612,7 +612,7 @@ namespace etl
/// Stub call for a const member function. Compile time instance.
//*************************************************************************
template <typename T, TReturn(T::*Method)(TParams...) const, const T& Instance>
static ETL_CONSTEXPR14 TReturn const_method_instance_stub(void*, TParams... params) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
static ETL_CONSTEXPR14 TReturn const_method_instance_stub(void*, TParams... params)
{
return (Instance.*Method)(etl::forward<TParams>(params)...);
}
Expand All @@ -622,7 +622,7 @@ namespace etl
/// Stub call for a function operator. Compile time instance.
//*************************************************************************
template <typename T, T& Instance>
static ETL_CONSTEXPR14 TReturn operator_instance_stub(void*, TParams... params) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
static ETL_CONSTEXPR14 TReturn operator_instance_stub(void*, TParams... params)
{
return Instance.operator()(etl::forward<TParams>(params)...);
}
Expand All @@ -632,7 +632,7 @@ namespace etl
/// Stub call for a free function.
//*************************************************************************
template <TReturn(*Method)(TParams...)>
static ETL_CONSTEXPR14 TReturn function_stub(void*, TParams... params) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
static ETL_CONSTEXPR14 TReturn function_stub(void*, TParams... params)
{
return (Method)(etl::forward<TParams>(params)...);
}
Expand All @@ -641,7 +641,7 @@ namespace etl
/// Stub call for a lambda or functor function.
//*************************************************************************
template <typename TLambda>
static ETL_CONSTEXPR14 TReturn lambda_stub(void* object, TParams... arg) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
static ETL_CONSTEXPR14 TReturn lambda_stub(void* object, TParams... arg)
{
TLambda* p = static_cast<TLambda*>(object);
return (p->operator())(etl::forward<TParams>(arg)...);
Expand All @@ -651,7 +651,7 @@ namespace etl
/// Stub call for a const lambda or functor function.
//*************************************************************************
template <typename TLambda>
static ETL_CONSTEXPR14 TReturn const_lambda_stub(void* object, TParams... arg) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
static ETL_CONSTEXPR14 TReturn const_lambda_stub(void* object, TParams... arg)
{
const TLambda* p = static_cast<const TLambda*>(object);
return (p->operator())(etl::forward<TParams>(arg)...);
Expand Down
2 changes: 1 addition & 1 deletion include/etl/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ SOFTWARE.

#define ETL_VERSION_MAJOR 20
#define ETL_VERSION_MINOR 43
#define ETL_VERSION_PATCH 2
#define ETL_VERSION_PATCH 4

#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)
Expand Down
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Embedded Template Library",
"version": "20.43.2",
"version": "20.43.4",
"authors": {
"name": "John Wellbelove",
"email": "[email protected]"
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=Embedded Template Library
version=20.43.2
version=20.43.4
author= John Wellbelove <[email protected]>
maintainer=John Wellbelove <[email protected]>
license=MIT
Expand Down
11 changes: 11 additions & 0 deletions support/Release notes.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@
===============================================================================
20.43.4

#1185 Remove noexcept from delegate method stubs.

===============================================================================
20.43.3

Removed ETL_NOEXCEPT from delegate operator(), call_if(), and call_or()
Removed ETL_NOEXCEPT from closure

===============================================================================
20.43.2

Pull Requests:
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.43.2
20.43.4
Loading