Made all 'noexcept' statements use ETL_NOEXCEPT macro (#1179)

* Added coderabbitai configuration

* Made all 'noexcept' statements use ETL_NOEXCEPT macro

---------

Co-authored-by: John Wellbelove <john.wellbelove@asterconsulting.co.uk>
Co-authored-by: John Wellbelove <jwellbelove@users.noreply.github.com>
This commit is contained in:
David Ockey 2025-09-06 03:32:03 -05:00 committed by GitHub
parent e760e62dcd
commit b85b071a3e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
14 changed files with 62 additions and 63 deletions

View File

@ -197,4 +197,3 @@ reviews:
chat:
art: false
auto_reply: true

View File

@ -41,7 +41,7 @@ namespace etl
template <typename TInteger>
constexpr
typename etl::enable_if<etl::is_integral<TInteger>::value, TInteger>::type
to_integer(etl::byte b) noexcept
to_integer(etl::byte b) ETL_NOEXCEPT
{
return TInteger(b);
}
@ -52,7 +52,7 @@ namespace etl
template <typename TInteger>
constexpr
typename etl::enable_if<etl::is_integral<TInteger>::value, etl::byte>::type
operator <<(etl::byte b, TInteger shift) noexcept
operator <<(etl::byte b, TInteger shift) ETL_NOEXCEPT
{
return etl::byte(static_cast<unsigned int>(b) << shift);
}
@ -63,7 +63,7 @@ namespace etl
template <typename TInteger>
constexpr
typename etl::enable_if<etl::is_integral<TInteger>::value, etl::byte>::type
operator >>(etl::byte b, TInteger shift) noexcept
operator >>(etl::byte b, TInteger shift) ETL_NOEXCEPT
{
return etl::byte(static_cast<unsigned int>(b) >> shift);
}
@ -74,7 +74,7 @@ namespace etl
template <typename TInteger>
constexpr
typename etl::enable_if<etl::is_integral<TInteger>::value, etl::byte&>::type
operator <<=(etl::byte& b, TInteger shift) noexcept
operator <<=(etl::byte& b, TInteger shift) ETL_NOEXCEPT
{
return b = b << shift;;
}
@ -85,7 +85,7 @@ namespace etl
template <typename TInteger>
constexpr
typename etl::enable_if<etl::is_integral<TInteger>::value, etl::byte&>::type
operator >>=(etl::byte& b, TInteger shift) noexcept
operator >>=(etl::byte& b, TInteger shift) ETL_NOEXCEPT
{
return b = b >> shift;
}
@ -93,7 +93,7 @@ namespace etl
//*************************************************************************
/// Or.
//*************************************************************************
inline constexpr etl::byte operator |(etl::byte lhs, etl::byte rhs) noexcept
inline constexpr etl::byte operator |(etl::byte lhs, etl::byte rhs) ETL_NOEXCEPT
{
return etl::byte(static_cast<unsigned int>(lhs) | static_cast<unsigned int>(rhs));
}
@ -101,7 +101,7 @@ namespace etl
//*************************************************************************
/// And.
//*************************************************************************
inline constexpr etl::byte operator &(etl::byte lhs, etl::byte rhs) noexcept
inline constexpr etl::byte operator &(etl::byte lhs, etl::byte rhs) ETL_NOEXCEPT
{
return etl::byte(static_cast<unsigned int>(lhs) & static_cast<unsigned int>(rhs));
}
@ -109,7 +109,7 @@ namespace etl
//*************************************************************************
/// Exclusive Or.
//*************************************************************************
inline constexpr etl::byte operator ^(etl::byte lhs, etl::byte rhs) noexcept
inline constexpr etl::byte operator ^(etl::byte lhs, etl::byte rhs) ETL_NOEXCEPT
{
return etl::byte(static_cast<unsigned int>(lhs) ^ static_cast<unsigned int>(rhs));
}
@ -117,7 +117,7 @@ namespace etl
//*************************************************************************
/// Or equals.
//*************************************************************************
inline ETL_CONSTEXPR14 etl::byte& operator |=(etl::byte& lhs, etl::byte rhs) noexcept
inline ETL_CONSTEXPR14 etl::byte& operator |=(etl::byte& lhs, etl::byte rhs) ETL_NOEXCEPT
{
return lhs = lhs | rhs;
}
@ -125,7 +125,7 @@ namespace etl
//*************************************************************************
/// And equals
//*************************************************************************
inline ETL_CONSTEXPR14 etl::byte& operator &=(etl::byte& lhs, etl::byte rhs) noexcept
inline ETL_CONSTEXPR14 etl::byte& operator &=(etl::byte& lhs, etl::byte rhs) ETL_NOEXCEPT
{
return lhs = lhs & rhs;
}
@ -133,7 +133,7 @@ namespace etl
//*************************************************************************
/// Exclusive or equals.
//*************************************************************************
inline ETL_CONSTEXPR14 etl::byte& operator ^=(etl::byte& lhs, etl::byte rhs) noexcept
inline ETL_CONSTEXPR14 etl::byte& operator ^=(etl::byte& lhs, etl::byte rhs) ETL_NOEXCEPT
{
return lhs = lhs ^ rhs;
}
@ -141,7 +141,7 @@ namespace etl
//*************************************************************************
/// Not.
//*************************************************************************
inline constexpr etl::byte operator ~(etl::byte b) noexcept
inline constexpr etl::byte operator ~(etl::byte b) ETL_NOEXCEPT
{
return etl::byte(~static_cast<unsigned int>(b));
}

View File

@ -71,7 +71,7 @@ namespace std
//*************************************************************************
/// Default constructor
//*************************************************************************
constexpr initializer_list() noexcept
constexpr initializer_list() ETL_NOEXCEPT
: pfirst(nullptr), plast(nullptr)
{
}
@ -79,7 +79,7 @@ namespace std
//*************************************************************************
/// Constructor
//*************************************************************************
constexpr initializer_list(const T* pfirst_, const T* plast_) noexcept
constexpr initializer_list(const T* pfirst_, const T* plast_) ETL_NOEXCEPT
: pfirst(pfirst_), plast(plast_)
{
}
@ -87,7 +87,7 @@ namespace std
//*************************************************************************
/// Get the beginning of the list.
//*************************************************************************
constexpr const T* begin() const noexcept
constexpr const T* begin() const ETL_NOEXCEPT
{
return pfirst;
}
@ -95,7 +95,7 @@ namespace std
//*************************************************************************
/// Get the end of the list.
//*************************************************************************
constexpr const T* end() const noexcept
constexpr const T* end() const ETL_NOEXCEPT
{
return plast;
}
@ -103,7 +103,7 @@ namespace std
//*************************************************************************
/// Get the size of the list.
//*************************************************************************
constexpr size_t size() const noexcept
constexpr size_t size() const ETL_NOEXCEPT
{
return static_cast<size_t>(plast - pfirst);
}
@ -118,7 +118,7 @@ namespace std
/// Get the beginning of the list.
//*************************************************************************
template<typename T>
constexpr const T* begin(initializer_list<T> init) noexcept
constexpr const T* begin(initializer_list<T> init) ETL_NOEXCEPT
{
return init.begin();
}
@ -127,7 +127,7 @@ namespace std
/// Get the end of the list.
//*************************************************************************
template <typename T>
constexpr const T* end(initializer_list<T> init) noexcept
constexpr const T* end(initializer_list<T> init) ETL_NOEXCEPT
{
return init.end();
}
@ -154,7 +154,7 @@ namespace std
//*************************************************************************
/// Default constructor
//*************************************************************************
constexpr initializer_list() noexcept
constexpr initializer_list() ETL_NOEXCEPT
: pfirst(nullptr), length(0)
{
}
@ -162,7 +162,7 @@ namespace std
//*************************************************************************
/// Get the beginning of the list.
//*************************************************************************
constexpr const T* begin() const noexcept
constexpr const T* begin() const ETL_NOEXCEPT
{
return pfirst;
}
@ -170,7 +170,7 @@ namespace std
//*************************************************************************
/// Get the end of the list.
//*************************************************************************
constexpr const T* end() const noexcept
constexpr const T* end() const ETL_NOEXCEPT
{
return pfirst + length;
}
@ -178,7 +178,7 @@ namespace std
//*************************************************************************
/// Get the size of the list.
//*************************************************************************
constexpr size_t size() const noexcept
constexpr size_t size() const ETL_NOEXCEPT
{
return length;
}
@ -188,7 +188,7 @@ namespace std
//*************************************************************************
/// Constructor
//*************************************************************************
constexpr initializer_list(const T* pfirst_, size_t length_) noexcept
constexpr initializer_list(const T* pfirst_, size_t length_) ETL_NOEXCEPT
: pfirst(pfirst_)
, length(length_)
{
@ -202,7 +202,7 @@ namespace std
/// Get the beginning of the list.
//*************************************************************************
template<class T>
constexpr const T* begin(initializer_list<T> init) noexcept
constexpr const T* begin(initializer_list<T> init) ETL_NOEXCEPT
{
return init.begin();
}
@ -211,7 +211,7 @@ namespace std
/// Get the end of the list.
//*************************************************************************
template<class T>
constexpr const T* end(initializer_list<T> init) noexcept
constexpr const T* end(initializer_list<T> init) ETL_NOEXCEPT
{
return init.end();
}

View File

@ -259,7 +259,7 @@ namespace etl
/// Spaceship operator
//***********************************************************************
#if ETL_USING_CPP20
[[nodiscard]] inline constexpr auto operator <=>(const etl::chrono::day& d1, const etl::chrono::day& d2) noexcept
[[nodiscard]] inline constexpr auto operator <=>(const etl::chrono::day& d1, const etl::chrono::day& d2) ETL_NOEXCEPT
{
return (static_cast<unsigned>(d1) <=> static_cast<unsigned>(d2));
}
@ -341,9 +341,9 @@ namespace etl
inline namespace chrono_literals
{
#if ETL_USING_VERBOSE_CHRONO_LITERALS
inline ETL_CONSTEXPR14 etl::chrono::day operator ""_day(unsigned long long d) noexcept
inline ETL_CONSTEXPR14 etl::chrono::day operator ""_day(unsigned long long d) ETL_NOEXCEPT
#else
inline ETL_CONSTEXPR14 etl::chrono::day operator ""_d(unsigned long long d) noexcept
inline ETL_CONSTEXPR14 etl::chrono::day operator ""_d(unsigned long long d) ETL_NOEXCEPT
#endif
{
return etl::chrono::day(static_cast<unsigned>(d));

View File

@ -261,7 +261,7 @@ namespace etl
/// Spaceship operator
//***********************************************************************
#if ETL_USING_CPP20
[[nodiscard]] inline constexpr auto operator <=>(const etl::chrono::month& d1, const etl::chrono::month& d2) noexcept
[[nodiscard]] inline constexpr auto operator <=>(const etl::chrono::month& d1, const etl::chrono::month& d2) ETL_NOEXCEPT
{
return (static_cast<unsigned>(d1) <=> static_cast<unsigned>(d2));
}

View File

@ -193,7 +193,7 @@ namespace etl
//***********************************************************************
#if ETL_USING_CPP20
[[nodiscard]] inline constexpr auto operator <=>(const etl::chrono::month_day& lhs,
const etl::chrono::month_day& rhs) noexcept
const etl::chrono::month_day& rhs) ETL_NOEXCEPT
{
auto cmp = lhs.month() <=> rhs.month();
@ -321,7 +321,7 @@ namespace etl
/// Spaceship operator
//***********************************************************************
#if ETL_USING_CPP20
[[nodiscard]] inline constexpr auto operator <=>(const etl::chrono::month_day_last& mdl1, const etl::chrono::month_day_last& mdl2) noexcept
[[nodiscard]] inline constexpr auto operator <=>(const etl::chrono::month_day_last& mdl1, const etl::chrono::month_day_last& mdl2) ETL_NOEXCEPT
{
return (static_cast<unsigned>(mdl1.month()) <=> static_cast<unsigned>(mdl2.month()));
}

View File

@ -268,7 +268,7 @@ namespace etl
//***********************************************************************
#if ETL_USING_CPP20
template <typename TClock, typename TDuration1, typename TDuration2>
[[nodiscard]] constexpr auto operator <=>(const etl::chrono::time_point<TClock, TDuration1>& lhs, const etl::chrono::time_point<TClock, TDuration2>& rhs) noexcept
[[nodiscard]] constexpr auto operator <=>(const etl::chrono::time_point<TClock, TDuration1>& lhs, const etl::chrono::time_point<TClock, TDuration2>& rhs) ETL_NOEXCEPT
{
return (lhs.time_since_epoch() <=> rhs.time_since_epoch());
}

View File

@ -259,7 +259,7 @@ namespace etl
/// Spaceship operator
//***********************************************************************
#if ETL_USING_CPP20
[[nodiscard]] inline constexpr auto operator <=>(const etl::chrono::year& y1, const etl::chrono::year& y2) noexcept
[[nodiscard]] inline constexpr auto operator <=>(const etl::chrono::year& y1, const etl::chrono::year& y2) ETL_NOEXCEPT
{
return (static_cast<unsigned>(y1) <=> static_cast<unsigned>(y2));
}
@ -357,9 +357,9 @@ namespace etl
/// Literal for years
//***********************************************************************
#if ETL_USING_VERBOSE_CHRONO_LITERALS
inline ETL_CONSTEXPR14 etl::chrono::year operator ""_year(unsigned long long y) noexcept
inline ETL_CONSTEXPR14 etl::chrono::year operator ""_year(unsigned long long y) ETL_NOEXCEPT
#else
inline ETL_CONSTEXPR14 etl::chrono::year operator ""_y(unsigned long long y) noexcept
inline ETL_CONSTEXPR14 etl::chrono::year operator ""_y(unsigned long long y) ETL_NOEXCEPT
#endif
{
return etl::chrono::year(static_cast<int16_t>(y));

View File

@ -268,7 +268,7 @@ namespace etl
//***********************************
// holds_alternative. Forward declaration
template <typename T, typename... TTypes>
ETL_CONSTEXPR14 bool holds_alternative(const etl::variant<TTypes...>& v) noexcept;
ETL_CONSTEXPR14 bool holds_alternative(const etl::variant<TTypes...>& v) ETL_NOEXCEPT;
//***********************************
// get. Forward declarations
@ -305,14 +305,14 @@ namespace etl
#include "variant_select_do_operator.h"
#endif
constexpr bool operator >(etl::monostate, etl::monostate) noexcept { return false; }
constexpr bool operator <(etl::monostate, etl::monostate) noexcept { return false; }
constexpr bool operator !=(etl::monostate, etl::monostate) noexcept { return false; }
constexpr bool operator <=(etl::monostate, etl::monostate) noexcept { return true; }
constexpr bool operator >=(etl::monostate, etl::monostate) noexcept { return true; }
constexpr bool operator ==(etl::monostate, etl::monostate) noexcept { return true; }
constexpr bool operator >(etl::monostate, etl::monostate) ETL_NOEXCEPT { return false; }
constexpr bool operator <(etl::monostate, etl::monostate) ETL_NOEXCEPT { return false; }
constexpr bool operator !=(etl::monostate, etl::monostate) ETL_NOEXCEPT { return false; }
constexpr bool operator <=(etl::monostate, etl::monostate) ETL_NOEXCEPT { return true; }
constexpr bool operator >=(etl::monostate, etl::monostate) ETL_NOEXCEPT { return true; }
constexpr bool operator ==(etl::monostate, etl::monostate) ETL_NOEXCEPT { return true; }
#if ETL_USING_CPP20 && ETL_USING_STL && !(defined(ETL_DEVELOPMENT_OS_APPLE) && defined(ETL_COMPILER_CLANG))
constexpr std::strong_ordering operator<=>(monostate, monostate) noexcept
constexpr std::strong_ordering operator<=>(monostate, monostate) ETL_NOEXCEPT
{
return std::strong_ordering::equal;
}
@ -782,7 +782,7 @@ namespace etl
/// Checks whether a valid value is currently stored.
///\return <b>true</b> if the value is valid, otherwise <b>false</b>.
//***************************************************************************
constexpr bool valueless_by_exception() const noexcept
constexpr bool valueless_by_exception() const ETL_NOEXCEPT
{
return type_id == variant_npos;
}
@ -790,7 +790,7 @@ namespace etl
//***************************************************************************
/// Gets the index of the type currently stored or variant_npos
//***************************************************************************
constexpr size_t index() const noexcept
constexpr size_t index() const ETL_NOEXCEPT
{
return type_id;
}
@ -812,14 +812,14 @@ namespace etl
///\return <b>true</b> if it is the specified type, otherwise <b>false</b>.
//***************************************************************************
template <typename T, etl::enable_if_t<is_supported_type<T>(), int> = 0>
constexpr bool is_type() const noexcept
constexpr bool is_type() const ETL_NOEXCEPT
{
return (type_id == index_of_type<T>::value);
}
//***************************************************************************
template <typename T, etl::enable_if_t<!is_supported_type<T>(), int> = 0>
constexpr bool is_type() const noexcept
constexpr bool is_type() const ETL_NOEXCEPT
{
return false;
}
@ -838,7 +838,7 @@ namespace etl
//***************************************************************************
/// Swaps this variant with another.
//***************************************************************************
void swap(variant& rhs) noexcept
void swap(variant& rhs) ETL_NOEXCEPT
{
variant temp(etl::move(*this));
*this = etl::move(rhs);
@ -1221,7 +1221,7 @@ namespace etl
/// Checks if the variant v holds the alternative T.
//***************************************************************************
template <typename T, typename... TTypes>
ETL_CONSTEXPR14 bool holds_alternative(const etl::variant<TTypes...>& v) noexcept
ETL_CONSTEXPR14 bool holds_alternative(const etl::variant<TTypes...>& v) ETL_NOEXCEPT
{
constexpr size_t Index = etl::type_list_index_of_type<etl::type_list<TTypes...>, T>::value;
@ -1232,7 +1232,7 @@ namespace etl
/// Checks if the variant v holds the alternative Index.
//***************************************************************************
template <size_t Index, typename... TTypes>
ETL_CONSTEXPR14 bool holds_alternative(const etl::variant<TTypes...>& v) noexcept
ETL_CONSTEXPR14 bool holds_alternative(const etl::variant<TTypes...>& v) ETL_NOEXCEPT
{
return (Index == v.index());
}
@ -1241,7 +1241,7 @@ namespace etl
/// Checks if the variant v holds the alternative Index. (Runtime)
//***************************************************************************
template <typename... TTypes>
ETL_CONSTEXPR14 bool holds_alternative(size_t index, const etl::variant<TTypes...>& v) noexcept
ETL_CONSTEXPR14 bool holds_alternative(size_t index, const etl::variant<TTypes...>& v) ETL_NOEXCEPT
{
return (index == v.index());
}
@ -1351,7 +1351,7 @@ namespace etl
//***************************************************************************
template< size_t Index, typename... TTypes >
ETL_CONSTEXPR14 etl::add_pointer_t<etl::variant_alternative_t<Index, etl::variant<TTypes...>>>
get_if(etl::variant<TTypes...>* pv) noexcept
get_if(etl::variant<TTypes...>* pv) ETL_NOEXCEPT
{
if ((pv != nullptr) && (pv->index() == Index))
{
@ -1366,7 +1366,7 @@ namespace etl
//***********************************
template< size_t Index, typename... TTypes >
ETL_CONSTEXPR14 etl::add_pointer_t<const etl::variant_alternative_t<Index, etl::variant<TTypes...>>>
get_if(const etl::variant<TTypes...>* pv) noexcept
get_if(const etl::variant<TTypes...>* pv) ETL_NOEXCEPT
{
if ((pv != nullptr) && (pv->index() == Index))
{
@ -1380,7 +1380,7 @@ namespace etl
//***********************************
template< class T, typename... TTypes >
ETL_CONSTEXPR14 etl::add_pointer_t<T> get_if(etl::variant<TTypes...>* pv) noexcept
ETL_CONSTEXPR14 etl::add_pointer_t<T> get_if(etl::variant<TTypes...>* pv) ETL_NOEXCEPT
{
constexpr size_t Index = etl::type_list_index_of_type<etl::type_list<TTypes...>, T>::value;
@ -1396,7 +1396,7 @@ namespace etl
//***********************************
template< typename T, typename... TTypes >
ETL_CONSTEXPR14 etl::add_pointer_t<const T> get_if(const etl::variant<TTypes...>* pv) noexcept
ETL_CONSTEXPR14 etl::add_pointer_t<const T> get_if(const etl::variant<TTypes...>* pv) ETL_NOEXCEPT
{
constexpr size_t Index = etl::type_list_index_of_type<etl::type_list<TTypes...>, T>::value;
@ -1561,7 +1561,7 @@ namespace etl
using function_pointer = add_pointer_t<TRet(TCallable&&, TCurVariant&&, TVarRest&&...)>;
template <size_t tIndex>
static constexpr function_pointer fptr() noexcept
static constexpr function_pointer fptr() ETL_NOEXCEPT
{
return &do_visit_single<TRet, TCallable, TCurVariant, tIndex, TVarRest...>;
}

View File

@ -48,7 +48,7 @@ namespace etl
{
inline namespace string_literals
{
inline constexpr etl::string_view operator ""_sv(const char* str, size_t length) noexcept
inline constexpr etl::string_view operator ""_sv(const char* str, size_t length) ETL_NOEXCEPT
{
return etl::string_view{ str, length };
}

View File

@ -46,7 +46,7 @@ namespace etl
{
inline namespace string_literals
{
inline constexpr etl::u16string_view operator ""_sv(const char16_t* str, size_t length) noexcept
inline constexpr etl::u16string_view operator ""_sv(const char16_t* str, size_t length) ETL_NOEXCEPT
{
return etl::u16string_view{ str, length };
}

View File

@ -46,7 +46,7 @@ namespace etl
{
inline namespace string_literals
{
inline constexpr etl::u32string_view operator ""_sv(const char32_t* str, size_t length) noexcept
inline constexpr etl::u32string_view operator ""_sv(const char32_t* str, size_t length) ETL_NOEXCEPT
{
return etl::u32string_view{ str, length };
}

View File

@ -49,7 +49,7 @@ namespace etl
{
inline namespace string_literals
{
inline constexpr etl::u8string_view operator ""_sv(const char8_t* str, size_t length) noexcept
inline constexpr etl::u8string_view operator ""_sv(const char8_t* str, size_t length) ETL_NOEXCEPT
{
return etl::u8string_view{ str, length };
}

View File

@ -46,7 +46,7 @@ namespace etl
{
inline namespace string_literals
{
inline constexpr etl::wstring_view operator ""_sv(const wchar_t* str, size_t length) noexcept
inline constexpr etl::wstring_view operator ""_sv(const wchar_t* str, size_t length) ETL_NOEXCEPT
{
return etl::wstring_view{ str, length };
}