Skip to content

Commit 13eb5ea

Browse files
committed
Changes related to PR pybind#4285 (new style of warning suppression based on push/pop)
1 parent 8f54f4f commit 13eb5ea

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

include/pybind11/detail/init.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,7 @@ void construct(value_and_holder &v_h, std::unique_ptr<Cpp<Class>, D> &&unq_ptr,
209209
PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(need_alias);
210210
auto *ptr = unq_ptr.get();
211211
no_nullptr(ptr);
212-
if (PYBIND11_SILENCE_MSVC_C4127(Class::has_alias) && need_alias && !is_alias<Class>(ptr)) {
212+
if (Class::has_alias && need_alias && !is_alias<Class>(ptr)) {
213213
throw type_error("pybind11::init(): construction failed: returned std::unique_ptr pointee "
214214
"is not an alias instance");
215215
}
@@ -246,7 +246,7 @@ void construct(value_and_holder &v_h, std::shared_ptr<Cpp<Class>> &&shd_ptr, boo
246246
PYBIND11_WORKAROUND_INCORRECT_MSVC_C4100(need_alias);
247247
auto *ptr = shd_ptr.get();
248248
no_nullptr(ptr);
249-
if (PYBIND11_SILENCE_MSVC_C4127(Class::has_alias) && need_alias && !is_alias<Class>(ptr)) {
249+
if (Class::has_alias && need_alias && !is_alias<Class>(ptr)) {
250250
throw type_error("pybind11::init(): construction failed: returned std::shared_ptr pointee "
251251
"is not an alias instance");
252252
}

include/pybind11/stl.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -391,19 +391,15 @@ struct variant_caster<V<Ts...>> {
391391

392392
template <typename U, typename... Us>
393393
bool load_alternative(handle src, bool convert, type_list<U, Us...>) {
394-
#if defined(__MINGW32__)
395-
# pragma GCC diagnostic push
396-
# pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
397-
#endif
394+
PYBIND11_WARNING_PUSH
395+
PYBIND11_WARNING_DISABLE_GCC("-Wmaybe-uninitialized")
398396
auto caster = make_caster<U>();
399397
if (caster.load(src, convert)) {
400398
value = cast_op<U>(std::move(caster));
401399
return true;
402400
}
403401
return load_alternative(src, convert, type_list<Us...>{});
404-
#if defined(__MINGW32__)
405-
# pragma GCC diagnostic pop
406-
#endif
402+
PYBIND11_WARNING_POP
407403
}
408404

409405
bool load_alternative(handle, bool, type_list<>) { return false; }

0 commit comments

Comments
 (0)