From 0c072ee90ad40e41cd1196b30fdfa5ccec213ddb Mon Sep 17 00:00:00 2001 From: Andrei Litvin Date: Fri, 9 Oct 2020 10:46:28 -0400 Subject: [PATCH] Make src/system use pragma once in headers (#3141) --- src/system/SystemAlignSize.h | 5 +---- src/system/SystemClock.h | 5 +---- src/system/SystemConfig.h | 5 +---- src/system/SystemError.h | 4 +--- src/system/SystemEvent.h | 5 +---- src/system/SystemFaultInjection.h | 5 +---- src/system/SystemLayer.h | 5 +---- src/system/SystemLayerPrivate.h | 6 +----- src/system/SystemMutex.h | 5 +---- src/system/SystemObject.h | 5 +---- src/system/SystemPacketBuffer.h | 5 +---- src/system/SystemStats.h | 6 ++---- src/system/SystemTimer.h | 5 +---- src/system/SystemWakeEvent.h | 5 +---- src/system/TimeSource.h | 6 ++---- src/system/tests/TestSystemLayer.h | 5 +---- 16 files changed, 18 insertions(+), 64 deletions(-) diff --git a/src/system/SystemAlignSize.h b/src/system/SystemAlignSize.h index 557cb13b98c2cb..20006c83d5d137 100644 --- a/src/system/SystemAlignSize.h +++ b/src/system/SystemAlignSize.h @@ -23,9 +23,6 @@ * element with alignment padding. */ -#ifndef SYSTEMALIGNSIZE_H -#define SYSTEMALIGNSIZE_H +#pragma once #define CHIP_SYSTEM_ALIGN_SIZE(ELEMENT, ALIGNMENT) (((ELEMENT) + (ALIGNMENT) -1) & ~((ALIGNMENT) -1)) - -#endif // defined(SYSTEMALIGNSIZE_H) diff --git a/src/system/SystemClock.h b/src/system/SystemClock.h index 88277329ec9d87..ea8e6fcce2ec30 100644 --- a/src/system/SystemClock.h +++ b/src/system/SystemClock.h @@ -22,8 +22,7 @@ * function for retrieving the current system time. */ -#ifndef SYSTEMTIME_H -#define SYSTEMTIME_H +#pragma once // Include configuration headers #include @@ -218,5 +217,3 @@ extern Error SetClock_RealTime(uint64_t newCurTime); } // namespace Platform } // namespace System } // namespace chip - -#endif // SYSTEMTIME_H diff --git a/src/system/SystemConfig.h b/src/system/SystemConfig.h index a45ccb968a50f6..05a53a64c48f50 100644 --- a/src/system/SystemConfig.h +++ b/src/system/SystemConfig.h @@ -34,8 +34,7 @@ * C-language programs. */ -#ifndef SYSTEMCONFIG_H -#define SYSTEMCONFIG_H +#pragma once /* Platform include headers */ #if CHIP_SEPARATE_CONFIG_H @@ -671,5 +670,3 @@ struct LwIPEvent; #define CHIP_SYSTEM_CONFIG_USE_BSD_IFADDRS 1 #endif #endif // CHIP_SYSTEM_CONFIG_USE_BSD_IFADDRS - -#endif // defined(SYSTEMCONFIG_H) diff --git a/src/system/SystemError.h b/src/system/SystemError.h index 502af1235f4699..3f8e5f1dfaa061 100644 --- a/src/system/SystemError.h +++ b/src/system/SystemError.h @@ -29,8 +29,7 @@ * C-language programs. */ -#ifndef SYSTEMERROR_H -#define SYSTEMERROR_H +#pragma once // Include headers #include @@ -198,4 +197,3 @@ extern bool FormatLwIPError(char * buf, uint16_t bufSize, int32_t err); } // namespace chip #endif // !defined(__cplusplus) -#endif // defined(SYSTEMERROR_H) diff --git a/src/system/SystemEvent.h b/src/system/SystemEvent.h index 8deacced94be42..3e50ac009cda75 100644 --- a/src/system/SystemEvent.h +++ b/src/system/SystemEvent.h @@ -22,8 +22,7 @@ * generated at the CHIP System Layer. */ -#ifndef SYSTEMEVENT_H -#define SYSTEMEVENT_H +#pragma once // Include headers #include @@ -111,5 +110,3 @@ typedef CHIP_SYSTEM_CONFIG_EVENT_OBJECT_TYPE Event; } // namespace System } // namespace chip - -#endif // defined(SYSTEMEVENT_H) diff --git a/src/system/SystemFaultInjection.h b/src/system/SystemFaultInjection.h index e7f85f911350ab..6793c165abe8b2 100644 --- a/src/system/SystemFaultInjection.h +++ b/src/system/SystemFaultInjection.h @@ -21,8 +21,7 @@ * Header file for the fault-injection utilities for CHIP System Layer. */ -#ifndef SYSTEMFAULTINJECTION_H -#define SYSTEMFAULTINJECTION_H +#pragma once #include @@ -127,5 +126,3 @@ DLL_EXPORT void InjectAsyncEvent(); #define CHIP_SYSTEM_FAULT_INJECT_ASYNC_EVENT() #endif // CHIP_SYSTEM_CONFIG_TEST - -#endif // SYSTEMFAULTINJECTION_H diff --git a/src/system/SystemLayer.h b/src/system/SystemLayer.h index 21a0894be3d47f..30d094470aa936 100644 --- a/src/system/SystemLayer.h +++ b/src/system/SystemLayer.h @@ -23,8 +23,7 @@ * functions. */ -#ifndef SYSTEMLAYER_H -#define SYSTEMLAYER_H +#pragma once // Include configuration headers #include @@ -225,5 +224,3 @@ inline LayerState Layer::State() const } // namespace System } // namespace chip - -#endif // defined(SYSTEMLAYER_H) diff --git a/src/system/SystemLayerPrivate.h b/src/system/SystemLayerPrivate.h index 05bb59f2e088a9..135803671c24d7 100644 --- a/src/system/SystemLayerPrivate.h +++ b/src/system/SystemLayerPrivate.h @@ -20,9 +20,7 @@ * @file * This header file includes common private definitions for the CHIP system layer. */ - -#ifndef SYSTEMLAYERPRIVATE_H -#define SYSTEMLAYERPRIVATE_H +#pragma once #include @@ -44,5 +42,3 @@ #endif // LWIP_VERSION_MAJOR #endif // CHIP_SYSTEM_CONFIG_USE_LWIP - -#endif // defined(SYSTEMLAYERPRIVATE_H) diff --git a/src/system/SystemMutex.h b/src/system/SystemMutex.h index 3d946345fabad5..1908ffe00158e5 100644 --- a/src/system/SystemMutex.h +++ b/src/system/SystemMutex.h @@ -22,8 +22,7 @@ * offered by the target platform. */ -#ifndef SYSTEMMUTEX_H -#define SYSTEMMUTEX_H +#pragma once // Include configuration headers #include @@ -114,5 +113,3 @@ inline void Mutex::Unlock(void) } // namespace chip #endif // !CHIP_SYSTEM_CONFIG_NO_LOCKING - -#endif // defined(SYSTEMMUTEX_H) diff --git a/src/system/SystemObject.h b/src/system/SystemObject.h index 1b3f8dc9c9eeef..4b74cdd7eb8d49 100644 --- a/src/system/SystemObject.h +++ b/src/system/SystemObject.h @@ -26,8 +26,7 @@ * - template class chip::System::ObjectPool */ -#ifndef SYSTEMOBJECT_H -#define SYSTEMOBJECT_H +#pragma once // Include configuration headers #include @@ -333,5 +332,3 @@ inline void ObjectPool::GetStatistics(chip::System::Stats::count_t & aNumI } // namespace System } // namespace chip - -#endif // defined(SYSTEMOBJECT_H) diff --git a/src/system/SystemPacketBuffer.h b/src/system/SystemPacketBuffer.h index 133b16a2af29b6..39ad6e1d6d482b 100644 --- a/src/system/SystemPacketBuffer.h +++ b/src/system/SystemPacketBuffer.h @@ -23,8 +23,7 @@ * octet-serialized data. */ -#ifndef SYSTEMPACKETBUFFER_H -#define SYSTEMPACKETBUFFER_H +#pragma once // Include configuration header #include @@ -231,5 +230,3 @@ inline uint16_t PacketBuffer::AllocSize() const } // namespace System } // namespace chip - -#endif // defined(SYSTEMPACKETBUFFER_H) diff --git a/src/system/SystemStats.h b/src/system/SystemStats.h index 983edb1c5cda97..4800f1f5288c13 100644 --- a/src/system/SystemStats.h +++ b/src/system/SystemStats.h @@ -22,8 +22,8 @@ * on the state of CHIP, Inet and System resources */ -#ifndef SYSTEMSTATS_H -#define SYSTEMSTATS_H +#pragma once + // Include standard C library limit macros #ifndef __STDC_LIMIT_MACROS #define __STDC_LIMIT_MACROS @@ -170,5 +170,3 @@ const Label * GetStrings(); #define SYSTEM_STATS_UPDATE_LWIP_PBUF_COUNTS() #endif // CHIP_SYSTEM_CONFIG_PROVIDE_STATISTICS - -#endif // defined(SYSTEMSTATS_H) diff --git a/src/system/SystemTimer.h b/src/system/SystemTimer.h index 0342f1beb7c940..1d005fca1183c3 100644 --- a/src/system/SystemTimer.h +++ b/src/system/SystemTimer.h @@ -23,8 +23,7 @@ * timer. */ -#ifndef SYSTEMTIMER_H -#define SYSTEMTIMER_H +#pragma once // Include configuration headers #include @@ -101,5 +100,3 @@ inline void Timer::GetStatistics(chip::System::Stats::count_t & aNumInUse, chip: } // namespace System } // namespace chip - -#endif // defined(SYSTEMTIMER_H) diff --git a/src/system/SystemWakeEvent.h b/src/system/SystemWakeEvent.h index efb2ca4c54a12b..bdbe9a892a1b3d 100644 --- a/src/system/SystemWakeEvent.h +++ b/src/system/SystemWakeEvent.h @@ -21,8 +21,7 @@ * resuming task from select system call. */ -#ifndef SYSTEMWAKEEVENT_H -#define SYSTEMWAKEEVENT_H +#pragma once // Include configuration headers #include @@ -65,5 +64,3 @@ class SystemWakeEvent } // namespace System } // namespace chip - -#endif // SYSTEMWAKEEVENT_H diff --git a/src/system/TimeSource.h b/src/system/TimeSource.h index d9ed25368a2885..bfe473a74a0b52 100644 --- a/src/system/TimeSource.h +++ b/src/system/TimeSource.h @@ -19,8 +19,8 @@ * @brief defines a generic time source interface that uses a real clock * at runtime but can be substituted by a test one for unit tests. */ -#ifndef TIME_SOURCE_H_ -#define TIME_SOURCE_H_ + +#pragma once #include #include @@ -90,5 +90,3 @@ class TimeSource } // namespace Time } // namespace chip - -#endif // TIME_SOURCE_H_ diff --git a/src/system/tests/TestSystemLayer.h b/src/system/tests/TestSystemLayer.h index 14872f924fa3fe..2cf46f4f262a7f 100644 --- a/src/system/tests/TestSystemLayer.h +++ b/src/system/tests/TestSystemLayer.h @@ -22,8 +22,7 @@ * */ -#ifndef TESTSYSTEMLAYER_H -#define TESTSYSTEMLAYER_H +#pragma once #ifdef __cplusplus extern "C" { @@ -39,5 +38,3 @@ int TestTimeSource(void); #ifdef __cplusplus } #endif - -#endif // TESTSYSTEMLAYER_H