[libcamera-devel,03/15] libcamera: internal: Convert to pragma once
diff mbox series

Message ID 20211123224015.3619282-4-kieran.bingham@ideasonboard.com
State Accepted
Delegated to: Kieran Bingham
Headers show
Series
  • Use pragma once
Related show

Commit Message

Kieran Bingham Nov. 23, 2021, 10:40 p.m. UTC
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@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(-)

Comments

Laurent Pinchart Nov. 24, 2021, 2:52 a.m. UTC | #1
Hi Kieran,

Thank you for the patch.

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@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.

With this file dropped from the patch,

Reviewed-by: Laurent Pinchart <laurent.pinchart@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]
Kieran Bingham Nov. 24, 2021, 12:01 p.m. UTC | #2
Quoting Laurent Pinchart (2021-11-24 02:52:28)
> Hi Kieran,
> 
> Thank you for the patch.
> 
> 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@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@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.
 */

> 
> >  #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
Laurent Pinchart Nov. 24, 2021, 12:08 p.m. UTC | #3
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@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@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@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]

Patch
diff mbox series

diff --git a/include/libcamera/internal/bayer_format.h b/include/libcamera/internal/bayer_format.h
index 79a25b52582d..cb20bf9bea84 100644
--- a/include/libcamera/internal/bayer_format.h
+++ b/include/libcamera/internal/bayer_format.h
@@ -4,8 +4,8 @@ 
  *
  * bayer_format.h - Bayer Pixel Format
  */
-#ifndef __LIBCAMERA_INTERNAL_BAYER_FORMAT_H__
-#define __LIBCAMERA_INTERNAL_BAYER_FORMAT_H__
+
+#pragma once
 
 #include <stdint.h>
 #include <string>
@@ -69,5 +69,3 @@  static inline bool operator!=(const BayerFormat &lhs, const BayerFormat &rhs)
 }
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_BAYER_FORMAT_H__ */
diff --git a/include/libcamera/internal/byte_stream_buffer.h b/include/libcamera/internal/byte_stream_buffer.h
index d0f0df5ee87b..0f4fce6f4dc0 100644
--- a/include/libcamera/internal/byte_stream_buffer.h
+++ b/include/libcamera/internal/byte_stream_buffer.h
@@ -4,8 +4,8 @@ 
  *
  * byte_stream_buffer.h - Byte stream buffer
  */
-#ifndef __LIBCAMERA_INTERNAL_BYTE_STREAM_BUFFER_H__
-#define __LIBCAMERA_INTERNAL_BYTE_STREAM_BUFFER_H__
+
+#pragma once
 
 #include <stddef.h>
 #include <stdint.h>
@@ -85,5 +85,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_BYTE_STREAM_BUFFER_H__ */
diff --git a/include/libcamera/internal/camera.h b/include/libcamera/internal/camera.h
index 9f5adac12a77..597426a6f9d2 100644
--- a/include/libcamera/internal/camera.h
+++ b/include/libcamera/internal/camera.h
@@ -4,8 +4,8 @@ 
  *
  * camera.h - Camera private data
  */
-#ifndef __LIBCAMERA_INTERNAL_CAMERA_H__
-#define __LIBCAMERA_INTERNAL_CAMERA_H__
+
+#pragma once
 
 #include <atomic>
 #include <list>
@@ -72,5 +72,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_CAMERA_H__ */
diff --git a/include/libcamera/internal/camera_controls.h b/include/libcamera/internal/camera_controls.h
index 6e40f4436cad..ee6d382f8989 100644
--- a/include/libcamera/internal/camera_controls.h
+++ b/include/libcamera/internal/camera_controls.h
@@ -4,8 +4,8 @@ 
  *
  * camera_controls.h - Camera controls
  */
-#ifndef __LIBCAMERA_INTERNAL_CAMERA_CONTROLS_H__
-#define __LIBCAMERA_INTERNAL_CAMERA_CONTROLS_H__
+
+#pragma once
 
 #include "libcamera/internal/control_validator.h"
 
@@ -26,5 +26,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_CAMERA_CONTROLS_H__ */
diff --git a/include/libcamera/internal/camera_sensor.h b/include/libcamera/internal/camera_sensor.h
index d25a1165a06c..2facbf3c8dc0 100644
--- a/include/libcamera/internal/camera_sensor.h
+++ b/include/libcamera/internal/camera_sensor.h
@@ -4,8 +4,8 @@ 
  *
  * camera_sensor.h - A camera sensor
  */
