Skip to content

Commit

Permalink
Make src/system use pragma once in headers (#3141)
Browse files Browse the repository at this point in the history
  • Loading branch information
andy31415 authored Oct 9, 2020
1 parent 0edb32d commit 0c072ee
Show file tree
Hide file tree
Showing 16 changed files with 18 additions and 64 deletions.
5 changes: 1 addition & 4 deletions src/system/SystemAlignSize.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
5 changes: 1 addition & 4 deletions src/system/SystemClock.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
* function for retrieving the current system time.
*/

#ifndef SYSTEMTIME_H
#define SYSTEMTIME_H
#pragma once

// Include configuration headers
#include <system/SystemConfig.h>
Expand Down Expand Up @@ -218,5 +217,3 @@ extern Error SetClock_RealTime(uint64_t newCurTime);
} // namespace Platform
} // namespace System
} // namespace chip

#endif // SYSTEMTIME_H
5 changes: 1 addition & 4 deletions src/system/SystemConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@
* C-language programs.
*/

#ifndef SYSTEMCONFIG_H
#define SYSTEMCONFIG_H
#pragma once

/* Platform include headers */
#if CHIP_SEPARATE_CONFIG_H
Expand Down Expand Up @@ -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)
4 changes: 1 addition & 3 deletions src/system/SystemError.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,7 @@
* C-language programs.
*/

#ifndef SYSTEMERROR_H
#define SYSTEMERROR_H
#pragma once

// Include headers
#include <system/SystemConfig.h>
Expand Down Expand Up @@ -198,4 +197,3 @@ extern bool FormatLwIPError(char * buf, uint16_t bufSize, int32_t err);
} // namespace chip

#endif // !defined(__cplusplus)
#endif // defined(SYSTEMERROR_H)
5 changes: 1 addition & 4 deletions src/system/SystemEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
* generated at the CHIP System Layer.
*/

#ifndef SYSTEMEVENT_H
#define SYSTEMEVENT_H
#pragma once

// Include headers
#include <system/SystemConfig.h>
Expand Down Expand Up @@ -111,5 +110,3 @@ typedef CHIP_SYSTEM_CONFIG_EVENT_OBJECT_TYPE Event;

} // namespace System
} // namespace chip

#endif // defined(SYSTEMEVENT_H)
5 changes: 1 addition & 4 deletions src/system/SystemFaultInjection.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
* Header file for the fault-injection utilities for CHIP System Layer.
*/

#ifndef SYSTEMFAULTINJECTION_H
#define SYSTEMFAULTINJECTION_H
#pragma once

#include <system/SystemConfig.h>

Expand Down Expand Up @@ -127,5 +126,3 @@ DLL_EXPORT void InjectAsyncEvent();
#define CHIP_SYSTEM_FAULT_INJECT_ASYNC_EVENT()

#endif // CHIP_SYSTEM_CONFIG_TEST

#endif // SYSTEMFAULTINJECTION_H
5 changes: 1 addition & 4 deletions src/system/SystemLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
* functions.
*/

#ifndef SYSTEMLAYER_H
#define SYSTEMLAYER_H
#pragma once

// Include configuration headers
#include <system/SystemConfig.h>
Expand Down Expand Up @@ -225,5 +224,3 @@ inline LayerState Layer::State() const

} // namespace System
} // namespace chip

#endif // defined(SYSTEMLAYER_H)
6 changes: 1 addition & 5 deletions src/system/SystemLayerPrivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <system/SystemConfig.h>

Expand All @@ -44,5 +42,3 @@
#endif // LWIP_VERSION_MAJOR

#endif // CHIP_SYSTEM_CONFIG_USE_LWIP

#endif // defined(SYSTEMLAYERPRIVATE_H)
5 changes: 1 addition & 4 deletions src/system/SystemMutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
* offered by the target platform.
*/

#ifndef SYSTEMMUTEX_H
#define SYSTEMMUTEX_H
#pragma once

// Include configuration headers
#include <system/SystemConfig.h>
Expand Down Expand Up @@ -114,5 +113,3 @@ inline void Mutex::Unlock(void)
} // namespace chip

#endif // !CHIP_SYSTEM_CONFIG_NO_LOCKING

#endif // defined(SYSTEMMUTEX_H)
5 changes: 1 addition & 4 deletions src/system/SystemObject.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
* - template<class T, unsigned int N> class chip::System::ObjectPool
*/

#ifndef SYSTEMOBJECT_H
#define SYSTEMOBJECT_H
#pragma once

// Include configuration headers
#include <system/SystemConfig.h>
Expand Down Expand Up @@ -333,5 +332,3 @@ inline void ObjectPool<T, N>::GetStatistics(chip::System::Stats::count_t & aNumI

} // namespace System
} // namespace chip

#endif // defined(SYSTEMOBJECT_H)
5 changes: 1 addition & 4 deletions src/system/SystemPacketBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
* octet-serialized data.
*/

#ifndef SYSTEMPACKETBUFFER_H
#define SYSTEMPACKETBUFFER_H
#pragma once

// Include configuration header
#include <system/SystemConfig.h>
Expand Down Expand Up @@ -231,5 +230,3 @@ inline uint16_t PacketBuffer::AllocSize() const

} // namespace System
} // namespace chip

#endif // defined(SYSTEMPACKETBUFFER_H)
6 changes: 2 additions & 4 deletions src/system/SystemStats.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -170,5 +170,3 @@ const Label * GetStrings();
#define SYSTEM_STATS_UPDATE_LWIP_PBUF_COUNTS()

#endif // CHIP_SYSTEM_CONFIG_PROVIDE_STATISTICS

#endif // defined(SYSTEMSTATS_H)
5 changes: 1 addition & 4 deletions src/system/SystemTimer.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@
* timer.
*/

#ifndef SYSTEMTIMER_H
#define SYSTEMTIMER_H
#pragma once

// Include configuration headers
#include <system/SystemConfig.h>
Expand Down Expand Up @@ -101,5 +100,3 @@ inline void Timer::GetStatistics(chip::System::Stats::count_t & aNumInUse, chip:

} // namespace System
} // namespace chip

#endif // defined(SYSTEMTIMER_H)
5 changes: 1 addition & 4 deletions src/system/SystemWakeEvent.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
* resuming task from select system call.
*/

#ifndef SYSTEMWAKEEVENT_H
#define SYSTEMWAKEEVENT_H
#pragma once

// Include configuration headers
#include <system/SystemConfig.h>
Expand Down Expand Up @@ -65,5 +64,3 @@ class SystemWakeEvent

} // namespace System
} // namespace chip

#endif // SYSTEMWAKEEVENT_H
6 changes: 2 additions & 4 deletions src/system/TimeSource.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 <stdlib.h>
#include <system/SystemClock.h>
Expand Down Expand Up @@ -90,5 +90,3 @@ class TimeSource<Source::kTest>

} // namespace Time
} // namespace chip

#endif // TIME_SOURCE_H_
5 changes: 1 addition & 4 deletions src/system/tests/TestSystemLayer.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@
*
*/

#ifndef TESTSYSTEMLAYER_H
#define TESTSYSTEMLAYER_H
#pragma once

#ifdef __cplusplus
extern "C" {
Expand All @@ -39,5 +38,3 @@ int TestTimeSource(void);
#ifdef __cplusplus
}
#endif

#endif // TESTSYSTEMLAYER_H

0 comments on commit 0c072ee

Please sign in to comment.