From patchwork Mon Jun 24 19:29:35 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 20371 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 262E4BD87C for ; Mon, 24 Jun 2024 19:30:17 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id BA0D8654A3; Mon, 24 Jun 2024 21:30:16 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="ehWqtyUI"; dkim-atps=neutral Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B7EC4654B1 for ; Mon, 24 Jun 2024 21:30:09 +0200 (CEST) Received: from pendragon.ideasonboard.com (81-175-209-231.bb.dnainternet.fi [81.175.209.231]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 8A6BE191B; Mon, 24 Jun 2024 21:29:47 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1719257387; bh=0l+odjtUOc5OsKWhoawlrDZnwD+4VcttMUEBoWWUYQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ehWqtyUIvt5Zv7TqDyRrLDGSAF8qQiRUD872I/HZIUeNNXcCHGcJi/o6L+qOkpPfF yMIRX9KrRgKAj1Il0GqBV2+/8vz+HEKvNDt31f3UK6Ykeju10BYuYWBfK/0UtwgdOj /a5rb+kcmMWj+nVnPCWEE0ZKYDSzlZ+adzPkgRlg= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Cc: =?utf-8?q?Barnab=C3=A1s_P=C5=91cze?= Subject: [PATCH 04/10] py: libcamera: Move function declarations to common header Date: Mon, 24 Jun 2024 22:29:35 +0300 Message-ID: <20240624192941.22943-5-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.44.2 In-Reply-To: <20240624192941.22943-1-laurent.pinchart@ideasonboard.com> References: <20240624192941.22943-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" 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 5201121a79ca..fd5a5dabe597 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 8d282ce51856..26d5a104f209 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 e25689c674ef..ca6aeb868cbe 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 a3f7f94d525d..c5fb9063992c 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 5c2aeac483db..c7e303609427 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 bce082186a8b..ab33f38a8fb7 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 5bb5f2d1b303..4d594326e212 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 e3802b81a075..d28f1ab8b61a 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 f3a0bfaf4fc5..768260ffccf0 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;