From 921e23e8d122cd0597cab2b2d1c93b93d48ae0a0 Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Tue, 21 Dec 2021 20:38:17 -0500 Subject: [PATCH 1/3] Disable clang suggest-override warnings for proxy clients Warnings look like "warning: 'initError' overrides a member function but is not marked 'override' [-Wsuggest-override]" Warnings were originally reported by Sjors Provoost and are tracked in https://github.com/chaincodelabs/libmultiprocess/issues/61 The same warnings were previously disabled for GCC in 05f9817c369a5b74a9a802b0af063c103560a1cc https://github.com/chaincodelabs/libmultiprocess/pull/40 and that change is extended here to apply to clang. The methods triggering the warnings are not virtual in all cases and should not have the override keyword. --- src/mp/gen.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/mp/gen.cpp b/src/mp/gen.cpp index 36ba16a8..3cc9892e 100644 --- a/src/mp/gen.cpp +++ b/src/mp/gen.cpp @@ -211,7 +211,7 @@ void Generate(kj::StringPtr src_prefix, } } h << "#include <" << PROXY_DECL << ">\n\n"; - h << "#if defined(__GNUC__) && !defined(__clang__)\n"; + h << "#if defined(__GNUC__)\n"; h << "#pragma GCC diagnostic push\n"; h << "#pragma GCC diagnostic ignored \"-Wsuggest-override\"\n"; h << "#endif\n"; @@ -581,7 +581,7 @@ void Generate(kj::StringPtr src_prefix, inl << "#endif\n"; h << "} // namespace mp\n"; - h << "#if defined(__GNUC__) && !defined(__clang__)\n"; + h << "#if defined(__GNUC__)\n"; h << "#pragma GCC diagnostic pop\n"; h << "#endif\n"; h << "#endif\n"; From 5738b8ae0993bc4d9e9dd9bbf00a19ae5d115f62 Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Tue, 21 Dec 2021 20:21:21 -0500 Subject: [PATCH 2/3] Avoid delete-non-abstract-non-virtual-dtor warnings Warnings look like "warning: destructor called on non-final 'mp::ProxyClient' that has virtual functions but non-virtual destructor [-Wdelete-non-abstract-non-virtual-dtor]" Warnings were originally reported by Sjors Provoost and are tracked in https://github.com/chaincodelabs/libmultiprocess/issues/61 Avoid these by adding final keywords to generated class declarations --- src/mp/gen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mp/gen.cpp b/src/mp/gen.cpp index 3cc9892e..13071fba 100644 --- a/src/mp/gen.cpp +++ b/src/mp/gen.cpp @@ -330,7 +330,7 @@ void Generate(kj::StringPtr src_prefix, const auto& interface = node.asInterface(); std::ostringstream client; - client << "template<>\nstruct ProxyClient<" << message_namespace << "::" << node_name << "> : "; + client << "template<>\nstruct ProxyClient<" << message_namespace << "::" << node_name << "> final : "; client << "public ProxyClientCustom<" << message_namespace << "::" << node_name << ", " << proxied_class_type << ">\n{\n"; client << "public:\n"; From 1b638d67de38c05c84e7cda9a2087e6539522891 Mon Sep 17 00:00:00 2001 From: Russell Yanofsky Date: Tue, 21 Dec 2021 20:26:12 -0500 Subject: [PATCH 3/3] Avoid delete-non-abstract-non-virtual-dtor warnings for mp::ProxyCallbackImpl Warnings look like "warning: destructor called on non-final 'mp::ProxyCallbackImpl' that has virtual functions but non-virtual destructor [-Wdelete-non-abstract-non-virtual-dtor]" Avoid these by adding final keyword to class declaration --- include/mp/proxy-types.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/mp/proxy-types.h b/include/mp/proxy-types.h index 99bf4569..410de123 100644 --- a/include/mp/proxy-types.h +++ b/include/mp/proxy-types.h @@ -644,7 +644,7 @@ void BuildField(TypeList, Context& context, Output&& output, Valu //! Adapter to convert ProxyCallback object call to function object call. template -class ProxyCallbackImpl : public ProxyCallback> +class ProxyCallbackImpl final : public ProxyCallback> { using Fn = std::function; Fn m_fn;