[libcamera-devel] [PATCH 03/15] libcamera: internal: Convert to pragma once
Laurent Pinchart
laurent.pinchart at ideasonboard.com
Wed Nov 24 13:08:04 CET 2021
Hi Kieran,
On Wed, Nov 24, 2021 at 12:01:49PM +0000, Kieran Bingham wrote:
> Quoting Laurent Pinchart (2021-11-24 02:52:28)
> > On Tue, Nov 23, 2021 at 10:40:03PM +0000, Kieran Bingham wrote:
> > > Remove the verbose #ifndef/#define/#endif pattern for maintaining
> > > header idempotency, and replace it with a simple #pragma once.
> > >
> > > This simplifies the headers, and prevents redundant changes when
> > > header files get moved.
> > >
> > > Signed-off-by: Kieran Bingham <kieran.bingham at ideasonboard.com>
> > > ---
> > > include/libcamera/internal/bayer_format.h | 6 ++----
> > > include/libcamera/internal/byte_stream_buffer.h | 6 ++----
> > > include/libcamera/internal/camera.h | 6 ++----
> > > include/libcamera/internal/camera_controls.h | 6 ++----
> > > include/libcamera/internal/camera_sensor.h | 6 ++----
> > > include/libcamera/internal/camera_sensor_properties.h | 6 ++----
> > > include/libcamera/internal/control_serializer.h | 6 ++----
> > > include/libcamera/internal/control_validator.h | 6 ++----
> > > include/libcamera/internal/delayed_controls.h | 6 ++----
> > > include/libcamera/internal/device_enumerator.h | 6 ++----
> > > include/libcamera/internal/device_enumerator_sysfs.h | 6 ++----
> > > include/libcamera/internal/device_enumerator_udev.h | 6 ++----
> > > include/libcamera/internal/formats.h | 5 +----
> > > include/libcamera/internal/framebuffer.h | 6 ++----
> > > include/libcamera/internal/ipa_data_serializer.h | 6 ++----
> > > include/libcamera/internal/ipa_manager.h | 6 ++----
> > > include/libcamera/internal/ipa_module.h | 6 ++----
> > > include/libcamera/internal/ipa_proxy.h | 6 ++----
> > > include/libcamera/internal/ipc_pipe.h | 6 ++----
> > > include/libcamera/internal/ipc_pipe_unixsocket.h | 6 ++----
> > > include/libcamera/internal/ipc_unixsocket.h | 5 +----
> > > include/libcamera/internal/mapped_framebuffer.h | 6 ++----
> > > include/libcamera/internal/media_device.h | 6 ++----
> > > include/libcamera/internal/media_object.h | 6 ++----
> > > include/libcamera/internal/pipeline_handler.h | 6 ++----
> > > include/libcamera/internal/process.h | 6 ++----
> > > include/libcamera/internal/pub_key.h | 6 ++----
> > > include/libcamera/internal/source_paths.h | 6 ++----
> > > include/libcamera/internal/sysfs.h | 6 ++----
> > > include/libcamera/internal/tracepoints.h.in | 6 ++----
> > > include/libcamera/internal/v4l2_device.h | 6 ++----
> > > include/libcamera/internal/v4l2_pixelformat.h | 6 ++----
> > > include/libcamera/internal/v4l2_subdevice.h | 6 ++----
> > > include/libcamera/internal/v4l2_videodevice.h | 6 ++----
> > > 34 files changed, 66 insertions(+), 136 deletions(-)
> >
> > [snip]
> >
> > > diff --git a/include/libcamera/internal/tracepoints.h.in b/include/libcamera/internal/tracepoints.h.in
> > > index d0fc136598b6..b093bc6b5eda 100644
> > > --- a/include/libcamera/internal/tracepoints.h.in
> > > +++ b/include/libcamera/internal/tracepoints.h.in
> > > @@ -6,8 +6,8 @@
> > > *
> > > * This file is auto-generated. Do not edit.
> > > */
> > > -#ifndef __LIBCAMERA_INTERNAL_TRACEPOINTS_H__
> > > -#define __LIBCAMERA_INTERNAL_TRACEPOINTS_H__
> > > +
> > > +#pragma once
> >
> > This header is special and needs to include itself through macro magic,
> > so we can't use #pragma once here.
>
> Indeed. This even looked suspicious when I was going through it and I
> intended this file to be in a single commit of its own, but then it got
> incorrectly batched in to internal...
>
> Ho hum.
>
> Will drop this change, the ifndef is still suitable for this one.
>
> >
> > With this file dropped from the patch,
> >
> > Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
>
> Thanks.
>
>
> Or - how would you feel about adding the following in a separate patch:
>
> /*
> * This file includes itself to support tracepoint construction.
> * pragma once can not be used here.
> */
I even considered proposing it, so
Reviewed-by: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
> > > #if HAVE_TRACING
> > > #define LIBCAMERA_TRACEPOINT(...) tracepoint(libcamera, __VA_ARGS__)
> > > @@ -36,8 +36,6 @@ inline void unused([[maybe_unused]] Args&& ...args)
> > >
> > > #endif /* HAVE_TRACING */
> > >
> > > -#endif /* __LIBCAMERA_INTERNAL_TRACEPOINTS_H__ */
> > > -
> > >
> > > #if HAVE_TRACING
> >
> > [snip]
--
Regards,
Laurent Pinchart
More information about the libcamera-devel
mailing list