From 5aea1632ad0eedc6c235e8a1965e5613322eaba8 Mon Sep 17 00:00:00 2001 From: Kim-J-Smith <3440910457@qq.com> Date: Fri, 17 Jul 2026 22:08:24 +0800 Subject: [PATCH 1/3] chore: remove diagnostic suppression for "-Wuninitialized". --- include/embed/embed_function.hpp | 28 +++++----------------------- 1 file changed, 5 insertions(+), 23 deletions(-) diff --git a/include/embed/embed_function.hpp b/include/embed/embed_function.hpp index f8cb9e4..2d6315f 100644 --- a/include/embed/embed_function.hpp +++ b/include/embed/embed_function.hpp @@ -2776,31 +2776,13 @@ namespace crtp_mixins { EMBED_NODISCARD EMBED_INLINE static constexpr bool is_copyable() noexcept { return internal_is_copyable; } -#if defined(__GNUC__) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wuninitialized" -#endif /// @brief All following methods that end with `= default` are implemented in /// the base class @e `crtp_mixins::lifetime_operations_impl`. - - // The destructor of the function wrapper, is trivial if `Config::isView == true`. - ~function() = default; - // The copy constructor of the function wrapper, `=delete` if `(Config::isView || - // Config::isCopyable) == true`, and is trivial if `Config::isView == true`. - function(const function& other) = default; - // The move constructor of the function wrapper, is trivial if - // `(Config::isView || Config::isCopyable) == true`. - function(function&& other) = default; - // The copy assignment of the function wrapper, `=delete` if `(Config::isView || - // Config::isCopyable) == true`, and is trivial if `Config::isView == true`. - function& operator=(const function& other) = default; - // The move assignment of the function wrapper, is trivial if - // `(Config::isView || Config::isCopyable) == true`. - function& operator=(function&& other) = default; - -#if defined(__GNUC__) -# pragma GCC diagnostic pop -#endif + ~function() = default; + function(const function& other) = default; + function(function&& other) = default; + function& operator=(const function& other) = default; + function& operator=(function&& other) = default; /// Implemented in the base class @e `crtp_mixins::core_components_impl`. using Base_CoreComponents::operator=; From 47a50fbac23badbb12f0df1e0524ac69900d92d0 Mon Sep 17 00:00:00 2001 From: Kim-J-Smith <3440910457@qq.com> Date: Fri, 17 Jul 2026 22:47:12 +0800 Subject: [PATCH 2/3] style: adjust some code style. --- include/embed/embed_function.hpp | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/include/embed/embed_function.hpp b/include/embed/embed_function.hpp index 2d6315f..6ef5e03 100644 --- a/include/embed/embed_function.hpp +++ b/include/embed/embed_function.hpp @@ -1034,13 +1034,8 @@ inline namespace fn_traits { // In view mode, the requires is special. // See . - static constexpr bool noexcept_qualifier_ok = - (unwrap_to::isNoexcept == unwrap_from::isNoexcept) - || ( - CfgTo::isView == true - && CfgFrom::isView == true - && unwrap_to::isNoexcept < unwrap_from::isNoexcept - ); + static constexpr bool noexcept_qualifier_ok = unwrap_to::isNoexcept == unwrap_from::isNoexcept + || (CfgTo::isView && CfgFrom::isView && unwrap_to::isNoexcept < unwrap_from::isNoexcept); static constexpr bool qualifier_ok = (unwrap_to::hasConst <= unwrap_from::hasConst) @@ -1075,7 +1070,7 @@ inline namespace fn_traits { struct is_nothrow_construct_from_functor< Functor, Class, void_t()) )>> : public bool_constant< - noexcept(::new (static_cast(0)) Class(std::declval())) + noexcept(::new (static_cast(nullptr)) Class(std::declval())) > {}; // Get invoke result with arguments package. From bd129305e3531627dcd6a327f24dc078ded3d71f Mon Sep 17 00:00:00 2001 From: Kim-J-Smith <3440910457@qq.com> Date: Sun, 19 Jul 2026 11:59:54 +0800 Subject: [PATCH 3/3] docs: revert comments about when it is trivial. --- include/embed/embed_function.hpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/embed/embed_function.hpp b/include/embed/embed_function.hpp index 6ef5e03..c505e1b 100644 --- a/include/embed/embed_function.hpp +++ b/include/embed/embed_function.hpp @@ -2772,7 +2772,8 @@ namespace crtp_mixins { is_copyable() noexcept { return internal_is_copyable; } /// @brief All following methods that end with `= default` are implemented in - /// the base class @e `crtp_mixins::lifetime_operations_impl`. + /// the base class @e `crtp_mixins::lifetime_operations_impl`. They are trivial + /// if `Config::isView` equals `true`. ~function() = default; function(const function& other) = default; function(function&& other) = default;