From ff9003d10ca9a8302795d809f8be0b43f7f90ded Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 3 Sep 2019 12:01:38 +0200 Subject: [PATCH] python: silence annoying GCC 4.8 warnings. --- src/python/corrade/PyBuffer.h | 5 +++-- src/python/corrade/containers.cpp | 6 ++++-- src/python/magnum/math.matrix.h | 3 ++- src/python/magnum/math.vector.h | 3 ++- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/src/python/corrade/PyBuffer.h b/src/python/corrade/PyBuffer.h index 0a7dbe8..b04a162 100644 --- a/src/python/corrade/PyBuffer.h +++ b/src/python/corrade/PyBuffer.h @@ -50,8 +50,9 @@ template void enableBetterB CORRADE_INTERNAL_ASSERT(!PyErr_Occurred() && buffer); /* Zero-initialize the output and ask the class to fill it. If that - fails for some reason, give up */ - *buffer = Py_buffer{}; + fails for some reason, give up. Need to list all members otherwise + GCC 4.8 loudly complains about missing initializers. */ + *buffer = Py_buffer{nullptr, nullptr, 0, 0, 0, 0, nullptr, nullptr, nullptr, nullptr, nullptr}; if(!getter(pyInstanceFromHandle(obj), *buffer, flags)) { CORRADE_INTERNAL_ASSERT(!buffer->obj); CORRADE_INTERNAL_ASSERT(PyErr_Occurred()); diff --git a/src/python/corrade/containers.cpp b/src/python/corrade/containers.cpp index 572c67a..26cf39e 100644 --- a/src/python/corrade/containers.cpp +++ b/src/python/corrade/containers.cpp @@ -109,7 +109,8 @@ template void arrayView(py::class_, Containers /* Buffer protocol */ .def(py::init([](py::buffer other) { - Py_buffer buffer{}; + /* GCC 4.8 otherwise loudly complains about missing initializers */ + Py_buffer buffer{nullptr, nullptr, 0, 0, 0, 0, nullptr, nullptr, nullptr, nullptr, nullptr}; if(PyObject_GetBuffer(other.ptr(), &buffer, (std::is_const::value ? 0 : PyBUF_WRITABLE)) != 0) throw py::error_already_set{}; @@ -312,7 +313,8 @@ template void stridedArrayView(py::class_::value ? 0 : PyBUF_WRITABLE)) != 0) throw py::error_already_set{}; diff --git a/src/python/magnum/math.matrix.h b/src/python/magnum/math.matrix.h index 49fae55..a6a4d37 100644 --- a/src/python/magnum/math.matrix.h +++ b/src/python/magnum/math.matrix.h @@ -107,7 +107,8 @@ template void everyRectangularMatrixBuffer(py::class_ void everyVectorBuffer(py::class_& arrays of non-default types somehow doesn't work. There's also the other part in vectorBuffer(). */ .def(py::init([](py::buffer other) { - Py_buffer buffer{}; + /* GCC 4.8 otherwise loudly complains about missing initializers */ + Py_buffer buffer{nullptr, nullptr, 0, 0, 0, 0, nullptr, nullptr, nullptr, nullptr, nullptr}; if(PyObject_GetBuffer(other.ptr(), &buffer, PyBUF_FORMAT|PyBUF_STRIDES) != 0) throw py::error_already_set{};