-#ifndef __LIBCAMERA_INTERNAL_CAMERA_SENSOR_H__
-#define __LIBCAMERA_INTERNAL_CAMERA_SENSOR_H__
+
+#pragma once
 
 #include <memory>
 #include <string>
@@ -94,5 +94,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_CAMERA_SENSOR_H__ */
diff --git a/include/libcamera/internal/camera_sensor_properties.h b/include/libcamera/internal/camera_sensor_properties.h
index 67c77920eb38..af381a121bfc 100644
--- a/include/libcamera/internal/camera_sensor_properties.h
+++ b/include/libcamera/internal/camera_sensor_properties.h
@@ -4,8 +4,8 @@ 
  *
  * camera_sensor_properties.h - Database of camera sensor properties
  */
-#ifndef __LIBCAMERA_SENSOR_CAMERA_SENSOR_PROPERTIES_H__
-#define __LIBCAMERA_SENSOR_CAMERA_SENSOR_PROPERTIES_H__
+
+#pragma once
 
 #include <map>
 #include <string>
@@ -22,5 +22,3 @@  struct CameraSensorProperties {
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_SENSOR_CAMERA_SENSOR_PROPERTIES_H__ */
diff --git a/include/libcamera/internal/control_serializer.h b/include/libcamera/internal/control_serializer.h
index caeafa11bc54..99e57feed608 100644
--- a/include/libcamera/internal/control_serializer.h
+++ b/include/libcamera/internal/control_serializer.h
@@ -4,8 +4,8 @@ 
  *
  * control_serializer.h - Control (de)serializer
  */
-#ifndef __LIBCAMERA_INTERNAL_CONTROL_SERIALIZER_H__
-#define __LIBCAMERA_INTERNAL_CONTROL_SERIALIZER_H__
+
+#pragma once
 
 #include <map>
 #include <memory>
@@ -60,5 +60,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_CONTROL_SERIALIZER_H__ */
diff --git a/include/libcamera/internal/control_validator.h b/include/libcamera/internal/control_validator.h
index 206006954cd9..26412d8bac9a 100644
--- a/include/libcamera/internal/control_validator.h
+++ b/include/libcamera/internal/control_validator.h
@@ -4,8 +4,8 @@ 
  *
  * control_validator.h - Control validator
  */
-#ifndef __LIBCAMERA_INTERNAL_CONTROL_VALIDATOR_H__
-#define __LIBCAMERA_INTERNAL_CONTROL_VALIDATOR_H__
+
+#pragma once
 
 #include <string>
 
@@ -23,5 +23,3 @@  public:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_CONTROL_VALIDATOR_H__ */
diff --git a/include/libcamera/internal/delayed_controls.h b/include/libcamera/internal/delayed_controls.h
index 2a6a912bde10..703fdb66bc27 100644
--- a/include/libcamera/internal/delayed_controls.h
+++ b/include/libcamera/internal/delayed_controls.h
@@ -4,8 +4,8 @@ 
  *
  * delayed_controls.h - Helper to deal with controls that take effect with a delay
  */
-#ifndef __LIBCAMERA_INTERNAL_DELAYED_CONTROLS_H__
-#define __LIBCAMERA_INTERNAL_DELAYED_CONTROLS_H__
+
+#pragma once
 
 #include <stdint.h>
 #include <unordered_map>
@@ -82,5 +82,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_DELAYED_CONTROLS_H__ */
diff --git a/include/libcamera/internal/device_enumerator.h b/include/libcamera/internal/device_enumerator.h
index baccfc000d87..72ec9a60b19a 100644
--- a/include/libcamera/internal/device_enumerator.h
+++ b/include/libcamera/internal/device_enumerator.h
@@ -4,8 +4,8 @@ 
  *
  * device_enumerator.h - API to enumerate and find media devices
  */
-#ifndef __LIBCAMERA_INTERNAL_DEVICE_ENUMERATOR_H__
-#define __LIBCAMERA_INTERNAL_DEVICE_ENUMERATOR_H__
+
+#pragma once
 
 #include <memory>
 #include <string>
@@ -55,5 +55,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif	/* __LIBCAMERA_INTERNAL_DEVICE_ENUMERATOR_H__ */
diff --git a/include/libcamera/internal/device_enumerator_sysfs.h b/include/libcamera/internal/device_enumerator_sysfs.h
index 2112bc543054..3e84b83f3200 100644
--- a/include/libcamera/internal/device_enumerator_sysfs.h
+++ b/include/libcamera/internal/device_enumerator_sysfs.h
@@ -4,8 +4,8 @@ 
  *
  * device_enumerator_sysfs.h - sysfs-based device enumerator
  */
-#ifndef __LIBCAMERA_INTERNAL_DEVICE_ENUMERATOR_SYSFS_H__
-#define __LIBCAMERA_INTERNAL_DEVICE_ENUMERATOR_SYSFS_H__
+
+#pragma once
 
 #include <memory>
 #include <string>
@@ -28,5 +28,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_DEVICE_ENUMERATOR_SYSFS_H__ */
diff --git a/include/libcamera/internal/device_enumerator_udev.h b/include/libcamera/internal/device_enumerator_udev.h
index c035298081b4..1b3360df31ba 100644
--- a/include/libcamera/internal/device_enumerator_udev.h
+++ b/include/libcamera/internal/device_enumerator_udev.h
@@ -4,8 +4,8 @@ 
  *
  * device_enumerator_udev.h - udev-based device enumerator
  */
-#ifndef __LIBCAMERA_INTERNAL_DEVICE_ENUMERATOR_UDEV_H__
-#define __LIBCAMERA_INTERNAL_DEVICE_ENUMERATOR_UDEV_H__
+
+#pragma once
 
 #include <list>
 #include <map>
@@ -71,5 +71,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif	/* __LIBCAMERA_INTERNAL_DEVICE_ENUMERATOR_UDEV_H__ */
diff --git a/include/libcamera/internal/formats.h b/include/libcamera/internal/formats.h
index 5ebc68f91cda..ee599765be47 100644
--- a/include/libcamera/internal/formats.h
+++ b/include/libcamera/internal/formats.h
@@ -5,8 +5,7 @@ 
  * formats.h - libcamera image formats
  */
 
-#ifndef __LIBCAMERA_INTERNAL_FORMATS_H__
-#define __LIBCAMERA_INTERNAL_FORMATS_H__
+#pragma once
 
 #include <array>
 #include <map>
@@ -68,5 +67,3 @@  public:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_FORMATS_H__ */
diff --git a/include/libcamera/internal/framebuffer.h b/include/libcamera/internal/framebuffer.h
index cd33c295466e..908b478985e7 100644
--- a/include/libcamera/internal/framebuffer.h
+++ b/include/libcamera/internal/framebuffer.h
@@ -4,8 +4,8 @@ 
  *
  * framebuffer.h - Internal frame buffer handling
  */
-#ifndef __LIBCAMERA_INTERNAL_FRAMEBUFFER_H__
-#define __LIBCAMERA_INTERNAL_FRAMEBUFFER_H__
+
+#pragma once
 
 #include <libcamera/base/class.h>
 
@@ -29,5 +29,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_FRAMEBUFFER_H__ */
diff --git a/include/libcamera/internal/ipa_data_serializer.h b/include/libcamera/internal/ipa_data_serializer.h
index 4353e07b572d..c2f602d5b7de 100644
--- a/include/libcamera/internal/ipa_data_serializer.h
+++ b/include/libcamera/internal/ipa_data_serializer.h
@@ -4,8 +4,8 @@ 
  *
  * ipa_data_serializer.h - Image Processing Algorithm data serializer
  */
-#ifndef __LIBCAMERA_INTERNAL_IPA_DATA_SERIALIZER_H__
-#define __LIBCAMERA_INTERNAL_IPA_DATA_SERIALIZER_H__
+
+#pragma once
 
 #include <deque>
 #include <iostream>
@@ -304,5 +304,3 @@  public:
 #endif /* __DOXYGEN__ */
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_IPA_DATA_SERIALIZER_H__ */
diff --git a/include/libcamera/internal/ipa_manager.h b/include/libcamera/internal/ipa_manager.h
index 0687842e5c06..7f36e58e8bfa 100644
--- a/include/libcamera/internal/ipa_manager.h
+++ b/include/libcamera/internal/ipa_manager.h
@@ -4,8 +4,8 @@ 
  *
  * ipa_manager.h - Image Processing Algorithm module manager
  */
-#ifndef __LIBCAMERA_INTERNAL_IPA_MANAGER_H__
-#define __LIBCAMERA_INTERNAL_IPA_MANAGER_H__
+
+#pragma once
 
 #include <stdint.h>
 #include <vector>
@@ -68,5 +68,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_IPA_MANAGER_H__ */
diff --git a/include/libcamera/internal/ipa_module.h b/include/libcamera/internal/ipa_module.h
index a87f56502b9a..8038bdee6b3c 100644
--- a/include/libcamera/internal/ipa_module.h
+++ b/include/libcamera/internal/ipa_module.h
@@ -4,8 +4,8 @@ 
  *
  * ipa_module.h - Image Processing Algorithm module
  */
-#ifndef __LIBCAMERA_INTERNAL_IPA_MODULE_H__
-#define __LIBCAMERA_INTERNAL_IPA_MODULE_H__
+
+#pragma once
 
 #include <stdint.h>
 #include <string>
@@ -58,5 +58,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_IPA_MODULE_H__ */
diff --git a/include/libcamera/internal/ipa_proxy.h b/include/libcamera/internal/ipa_proxy.h
index ea9f0760c2fc..781c8b623605 100644
--- a/include/libcamera/internal/ipa_proxy.h
+++ b/include/libcamera/internal/ipa_proxy.h
@@ -4,8 +4,8 @@ 
  *
  * ipa_proxy.h - Image Processing Algorithm proxy
  */
-#ifndef __LIBCAMERA_INTERNAL_IPA_PROXY_H__
-#define __LIBCAMERA_INTERNAL_IPA_PROXY_H__
+
+#pragma once
 
 #include <memory>
 #include <string>
@@ -44,5 +44,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_IPA_PROXY_H__ */
diff --git a/include/libcamera/internal/ipc_pipe.h b/include/libcamera/internal/ipc_pipe.h
index 52cc8fa30838..bd8824f255c2 100644
--- a/include/libcamera/internal/ipc_pipe.h
+++ b/include/libcamera/internal/ipc_pipe.h
@@ -4,8 +4,8 @@ 
  *
  * ipc_pipe.h - Image Processing Algorithm IPC module for IPA proxies
  */
-#ifndef __LIBCAMERA_INTERNAL_IPA_IPC_H__
-#define __LIBCAMERA_INTERNAL_IPA_IPC_H__
+
+#pragma once
 
 #include <vector>
 
@@ -67,5 +67,3 @@  protected:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_IPA_IPC_H__ */
diff --git a/include/libcamera/internal/ipc_pipe_unixsocket.h b/include/libcamera/internal/ipc_pipe_unixsocket.h
index ad2927fed7f0..004d953989c6 100644
--- a/include/libcamera/internal/ipc_pipe_unixsocket.h
+++ b/include/libcamera/internal/ipc_pipe_unixsocket.h
@@ -4,8 +4,8 @@ 
  *
  * ipc_pipe_unixsocket.h - Image Processing Algorithm IPC module using unix socket
  */
-#ifndef __LIBCAMERA_INTERNAL_IPA_IPC_UNIXSOCKET_H__
-#define __LIBCAMERA_INTERNAL_IPA_IPC_UNIXSOCKET_H__
+
+#pragma once
 
 #include <map>
 #include <memory>
@@ -45,5 +45,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_IPA_IPC_UNIXSOCKET_H__ */
diff --git a/include/libcamera/internal/ipc_unixsocket.h b/include/libcamera/internal/ipc_unixsocket.h
index 2b87196c4851..5010b66a2bda 100644
--- a/include/libcamera/internal/ipc_unixsocket.h
+++ b/include/libcamera/internal/ipc_unixsocket.h
@@ -5,8 +5,7 @@ 
  * ipc_unixsocket.h - IPC mechanism based on Unix sockets
  */
 
-#ifndef __LIBCAMERA_INTERNAL_IPC_UNIXSOCKET_H__
-#define __LIBCAMERA_INTERNAL_IPC_UNIXSOCKET_H__
+#pragma once
 
 #include <stdint.h>
 #include <sys/types.h>
@@ -57,5 +56,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_IPC_UNIXSOCKET_H__ */
diff --git a/include/libcamera/internal/mapped_framebuffer.h b/include/libcamera/internal/mapped_framebuffer.h
index 70ffbcbea078..fb39adbf5796 100644
--- a/include/libcamera/internal/mapped_framebuffer.h
+++ b/include/libcamera/internal/mapped_framebuffer.h
@@ -4,8 +4,8 @@ 
  *
  * mapped_framebuffer.h - Frame buffer memory mapping support
  */
-#ifndef __LIBCAMERA_INTERNAL_MAPPED_FRAMEBUFFER_H__
-#define __LIBCAMERA_INTERNAL_MAPPED_FRAMEBUFFER_H__
+
+#pragma once
 
 #include <stdint.h>
 #include <vector>
@@ -60,5 +60,3 @@  public:
 LIBCAMERA_FLAGS_ENABLE_OPERATORS(MappedFrameBuffer::MapFlag)
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_MAPPED_FRAMEBUFFER_H__ */
diff --git a/include/libcamera/internal/media_device.h b/include/libcamera/internal/media_device.h
index 1f2304c19281..d636e34a8573 100644
--- a/include/libcamera/internal/media_device.h
+++ b/include/libcamera/internal/media_device.h
@@ -4,8 +4,8 @@ 
  *
  * media_device.h - Media device handler
  */
-#ifndef __LIBCAMERA_INTERNAL_MEDIA_DEVICE_H__
-#define __LIBCAMERA_INTERNAL_MEDIA_DEVICE_H__
+
+#pragma once
 
 #include <map>
 #include <sstream>
@@ -92,5 +92,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_MEDIA_DEVICE_H__ */
diff --git a/include/libcamera/internal/media_object.h b/include/libcamera/internal/media_object.h
index 6ae22c679cc5..90c635983ba7 100644
--- a/include/libcamera/internal/media_object.h
+++ b/include/libcamera/internal/media_object.h
@@ -4,8 +4,8 @@ 
  *
  * media_object.h - Media Device objects: entities, pads and links.
  */
-#ifndef __LIBCAMERA_INTERNAL_MEDIA_OBJECT_H__
-#define __LIBCAMERA_INTERNAL_MEDIA_OBJECT_H__
+
+#pragma once
 
 #include <string>
 #include <vector>
@@ -132,5 +132,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_MEDIA_OBJECT_H__ */
diff --git a/include/libcamera/internal/pipeline_handler.h b/include/libcamera/internal/pipeline_handler.h
index 41cba44d990f..3de27ae93645 100644
--- a/include/libcamera/internal/pipeline_handler.h
+++ b/include/libcamera/internal/pipeline_handler.h
@@ -4,8 +4,8 @@ 
  *
  * pipeline_handler.h - Pipeline handler infrastructure
  */
-#ifndef __LIBCAMERA_INTERNAL_PIPELINE_HANDLER_H__
-#define __LIBCAMERA_INTERNAL_PIPELINE_HANDLER_H__
+
+#pragma once
 
 #include <memory>
 #include <set>
@@ -118,5 +118,3 @@  private:								\
 static handler##Factory global_##handler##Factory;
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_PIPELINE_HANDLER_H__ */
diff --git a/include/libcamera/internal/process.h b/include/libcamera/internal/process.h
index 300e0521eb03..96748a3676e4 100644
--- a/include/libcamera/internal/process.h
+++ b/include/libcamera/internal/process.h
@@ -4,8 +4,8 @@ 
  *
  * process.h - Process object
  */
-#ifndef __LIBCAMERA_INTERNAL_PROCESS_H__
-#define __LIBCAMERA_INTERNAL_PROCESS_H__
+
+#pragma once
 
 #include <signal.h>
 #include <string>
@@ -80,5 +80,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_PROCESS_H__ */
diff --git a/include/libcamera/internal/pub_key.h b/include/libcamera/internal/pub_key.h
index 9261c9c2a0ee..a22ba037cff6 100644
--- a/include/libcamera/internal/pub_key.h
+++ b/include/libcamera/internal/pub_key.h
@@ -4,8 +4,8 @@ 
  *
  * pub_key.h - Public key signature verification
  */
-#ifndef __LIBCAMERA_INTERNAL_PUB_KEY_H__
-#define __LIBCAMERA_INTERNAL_PUB_KEY_H__
+
+#pragma once
 
 #include <stdint.h>
 
@@ -34,5 +34,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_PUB_KEY_H__ */
diff --git a/include/libcamera/internal/source_paths.h b/include/libcamera/internal/source_paths.h
index 111c25b00b43..be6f153b49db 100644
--- a/include/libcamera/internal/source_paths.h
+++ b/include/libcamera/internal/source_paths.h
@@ -4,8 +4,8 @@ 
  *
  * source_paths.h - Identify libcamera source and build paths
  */
-#ifndef __LIBCAMERA_INTERNAL_SOURCE_PATHS_H__
-#define __LIBCAMERA_INTERNAL_SOURCE_PATHS_H__
+
+#pragma once
 
 #include <string>
 
@@ -15,5 +15,3 @@  std::string libcameraBuildPath();
 std::string libcameraSourcePath();
 
 } /* namespace libcamera::utils */
