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

Message ID 20211123224015.3619282-3-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/base/backtrace.h             | 6 ++----
 include/libcamera/base/bound_method.h          | 6 ++----
 include/libcamera/base/class.h                 | 6 ++----
 include/libcamera/base/event_dispatcher.h      | 6 ++----
 include/libcamera/base/event_dispatcher_poll.h | 6 ++----
 include/libcamera/base/event_notifier.h        | 6 ++----
 include/libcamera/base/file.h                  | 6 ++----
 include/libcamera/base/flags.h                 | 6 ++----
 include/libcamera/base/log.h                   | 6 ++----
 include/libcamera/base/message.h               | 6 ++----
 include/libcamera/base/object.h                | 6 ++----
 include/libcamera/base/semaphore.h             | 6 ++----
 include/libcamera/base/signal.h                | 6 ++----
 include/libcamera/base/span.h                  | 5 +----
 include/libcamera/base/thread.h                | 6 ++----
 include/libcamera/base/timer.h                 | 6 ++----
 include/libcamera/base/utils.h                 | 6 ++----
 17 files changed, 33 insertions(+), 68 deletions(-)

Patch
diff mbox series

diff --git a/include/libcamera/base/backtrace.h b/include/libcamera/base/backtrace.h
index bb77c73b67e3..752034d140e8 100644
--- a/include/libcamera/base/backtrace.h
+++ b/include/libcamera/base/backtrace.h
@@ -4,8 +4,8 @@ 
  *
  * backtrace.h - Call stack backtraces
  */
-#ifndef __LIBCAMERA_BASE_BACKTRACE_H__
-#define __LIBCAMERA_BASE_BACKTRACE_H__
+
+#pragma once
 
 #include <string>
 #include <vector>
@@ -34,5 +34,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_BASE_BACKTRACE_H__ */
diff --git a/include/libcamera/base/bound_method.h b/include/libcamera/base/bound_method.h
index ebd297ab8209..e73a4d98ddae 100644
--- a/include/libcamera/base/bound_method.h
+++ b/include/libcamera/base/bound_method.h
@@ -4,8 +4,8 @@ 
  *
  * bound_method.h - Method bind and invocation
  */
-#ifndef __LIBCAMERA_BASE_BOUND_METHOD_H__
-#define __LIBCAMERA_BASE_BOUND_METHOD_H__
+
+#pragma once
 
 #include <memory>
 #include <tuple>
@@ -222,5 +222,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_BASE_BOUND_METHOD_H__ */
diff --git a/include/libcamera/base/class.h b/include/libcamera/base/class.h
index 09806cd723c0..571eecf4da50 100644
--- a/include/libcamera/base/class.h
+++ b/include/libcamera/base/class.h
@@ -4,8 +4,8 @@ 
  *
  * class.h - Utilities and helpers for classes
  */
-#ifndef __LIBCAMERA_BASE_CLASS_H__
-#define __LIBCAMERA_BASE_CLASS_H__
+
+#pragma once
 
 #include <memory>
 
@@ -107,5 +107,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_BASE_CLASS_H__ */
diff --git a/include/libcamera/base/event_dispatcher.h b/include/libcamera/base/event_dispatcher.h
index 825af7a33919..184f1b12c966 100644
--- a/include/libcamera/base/event_dispatcher.h
+++ b/include/libcamera/base/event_dispatcher.h
@@ -4,8 +4,8 @@ 
  *
  * event_dispatcher.h - Event dispatcher
  */
-#ifndef __LIBCAMERA_BASE_EVENT_DISPATCHER_H__
-#define __LIBCAMERA_BASE_EVENT_DISPATCHER_H__
+
+#pragma once
 
 #include <vector>
 
@@ -33,5 +33,3 @@  public:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_BASE_EVENT_DISPATCHER_H__ */
diff --git a/include/libcamera/base/event_dispatcher_poll.h b/include/libcamera/base/event_dispatcher_poll.h
index 683934bfc7f7..3d2fc7bbc4c3 100644
--- a/include/libcamera/base/event_dispatcher_poll.h
+++ b/include/libcamera/base/event_dispatcher_poll.h
@@ -4,8 +4,8 @@ 
  *
  * event_dispatcher_poll.h - Poll-based event dispatcher
  */
