diff --git a/cppwinrt/code_writers.h b/cppwinrt/code_writers.h index 9d4b98e23..1ab71f79f 100644 --- a/cppwinrt/code_writers.h +++ b/cppwinrt/code_writers.h @@ -992,9 +992,8 @@ namespace cppwinrt auto method_name = get_name(method); auto type = method.Parent(); - w.write(" %WINRT_IMPL_AUTO(%) %(%) const%;\n", + w.write(" %auto %(%) const%;\n", is_get_overload(method) ? "[[nodiscard]] " : "", - signature.return_signature(), method_name, bind(signature), is_noexcept(method) ? " noexcept" : ""); @@ -1133,7 +1132,7 @@ namespace cppwinrt if (is_remove_overload(method)) { // we intentionally ignore errors when unregistering event handlers to be consistent with event_revoker - format = R"( template WINRT_IMPL_AUTO(%) consume_%::%(%) const noexcept + format = R"( template auto consume_%::%(%) const noexcept {% WINRT_IMPL_SHIM(%)->%(%);% } @@ -1141,7 +1140,7 @@ namespace cppwinrt } else { - format = R"( template WINRT_IMPL_AUTO(%) consume_%::%(%) const noexcept + format = R"( template auto consume_%::%(%) const noexcept {% WINRT_VERIFY_(0, WINRT_IMPL_SHIM(%)->%(%));% } @@ -1150,7 +1149,7 @@ namespace cppwinrt } else { - format = R"( template WINRT_IMPL_AUTO(%) consume_%::%(%) const + format = R"( template auto consume_%::%(%) const {% check_hresult(WINRT_IMPL_SHIM(%)->%(%));% } @@ -1159,7 +1158,6 @@ namespace cppwinrt w.write(format, bind(generics), - signature.return_signature(), type_impl_name, bind(generics), method_name, @@ -1207,14 +1205,13 @@ namespace cppwinrt // return static_cast<% const&>(*this).%(%); // - std::string_view format = R"( inline WINRT_IMPL_AUTO(%) %::%(%) const% + std::string_view format = R"( inline auto %::%(%) const% { return [&](% const& winrt_impl_base) { return winrt_impl_base.%(%); }(*this); } )"; w.write(format, - signature.return_signature(), class_type.TypeName(), method_name, bind(signature), @@ -1999,7 +1996,7 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable static void write_interface_override_method(writer& w, MethodDef const& method, std::string_view const& interface_name) { - auto format = R"( template WINRT_IMPL_AUTO(%) %T::%(%) const% + auto format = R"( template auto %T::%(%) const% { return shim().template try_as<%>().%(%); } @@ -2009,7 +2006,6 @@ struct __declspec(empty_bases) produce_dispatch_to_overridable auto method_name = get_name(method); w.write(format, - signature.return_signature(), interface_name, method_name, bind(signature), diff --git a/strings/base_macros.h b/strings/base_macros.h index 1b96e240c..40473bb5d 100644 --- a/strings/base_macros.h +++ b/strings/base_macros.h @@ -15,12 +15,6 @@ #define WINRT_IMPL_SHIM(...) (*(abi_t<__VA_ARGS__>**)&static_cast<__VA_ARGS__ const&>(static_cast(*this))) -#ifdef __INTELLISENSE__ -#define WINRT_IMPL_AUTO(...) __VA_ARGS__ -#else -#define WINRT_IMPL_AUTO(...) auto -#endif - // Note: this is a workaround for a false-positive warning produced by the Visual C++ 15.9 compiler. #pragma warning(disable : 5046)