From 13eb5eafd535a677a0fd9b16d391d45d8bec03b0 Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Wed, 30 Nov 2022 23:56:34 -0800 Subject: [PATCH] Changes related to PR #4285 (new style of warning suppression based on push/pop) --- include/pybind11/detail/init.h | 4 ++-- include/pybind11/stl.h | 10 +++------- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/include/pybind11/detail/init.h b/include/pybind11/detail/init.h index 8e679295e..cbeed0aa5 100644 --- a/include/pybind11/detail/init.h +++ b/include/pybind11/detail/init.h @@ -209,7 +209,7 @@ void construct(value_and_holder &v_h, std::unique_ptr, D> &&unq_ptr, PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(need_alias); auto *ptr = unq_ptr.get(); no_nullptr(ptr); - if (PYBIND11_SILENCE_MSVC_C4127(Class::has_alias) && need_alias && !is_alias(ptr)) { + if (Class::has_alias && need_alias && !is_alias(ptr)) { throw type_error("pybind11::init(): construction failed: returned std::unique_ptr pointee " "is not an alias instance"); } @@ -246,7 +246,7 @@ void construct(value_and_holder &v_h, std::shared_ptr> &&shd_ptr, boo PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(need_alias); auto *ptr = shd_ptr.get(); no_nullptr(ptr); - if (PYBIND11_SILENCE_MSVC_C4127(Class::has_alias) && need_alias && !is_alias(ptr)) { + if (Class::has_alias && need_alias && !is_alias(ptr)) { throw type_error("pybind11::init(): construction failed: returned std::shared_ptr pointee " "is not an alias instance"); } diff --git a/include/pybind11/stl.h b/include/pybind11/stl.h index 1339a41d5..6e769b12d 100644 --- a/include/pybind11/stl.h +++ b/include/pybind11/stl.h @@ -391,19 +391,15 @@ struct variant_caster> { template bool load_alternative(handle src, bool convert, type_list) { -#if defined(__MINGW32__) -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wmaybe-uninitialized" -#endif + PYBIND11_WARNING_PUSH + PYBIND11_WARNING_DISABLE_GCC("-Wmaybe-uninitialized") auto caster = make_caster(); if (caster.load(src, convert)) { value = cast_op(std::move(caster)); return true; } return load_alternative(src, convert, type_list{}); -#if defined(__MINGW32__) -# pragma GCC diagnostic pop -#endif + PYBIND11_WARNING_POP } bool load_alternative(handle, bool, type_list<>) { return false; }