-#ifndef __LIBCAMERA_BASE_EVENT_DISPATCHER_POLL_H__
-#define __LIBCAMERA_BASE_EVENT_DISPATCHER_POLL_H__
+
+#pragma once
 
 #include <list>
 #include <map>
@@ -56,5 +56,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_BASE_EVENT_DISPATCHER_POLL_H__ */
diff --git a/include/libcamera/base/event_notifier.h b/include/libcamera/base/event_notifier.h
index f7722a32ef55..e5c0594d3ebd 100644
--- a/include/libcamera/base/event_notifier.h
+++ b/include/libcamera/base/event_notifier.h
@@ -4,8 +4,8 @@ 
  *
  * event_notifier.h - File descriptor event notifier
  */
-#ifndef __LIBCAMERA_BASE_EVENT_NOTIFIER_H__
-#define __LIBCAMERA_BASE_EVENT_NOTIFIER_H__
+
+#pragma once
 
 #include <libcamera/base/private.h>
 
@@ -46,5 +46,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_BASE_EVENT_NOTIFIER_H__ */
diff --git a/include/libcamera/base/file.h b/include/libcamera/base/file.h
index 60851d385587..55e8edd934d4 100644
--- a/include/libcamera/base/file.h
+++ b/include/libcamera/base/file.h
@@ -4,8 +4,8 @@ 
  *
  * file.h - File I/O operations
  */
-#ifndef __LIBCAMERA_BASE_FILE_H__
-#define __LIBCAMERA_BASE_FILE_H__
+
+#pragma once
 
 #include <sys/types.h>
 
@@ -84,5 +84,3 @@  LIBCAMERA_FLAGS_ENABLE_OPERATORS(File::MapFlag)
 LIBCAMERA_FLAGS_ENABLE_OPERATORS(File::OpenModeFlag)
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_BASE_FILE_H__ */
diff --git a/include/libcamera/base/flags.h b/include/libcamera/base/flags.h
index adec549dccc9..bff3b93c85a1 100644
--- a/include/libcamera/base/flags.h
+++ b/include/libcamera/base/flags.h
@@ -4,8 +4,8 @@ 
  *
  * flags.h - Type-safe enum-based bitfields
  */
-#ifndef __LIBCAMERA_BASE_FLAGS_H__
-#define __LIBCAMERA_BASE_FLAGS_H__
+
+#pragma once
 
 #include <type_traits>
 
