@@ -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__ */
@@ -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__ */
@@ -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__ */
@@ -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__ */
@@ -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__ */
@@ -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__ */
@@ -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__ */
@@ -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__ */
@@ -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__ */
@@ -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__ */
@@ -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__ */
@@ -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__ */
@@ -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__ */
@@ -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__ */
@@ -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__ */
@@ -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__ */
@@ -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__ */
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(-)