[01/10] libcamera: base: log: Declare log categories when defining them
diff mbox series

Message ID 20240624192941.22943-2-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
libcamera will enable -Wmissing-declarations to catch mismatches between
function declarations and definitions. There is one offender in log.h:
when a category is defined with LOG_DEFINE_CATEGORY(), it generates a
function with no declaration. Fix it by declaring the function using
LOG_DECLARE_CATEGORY() as the first step fo the category definition.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
---
 include/libcamera/base/log.h | 1 +
 1 file changed, 1 insertion(+)

Comments

Kieran Bingham June 24, 2024, 8:14 p.m. UTC | #1
Quoting Laurent Pinchart (2024-06-24 20:29:32)
> libcamera will enable -Wmissing-declarations to catch mismatches between
> function declarations and definitions. There is one offender in log.h:
> when a category is defined with LOG_DEFINE_CATEGORY(), it generates a
> function with no declaration. Fix it by declaring the function using
> LOG_DECLARE_CATEGORY() as the first step fo the category definition.

s/fo/of/
or
s/fo/for/


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

> 
> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> ---
>  include/libcamera/base/log.h | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/include/libcamera/base/log.h b/include/libcamera/base/log.h
> index b5775e491fee..df27df034d79 100644
> --- a/include/libcamera/base/log.h
> +++ b/include/libcamera/base/log.h
> @@ -48,6 +48,7 @@ private:
>  extern const LogCategory &_LOG_CATEGORY(name)();
>  
>  #define LOG_DEFINE_CATEGORY(name)                                      \
> +LOG_DECLARE_CATEGORY(name)                                             \
>  const LogCategory &_LOG_CATEGORY(name)()                               \
>  {                                                                      \
>         /* The instance will be deleted by the Logger destructor. */    \
> -- 
> Regards,
> 
> Laurent Pinchart
>

Patch
diff mbox series

diff --git a/include/libcamera/base/log.h b/include/libcamera/base/log.h
index b5775e491fee..df27df034d79 100644
--- a/include/libcamera/base/log.h
+++ b/include/libcamera/base/log.h
@@ -48,6 +48,7 @@  private:
 extern const LogCategory &_LOG_CATEGORY(name)();
 
 #define LOG_DEFINE_CATEGORY(name)					\
+LOG_DECLARE_CATEGORY(name)						\
 const LogCategory &_LOG_CATEGORY(name)()				\
 {									\
 	/* The instance will be deleted by the Logger destructor. */	\