@@ -191,5 +191,3 @@  struct flags_enable_operators<_enum> {					\
 #endif /* __DOXYGEN__ */
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_BASE_FLAGS_H__ */
diff --git a/include/libcamera/base/log.h b/include/libcamera/base/log.h
index 866a2133523b..3f065267c914 100644
--- a/include/libcamera/base/log.h
+++ b/include/libcamera/base/log.h
@@ -4,8 +4,8 @@ 
  *
  * log.h - Logging infrastructure
  */
-#ifndef __LIBCAMERA_BASE_LOG_H__
-#define __LIBCAMERA_BASE_LOG_H__
+
+#pragma once
 
 #include <chrono>
 #include <sstream>
@@ -128,5 +128,3 @@  LogMessage _log(const LogCategory *category, LogSeverity severity,
 #endif
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_BASE_LOG_H__ */
diff --git a/include/libcamera/base/message.h b/include/libcamera/base/message.h
index 5d2a9f04f0a7..65572c7470e9 100644
--- a/include/libcamera/base/message.h
+++ b/include/libcamera/base/message.h
@@ -4,8 +4,8 @@ 
  *
  * message.h - Message queue support
  */
-#ifndef __LIBCAMERA_BASE_MESSAGE_H__
-#define __LIBCAMERA_BASE_MESSAGE_H__
+
+#pragma once
 
 #include <atomic>
 
@@ -67,5 +67,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_BASE_MESSAGE_H__ */
diff --git a/include/libcamera/base/object.h b/include/libcamera/base/object.h
index 5c385ab4b140..25dcbc0483d0 100644
--- a/include/libcamera/base/object.h
+++ b/include/libcamera/base/object.h
@@ -4,8 +4,8 @@ 
  *
  * object.h - Base object
  */
-#ifndef __LIBCAMERA_BASE_OBJECT_H__
-#define __LIBCAMERA_BASE_OBJECT_H__
+
+#pragma once
 
 #include <list>
 #include <memory>
@@ -67,5 +67,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_BASE_OBJECT_H__ */
diff --git a/include/libcamera/base/semaphore.h b/include/libcamera/base/semaphore.h
index d8146eb8060b..ae87d31916dc 100644
--- a/include/libcamera/base/semaphore.h
+++ b/include/libcamera/base/semaphore.h
@@ -4,8 +4,8 @@ 
  *
  * semaphore.h - General-purpose counting semaphore
  */
-#ifndef __LIBCAMERA_BASE_SEMAPHORE_H__
-#define __LIBCAMERA_BASE_SEMAPHORE_H__
+
+#pragma once
 
 #include <condition_variable>
 
@@ -31,5 +31,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_BASE_SEMAPHORE_H__ */
diff --git a/include/libcamera/base/signal.h b/include/libcamera/base/signal.h
index 8d9f82f62d0d..91000d0d6349 100644
--- a/include/libcamera/base/signal.h
+++ b/include/libcamera/base/signal.h
@@ -4,8 +4,8 @@ 
  *
  * signal.h - Signal & slot implementation
  */
-#ifndef __LIBCAMERA_BASE_SIGNAL_H__
-#define __LIBCAMERA_BASE_SIGNAL_H__
+
+#pragma once
 
 #include <functional>
 #include <list>
@@ -147,5 +147,3 @@  public:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_BASE_SIGNAL_H__ */
diff --git a/include/libcamera/base/span.h b/include/libcamera/base/span.h
index 21099d5611b8..88d2e3de3a6b 100644
--- a/include/libcamera/base/span.h
+++ b/include/libcamera/base/span.h
@@ -5,8 +5,7 @@ 
  * span.h - C++20 std::span<> implementation for C++11
  */
 
-#ifndef __LIBCAMERA_BASE_SPAN_H__
-#define __LIBCAMERA_BASE_SPAN_H__
+#pragma once
 
 #include <array>
 #include <iterator>
@@ -420,5 +419,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_BASE_SPAN_H__ */
diff --git a/include/libcamera/base/thread.h b/include/libcamera/base/thread.h
index e0ca0aeaa761..32ebc80a0eb9 100644
--- a/include/libcamera/base/thread.h
+++ b/include/libcamera/base/thread.h
@@ -4,8 +4,8 @@ 
  *
  * thread.h - Thread support
  */
-#ifndef __LIBCAMERA_BASE_THREAD_H__
-#define __LIBCAMERA_BASE_THREAD_H__
+
+#pragma once
 
 #include <memory>
 #include <mutex>
@@ -74,5 +74,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_BASE_THREAD_H__ */
diff --git a/include/libcamera/base/timer.h b/include/libcamera/base/timer.h
index 44876a85dc0a..09f1d3229bd5 100644
--- a/include/libcamera/base/timer.h
+++ b/include/libcamera/base/timer.h
@@ -4,8 +4,8 @@ 
  *
  * timer.h - Generic timer
  */
-#ifndef __LIBCAMERA_BASE_TIMER_H__
-#define __LIBCAMERA_BASE_TIMER_H__
+
+#pragma once
 
 #include <chrono>
 #include <stdint.h>
@@ -47,5 +47,3 @@  private:
 };
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_BASE_TIMER_H__ */
diff --git a/include/libcamera/base/utils.h b/include/libcamera/base/utils.h
index 2b761436a99f..3a803176693d 100644
--- a/include/libcamera/base/utils.h
+++ b/include/libcamera/base/utils.h
@@ -4,8 +4,8 @@ 
  *
  * utils.h - Miscellaneous utility functions
  */
-#ifndef __LIBCAMERA_BASE_UTILS_H__
-#define __LIBCAMERA_BASE_UTILS_H__
+
+#pragma once
 
 #include <algorithm>
 #include <chrono>
@@ -355,5 +355,3 @@  std::basic_ostream<CharT, Traits> &operator<<(std::basic_ostream<CharT, Traits>
 #endif
 
 } /* namespace libcamera */
-
-#endif /* __LIBCAMERA_BASE_UTILS_H__ */