mirror of
https://github.com/pybind/pybind11.git
synced 2024-11-21 20:55:11 +00:00
Add warn disable for GGC 12 bound checking error (#5355)
Issue: #5224 The `internals.registered_types_py...` line in pybind11.h triggers a false-positive bounds checking warning in GCC 12. This is discussed in https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115824. The workaround implemented is taken from suggestions then refactored to use the `PYBIND11_WARNING_PUSH` and `PYBIND11_WARNING_POP` MACROS.
This commit is contained in:
parent
0cf3a0f7b5
commit
a7910be630
@ -1382,7 +1382,17 @@ protected:
|
|||||||
} else {
|
} else {
|
||||||
internals.registered_types_cpp[tindex] = tinfo;
|
internals.registered_types_cpp[tindex] = tinfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PYBIND11_WARNING_PUSH
|
||||||
|
#if defined(__GNUC__) && __GNUC__ == 12
|
||||||
|
// When using GCC 12 these warnings are disabled as they trigger
|
||||||
|
// false positive warnings. Discussed here:
|
||||||
|
// https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115824.
|
||||||
|
PYBIND11_WARNING_DISABLE_GCC("-Warray-bounds")
|
||||||
|
PYBIND11_WARNING_DISABLE_GCC("-Wstringop-overread")
|
||||||
|
#endif
|
||||||
internals.registered_types_py[(PyTypeObject *) m_ptr] = {tinfo};
|
internals.registered_types_py[(PyTypeObject *) m_ptr] = {tinfo};
|
||||||
|
PYBIND11_WARNING_POP
|
||||||
});
|
});
|
||||||
|
|
||||||
if (rec.bases.size() > 1 || rec.multiple_inheritance) {
|
if (rec.bases.size() > 1 || rec.multiple_inheritance) {
|
||||||
|
Loading…
Reference in New Issue
Block a user