From a2e27f4f2b849f0095a822be686b9612e727a122 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Mon, 24 Jun 2024 16:26:57 +0300 Subject: py: libcamera: Move function declarations to common header The init_py_*() functions are called by the top-level entry point of the libcamera Python module to initialize different parts of the bindings. They are declared in py_main.cpp where they are called, and defined in separate compilation units. This results in functions being defined without a corresponding declaration, and will generate warnings when we enable -Wmissing-declarations. Fix this by moving the function declarations from py_main.c to py_main.h, and including py_main.h in the various compilation units that need it. Signed-off-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- src/py/libcamera/py_color_space.cpp | 2 ++ src/py/libcamera/py_controls_generated.cpp.in | 2 ++ src/py/libcamera/py_enums.cpp | 2 ++ src/py/libcamera/py_formats_generated.cpp.in | 2 ++ src/py/libcamera/py_geometry.cpp | 2 ++ src/py/libcamera/py_main.cpp | 8 -------- src/py/libcamera/py_main.h | 10 ++++++++++ src/py/libcamera/py_properties_generated.cpp.in | 2 ++ src/py/libcamera/py_transform.cpp | 2 ++ 9 files changed, 24 insertions(+), 8 deletions(-) diff --git a/src/py/libcamera/py_color_space.cpp b/src/py/libcamera/py_color_space.cpp index 5201121a..fd5a5dab 100644 --- a/src/py/libcamera/py_color_space.cpp +++ b/src/py/libcamera/py_color_space.cpp @@ -12,6 +12,8 @@ #include #include +#include "py_main.h" + namespace py = pybind11; using namespace libcamera; diff --git a/src/py/libcamera/py_controls_generated.cpp.in b/src/py/libcamera/py_controls_generated.cpp.in index 8d282ce5..26d5a104 100644 --- a/src/py/libcamera/py_controls_generated.cpp.in +++ b/src/py/libcamera/py_controls_generated.cpp.in @@ -11,6 +11,8 @@ #include +#include "py_main.h" + namespace py = pybind11; class PyControls diff --git a/src/py/libcamera/py_enums.cpp b/src/py/libcamera/py_enums.cpp index e25689c6..ca6aeb86 100644 --- a/src/py/libcamera/py_enums.cpp +++ b/src/py/libcamera/py_enums.cpp @@ -9,6 +9,8 @@ #include +#include "py_main.h" + namespace py = pybind11; using namespace libcamera; diff --git a/src/py/libcamera/py_formats_generated.cpp.in b/src/py/libcamera/py_formats_generated.cpp.in index a3f7f94d..c5fb9063 100644 --- a/src/py/libcamera/py_formats_generated.cpp.in +++ b/src/py/libcamera/py_formats_generated.cpp.in @@ -11,6 +11,8 @@ #include +#include "py_main.h" + namespace py = pybind11; class PyFormats diff --git a/src/py/libcamera/py_geometry.cpp b/src/py/libcamera/py_geometry.cpp index 5c2aeac4..c7e30360 100644 --- a/src/py/libcamera/py_geometry.cpp +++ b/src/py/libcamera/py_geometry.cpp @@ -14,6 +14,8 @@ #include #include +#include "py_main.h" + namespace py = pybind11; using namespace libcamera; diff --git a/src/py/libcamera/py_main.cpp b/src/py/libcamera/py_main.cpp index bce08218..ab33f38a 100644 --- a/src/py/libcamera/py_main.cpp +++ b/src/py/libcamera/py_main.cpp @@ -85,14 +85,6 @@ PYBIND11_DECLARE_HOLDER_TYPE(T, PyCameraSmartPtr) */ static std::weak_ptr gCameraManager; -void init_py_color_space(py::module &m); -void init_py_controls_generated(py::module &m); -void init_py_enums(py::module &m); -void init_py_formats_generated(py::module &m); -void init_py_geometry(py::module &m); -void init_py_properties_generated(py::module &m); -void init_py_transform(py::module &m); - PYBIND11_MODULE(_libcamera, m) { init_py_enums(m); diff --git a/src/py/libcamera/py_main.h b/src/py/libcamera/py_main.h index 5bb5f2d1..4d594326 100644 --- a/src/py/libcamera/py_main.h +++ b/src/py/libcamera/py_main.h @@ -7,8 +7,18 @@ #include +#include + namespace libcamera { LOG_DECLARE_CATEGORY(Python) } + +void init_py_color_space(pybind11::module &m); +void init_py_controls_generated(pybind11::module &m); +void init_py_enums(pybind11::module &m); +void init_py_formats_generated(pybind11::module &m); +void init_py_geometry(pybind11::module &m); +void init_py_properties_generated(pybind11::module &m); +void init_py_transform(pybind11::module &m); diff --git a/src/py/libcamera/py_properties_generated.cpp.in b/src/py/libcamera/py_properties_generated.cpp.in index e3802b81..d28f1ab8 100644 --- a/src/py/libcamera/py_properties_generated.cpp.in +++ b/src/py/libcamera/py_properties_generated.cpp.in @@ -11,6 +11,8 @@ #include +#include "py_main.h" + namespace py = pybind11; class PyProperties diff --git a/src/py/libcamera/py_transform.cpp b/src/py/libcamera/py_transform.cpp index f3a0bfaf..768260ff 100644 --- a/src/py/libcamera/py_transform.cpp +++ b/src/py/libcamera/py_transform.cpp @@ -12,6 +12,8 @@ #include #include +#include "py_main.h" + namespace py = pybind11; using namespace libcamera; -- cgit v1.2.1