-
-#endif /* __LIBCAMERA_INTERNAL_SOURCE_PATHS_H__ */
diff --git a/include/libcamera/internal/sysfs.h b/include/libcamera/internal/sysfs.h
index bc6c1620b55d..917457bef6e2 100644
--- a/include/libcamera/internal/sysfs.h
+++ b/include/libcamera/internal/sysfs.h
@@ -4,8 +4,8 @@ 
  *
  * sysfs.h - Miscellaneous utility functions to access sysfs
  */
-#ifndef __LIBCAMERA_INTERNAL_SYSFS_H__
-#define __LIBCAMERA_INTERNAL_SYSFS_H__
+
+#pragma once
 
 #include <string>
 
@@ -20,5 +20,3 @@  std::string firmwareNodePath(const std::string &device);
 } /* namespace sysfs */
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_SYSFS_H__ */
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
 
 #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
 
diff --git a/include/libcamera/internal/v4l2_device.h b/include/libcamera/internal/v4l2_device.h
index f21bc3701ca0..7816a290141d 100644
--- a/include/libcamera/internal/v4l2_device.h
+++ b/include/libcamera/internal/v4l2_device.h
@@ -4,8 +4,8 @@ 
  *
  * v4l2_device.h - Common base for V4L2 video devices and subdevices
  */
