Add -DPYBIND11_WERROR=ON to mingw cmake commands (#4073)

* Add `-DPYBIND11_WERROR=ON` to mingw cmake commands (and `-DCMAKE_VERBOSE_MAKEFILE:BOOL=ON`).

* Using no-destructor idiom to side-step overzealous MINGW warning.

* Add __MINGW32__ pragma GCC diagnostic ignored in eigen.h

* Add another no-destructor workaround.

* Temporarily add -k (keep-going) flags to hopefully speed up finding all warnings.

* Revert "Temporarily add -k (keep-going) flags to hopefully speed up finding all warnings."

This reverts commit f36b0af8f9.

* Very minor shuffle to avoid MSVC warnings.

* Remove all `:BOOL` as suggested by @henryiii
This commit is contained in:
Ralf W. Grosse-Kunstleve
2022-08-01 06:18:48 -07:00
committed by GitHub
parent 1e3400b674
commit 3665530264
4 changed files with 23 additions and 7 deletions

View File

@@ -266,9 +266,14 @@ TEST_SUBMODULE(builtin_casters, m) {
});
m.def("lvalue_nested", []() -> const decltype(lvnested) & { return lvnested; });
static std::pair<int, std::string> int_string_pair{2, "items"};
m.def(
"int_string_pair", []() { return &int_string_pair; }, py::return_value_policy::reference);
"int_string_pair",
[]() {
// Using no-destructor idiom to side-step warnings from overzealous compilers.
static auto *int_string_pair = new std::pair<int, std::string>{2, "items"};
return int_string_pair;
},
py::return_value_policy::reference);
// test_builtins_cast_return_none
m.def("return_none_string", []() -> std::string * { return nullptr; });