Replaced ETL_NOEXCEPT_IF_NO_THROW with ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)

This commit is contained in:
John Wellbelove 2025-09-06 09:46:03 +01:00
parent b85b071a3e
commit ce1c0e504b
4 changed files with 20 additions and 32 deletions

View File

@ -377,7 +377,7 @@ namespace etl
/// Constructs the instance of T forwarding the given \p args to its constructor.
//***************************************************************************
template <typename... TArgs>
typed_storage(TArgs&&... args) ETL_NOEXCEPT_IF_NO_THROW
typed_storage(TArgs&&... args) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
: valid(false)
{
create(etl::forward<TArgs>(args)...);
@ -448,7 +448,7 @@ namespace etl
/// \returns the instance of T which has been constructed in the internal byte array.
//***************************************************************************
template <typename... TArgs>
reference create(TArgs&&... args) ETL_NOEXCEPT_IF_NO_THROW
reference create(TArgs&&... args) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error));
valid = true;
@ -519,7 +519,7 @@ namespace etl
//***************************************************************************
/// \returns a pointer of type T and asserts if has_value() is false.
//***************************************************************************
pointer operator->() ETL_NOEXCEPT_IF_NO_THROW
pointer operator->() ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
ETL_ASSERT(has_value(), ETL_ERROR(etl::typed_storage_error));
@ -529,7 +529,7 @@ namespace etl
//***************************************************************************
/// \returns a const pointer of type T and asserts if has_value() is false.
//***************************************************************************
const_pointer operator->() const ETL_NOEXCEPT_IF_NO_THROW
const_pointer operator->() const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
ETL_ASSERT(has_value(), ETL_ERROR(etl::typed_storage_error));
@ -539,7 +539,7 @@ namespace etl
//***************************************************************************
/// \returns reference of type T and asserts if has_value() is false.
//***************************************************************************
reference operator*() ETL_NOEXCEPT_IF_NO_THROW
reference operator*() ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
return *operator->();
}
@ -547,7 +547,7 @@ namespace etl
//***************************************************************************
/// \returns const_reference of type T and asserts if has_value() is false.
//***************************************************************************
const_reference operator*() const ETL_NOEXCEPT_IF_NO_THROW
const_reference operator*() const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
return *operator->();
}
@ -603,7 +603,7 @@ namespace etl
//***************************************************************************
/// Constructor.
//***************************************************************************
typed_storage_ext(void* pbuffer_) ETL_NOEXCEPT_IF_NO_THROW
typed_storage_ext(void* pbuffer_) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
: pbuffer(reinterpret_cast<T*>(pbuffer_)),
valid(false)
{
@ -615,7 +615,7 @@ namespace etl
/// Constructs the instance of T forwarding the given \p args to its constructor.
//***************************************************************************
template <typename... TArgs>
typed_storage_ext(void* pbuffer_, TArgs&&... args) ETL_NOEXCEPT_IF_NO_THROW
typed_storage_ext(void* pbuffer_, TArgs&&... args) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
: pbuffer(reinterpret_cast<T*>(pbuffer_))
, valid(false)
{
@ -627,7 +627,7 @@ namespace etl
/// Move constructor.
/// Transfers ownership of the buffer from \p other to this.
//***************************************************************************
typed_storage_ext(typed_storage_ext<T>&& other) ETL_NOEXCEPT_IF_NO_THROW
typed_storage_ext(typed_storage_ext<T>&& other) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
: pbuffer(other.pbuffer)
, valid(other.valid)
{
@ -707,7 +707,7 @@ namespace etl
/// \returns the instance of T which has been constructed in the internal byte array.
//***************************************************************************
template <typename... TArgs>
reference create(TArgs&&... args) ETL_NOEXCEPT_IF_NO_THROW
reference create(TArgs&&... args) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
ETL_ASSERT(!has_value(), ETL_ERROR(etl::typed_storage_error));
valid = true;
@ -778,7 +778,7 @@ namespace etl
//***************************************************************************
/// \returns a pointer of type T and asserts if has_value() is false.
//***************************************************************************
pointer operator->() ETL_NOEXCEPT_IF_NO_THROW
pointer operator->() ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
ETL_ASSERT(has_value(), ETL_ERROR(etl::typed_storage_error));
@ -788,7 +788,7 @@ namespace etl
//***************************************************************************
/// \returns a const pointer of type T and asserts if has_value() is false.
//***************************************************************************
const_pointer operator->() const ETL_NOEXCEPT_IF_NO_THROW
const_pointer operator->() const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
ETL_ASSERT(has_value(), ETL_ERROR(etl::typed_storage_error));
@ -798,7 +798,7 @@ namespace etl
//***************************************************************************
/// \returns reference of type T and asserts if has_value() is false.
//***************************************************************************
reference operator*() ETL_NOEXCEPT_IF_NO_THROW
reference operator*() ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
return *operator->();
}
@ -806,7 +806,7 @@ namespace etl
//***************************************************************************
/// \returns const_reference of type T and asserts if has_value() is false.
//***************************************************************************
const_reference operator*() const ETL_NOEXCEPT_IF_NO_THROW
const_reference operator*() const ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
return *operator->();
}

View File

@ -47,7 +47,7 @@ namespace etl
{
public:
not_null_exception(string_type reason_, string_type file_name_, numeric_type line_number_) ETL_NOEXCEPT_IF_NO_THROW
not_null_exception(string_type reason_, string_type file_name_, numeric_type line_number_) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
: exception(reason_, file_name_, line_number_)
{
}
@ -60,7 +60,7 @@ namespace etl
{
public:
not_null_contains_null(string_type file_name_, numeric_type line_number_) ETL_NOEXCEPT_IF_NO_THROW
not_null_contains_null(string_type file_name_, numeric_type line_number_) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
: not_null_exception(ETL_ERROR_TEXT("not_null:contains null", ETL_NOT_NULL_FILE_ID"A"), file_name_, line_number_)
{
}
@ -93,7 +93,7 @@ namespace etl
/// Constructs a not_null from a pointer.
/// Asserts if the pointer is null.
//*********************************
ETL_CONSTEXPR14 explicit not_null(underlying_type ptr_) ETL_NOEXCEPT_IF_NO_THROW
ETL_CONSTEXPR14 explicit not_null(underlying_type ptr_) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
: ptr(ptr_)
{
ETL_ASSERT(ptr_ != ETL_NULLPTR, ETL_ERROR(not_null_contains_null));
@ -111,7 +111,7 @@ namespace etl
/// Assignment from a pointer.
/// Asserts if the pointer is null.
//*********************************
ETL_CONSTEXPR14 not_null& operator =(underlying_type rhs) ETL_NOEXCEPT_IF_NO_THROW
ETL_CONSTEXPR14 not_null& operator =(underlying_type rhs) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
ETL_ASSERT_OR_RETURN_VALUE(rhs != ETL_NULLPTR, ETL_ERROR(not_null_contains_null), *this);
@ -194,7 +194,7 @@ namespace etl
/// Asserts if the unique_ptr contains null.
/// Moves from the unique_ptr.
//*********************************
ETL_CONSTEXPR14 explicit not_null(underlying_type&& u_ptr_) ETL_NOEXCEPT_IF_NO_THROW
ETL_CONSTEXPR14 explicit not_null(underlying_type&& u_ptr_) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
: u_ptr(etl::move(u_ptr_))
{
ETL_ASSERT(u_ptr.get() != ETL_NULLPTR, ETL_ERROR(not_null_contains_null));
@ -205,7 +205,7 @@ namespace etl
/// Asserts if the unique_ptr contains null.
/// Moves from the unique_ptr.
//*********************************
ETL_CONSTEXPR14 not_null& operator =(underlying_type&& rhs) ETL_NOEXCEPT_IF_NO_THROW
ETL_CONSTEXPR14 not_null& operator =(underlying_type&& rhs) ETL_NOEXCEPT_EXPR(ETL_NOT_USING_EXCEPTIONS)
{
ETL_ASSERT_OR_RETURN_VALUE(rhs.get() != ETL_NULLPTR, ETL_ERROR(not_null_contains_null), *this);

View File

@ -333,14 +333,6 @@ SOFTWARE.
#define ETL_LVALUE_REF_QUALIFIER &
#define ETL_NOEXCEPT noexcept
#define ETL_NOEXCEPT_EXPR(...) noexcept(__VA_ARGS__)
#if ETL_NOT_USING_EXCEPTIONS
#define ETL_NOEXCEPT_IF_NO_THROW noexcept
#define ETL_NOEXCEPT_IF_NO_THROW_EXPR(...) noexcept(__VA_ARGS__)
#else
#define ETL_NOEXCEPT_IF_NO_THROW
#define ETL_NOEXCEPT_IF_NO_THROW_EXPR(...)
#endif
#else
#define ETL_CONSTEXPR
#define ETL_CONSTEXPR11
@ -356,8 +348,6 @@ SOFTWARE.
#define ETL_ENUM_CLASS(name) enum name
#define ETL_ENUM_CLASS_TYPE(name, type) enum name
#define ETL_LVALUE_REF_QUALIFIER
#define ETL_NOEXCEPT_IF_NO_THROW
#define ETL_NOEXCEPT_IF_NO_THROW_EXPR(...)
#endif
//*************************************

View File

@ -978,5 +978,3 @@ namespace
}
};
}