[02/10] ipa: ipa_interface: Declare ipaCreate() in libcamera namespace
diff mbox series

Message ID 20240624192941.22943-3-laurent.pinchart@ideasonboard.com
State Accepted
Headers show
Series
  • libcamera: Enable -Wmissing-declarations
Related show

Commit Message

Laurent Pinchart June 24, 2024, 7:29 p.m. UTC
The ipaCreate() function is the entry point to IPA modules. It is
declared in ipa_interface.h, and defined by each module. As the function
is defined with extern "C" linkage, the namespace in which it is
contained is not very relevant from a caller's point of view. For the
IPA module implementer, however, defining the function in the libcamera
namespace avoids adding an explicit libcamera:: prefix to the symbols
used by the function. This is why all IPA modules define their
ipaCreate() entry point in the libcamera namespace.

The ipa_interface.h file, however, declares the function in the global
namespace. This doesn't cause any issue at runtime, but will cause a
missing declaration warning when we enable them. To prepare for that,
move the function declaration to the libcamera namespace.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 include/libcamera/ipa/ipa_interface.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Kieran Bingham June 24, 2024, 8:16 p.m. UTC | #1
Quoting Laurent Pinchart (2024-06-24 20:29:33)
> The ipaCreate() function is the entry point to IPA modules. It is
> declared in ipa_interface.h, and defined by each module. As the function
> is defined with extern "C" linkage, the namespace in which it is
> contained is not very relevant from a caller's point of view. For the
> IPA module implementer, however, defining the function in the libcamera
> namespace avoids adding an explicit libcamera:: prefix to the symbols
> used by the function. This is why all IPA modules define their
> ipaCreate() entry point in the libcamera namespace.
> 
> The ipa_interface.h file, however, declares the function in the global
> namespace. This doesn't cause any issue at runtime, but will cause a
> missing declaration warning when we enable them. To prepare for that,
> move the function declaration to the libcamera namespace.
> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  include/libcamera/ipa/ipa_interface.h | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/libcamera/ipa/ipa_interface.h b/include/libcamera/ipa/ipa_interface.h
> index b93f1a15b2c9..53cf5377fcc6 100644
> --- a/include/libcamera/ipa/ipa_interface.h
> +++ b/include/libcamera/ipa/ipa_interface.h
> @@ -33,8 +33,8 @@ public:
>         virtual ~IPAInterface() = default;
>  };
>  
> -} /* namespace libcamera */
> -
>  extern "C" {
>  libcamera::IPAInterface *ipaCreate();
>  }

So ... as long as it's fine to have extern "C" in a C++ namespace ...


Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>

> +
> +} /* namespace libcamera */
> -- 
> Regards,
> 
> Laurent Pinchart
>

Patch
diff mbox series

diff --git a/include/libcamera/ipa/ipa_interface.h b/include/libcamera/ipa/ipa_interface.h
index b93f1a15b2c9..53cf5377fcc6 100644
--- a/include/libcamera/ipa/ipa_interface.h
+++ b/include/libcamera/ipa/ipa_interface.h
@@ -33,8 +33,8 @@  public:
 	virtual ~IPAInterface() = default;
 };
 
-} /* namespace libcamera */
-
 extern "C" {
 libcamera::IPAInterface *ipaCreate();
 }
+
+} /* namespace libcamera */