-#ifndef __LIBCAMERA_INTERNAL_V4L2_DEVICE_H__
-#define __LIBCAMERA_INTERNAL_V4L2_DEVICE_H__
+
+#pragma once
 
 #include <map>
 #include <memory>
@@ -79,5 +79,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_V4L2_DEVICE_H__ */
diff --git a/include/libcamera/internal/v4l2_pixelformat.h b/include/libcamera/internal/v4l2_pixelformat.h
index e3cda6997c32..886d534d8c91 100644
--- a/include/libcamera/internal/v4l2_pixelformat.h
+++ b/include/libcamera/internal/v4l2_pixelformat.h
@@ -5,8 +5,8 @@ 
  *
  * v4l2_pixelformat.h - V4L2 Pixel Format
  */
-#ifndef __LIBCAMERA_INTERNAL_V4L2_PIXELFORMAT_H__
-#define __LIBCAMERA_INTERNAL_V4L2_PIXELFORMAT_H__
+
+#pragma once
 
 #include <stdint.h>
 #include <string>
@@ -51,5 +51,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_V4L2_PIXELFORMAT_H__ */
diff --git a/include/libcamera/internal/v4l2_subdevice.h b/include/libcamera/internal/v4l2_subdevice.h
index 97b89fb95087..484fcfdda9b1 100644
--- a/include/libcamera/internal/v4l2_subdevice.h
+++ b/include/libcamera/internal/v4l2_subdevice.h
@@ -4,8 +4,8 @@ 
  *
  * v4l2_subdevice.h - V4L2 Subdevice
  */
-#ifndef __LIBCAMERA_INTERNAL_V4L2_SUBDEVICE_H__
-#define __LIBCAMERA_INTERNAL_V4L2_SUBDEVICE_H__
+
+#pragma once
 
 #include <memory>
 #include <string>
@@ -78,5 +78,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_V4L2_SUBDEVICE_H__ */
diff --git a/include/libcamera/internal/v4l2_videodevice.h b/include/libcamera/internal/v4l2_videodevice.h
index a1c458e45088..4a44b7fd53b1 100644
--- a/include/libcamera/internal/v4l2_videodevice.h
+++ b/include/libcamera/internal/v4l2_videodevice.h
@@ -4,8 +4,8 @@ 
  *
  * v4l2_videodevice.h - V4L2 Video Device
  */
-#ifndef __LIBCAMERA_INTERNAL_V4L2_VIDEODEVICE_H__
-#define __LIBCAMERA_INTERNAL_V4L2_VIDEODEVICE_H__
+
+#pragma once
 
 #include <array>
 #include <atomic>
@@ -278,5 +278,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_INTERNAL_V4L2_VIDEODEVICE_H__ */