From de527ff60653a3ed7cf0e313695267b53c120a09 Mon Sep 17 00:00:00 2001 From: Michael Kubacki Date: Tue, 3 Feb 2026 13:18:20 -0500 Subject: [PATCH] EmbeddedPkg: Replace include guards with #pragma once Replace traditional `#ifndef`/`#define`/`#endif` include guards with `#pragma` once. `#pragma once` is a widely supported preprocessor directive that prevents header files from being included multiple times. It is supported by all toolchains used to build edk2: GCC, Clang/LLVM, and MSVC. Compared to macro-based include guards, `#pragma once`: - Eliminates the risk of macro name collisions or copy/paste errors where two headers inadvertently use the same guard macro. - Eliminate inconsistency in the way include guard macros are named (e.g., some files use `__FILE_H__`, others use `FILE_H_`, etc.). - Reduces boilerplate (three lines replaced by one). - Avoids polluting the macro namespace with guard symbols. - Can improve build times as the preprocessor can skip re-opening the file entirely, rather than re-reading it to find the matching `#endif` ("multiple-include optimization"). - Note that some compilers may already optimize traditional include guards, by recognzining the idiomatic pattern. This change is made acknowledging that overall portability of the code will technically be reduced, as `#pragma once` is not part of the C/C++ standards. However, this is considered acceptable given: 1. edk2 already defines a subset of supported compilers in BaseTools/Conf/tools_def.template, all of which have supported `#pragma once` for over two decades. 2. There have been concerns raised to the project about inconsistent include guard naming and potential macro collisions. Approximate compiler support dates: - MSVC: Supported since Visual C++ 4.2 (1996) - GCC: Supported since 3.4 (2004) (http://gnu.ist.utl.pt/software/gcc/gcc-3.4/changes.html) - Clang (LLVM based): Since initial release in 2007 Signed-off-by: Michael Kubacki --- EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.h | 5 +---- EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.h | 5 +---- EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.h | 5 +---- .../MemoryAttributeManagerDxe/MemoryAttributeManagerDxe.h | 5 +---- EmbeddedPkg/Drivers/VirtualKeyboardDxe/ComponentName.h | 5 +---- EmbeddedPkg/Drivers/VirtualKeyboardDxe/VirtualKeyboard.h | 5 +---- EmbeddedPkg/GdbStub/GdbStubInternal.h | 5 +---- EmbeddedPkg/Include/Guid/ConsolePrefFormSet.h | 5 +---- EmbeddedPkg/Include/Guid/DtPlatformDefaultDtbFile.h | 5 +---- EmbeddedPkg/Include/Guid/DtPlatformFormSet.h | 5 +---- EmbeddedPkg/Include/Guid/ExtractSection.h | 5 +---- EmbeddedPkg/Include/Guid/MemoryAttributeManagerFormSet.h | 5 +---- EmbeddedPkg/Include/Guid/NvVarStoreFormatted.h | 5 +---- EmbeddedPkg/Include/Guid/PlatformHasDeviceTree.h | 5 +---- EmbeddedPkg/Include/Library/AcpiLib.h | 5 +---- EmbeddedPkg/Include/Library/AndroidBootImgLib.h | 5 +---- EmbeddedPkg/Include/Library/DebugAgentTimerLib.h | 5 +---- EmbeddedPkg/Include/Library/DmaLib.h | 5 +---- EmbeddedPkg/Include/Library/DtPlatformDtbLoaderLib.h | 5 +---- EmbeddedPkg/Include/Library/EfiFileLib.h | 5 +---- EmbeddedPkg/Include/Library/FdtLoadLib.h | 5 +---- EmbeddedPkg/Include/Library/GdbSerialLib.h | 5 +---- EmbeddedPkg/Include/Library/HalRuntimeServicesLib.h | 5 +---- EmbeddedPkg/Include/Library/NorFlashInfoLib.h | 5 +---- EmbeddedPkg/Include/Library/PrePiHobListPointerLib.h | 5 +---- EmbeddedPkg/Include/Library/PrePiLib.h | 5 +---- EmbeddedPkg/Include/Library/TimeBaseLib.h | 5 +---- EmbeddedPkg/Include/Ppi/EmbeddedGpio.h | 5 +---- EmbeddedPkg/Include/Protocol/AndroidBootImg.h | 5 +---- EmbeddedPkg/Include/Protocol/AndroidFastbootPlatform.h | 5 +---- EmbeddedPkg/Include/Protocol/EmbeddedDevice.h | 5 +---- EmbeddedPkg/Include/Protocol/EmbeddedExternalDevice.h | 5 +---- EmbeddedPkg/Include/Protocol/EmbeddedGpio.h | 5 +---- EmbeddedPkg/Include/Protocol/FdtClient.h | 5 +---- EmbeddedPkg/Include/Protocol/HardwareInterrupt.h | 5 +---- EmbeddedPkg/Include/Protocol/HardwareInterrupt2.h | 5 +---- EmbeddedPkg/Include/Protocol/MmcHost.h | 5 +---- EmbeddedPkg/Include/Protocol/PeCoffLoader.h | 5 +---- EmbeddedPkg/Include/Protocol/PlatformBootManager.h | 5 +---- EmbeddedPkg/Include/Protocol/PlatformVirtualKeyboard.h | 5 +---- EmbeddedPkg/Include/Protocol/UsbDevice.h | 5 +---- EmbeddedPkg/Library/PrePiLib/PrePi.h | 5 +---- .../Include/GoogleTest/Library/MockDtPlatformDtbLoaderLib.h | 5 +---- EmbeddedPkg/Universal/MmcDxe/Mmc.h | 5 +---- 44 files changed, 44 insertions(+), 176 deletions(-) diff --git a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.h b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.h index 3923c03428..605430e414 100644 --- a/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.h +++ b/EmbeddedPkg/Application/AndroidFastboot/AndroidFastbootApp.h @@ -6,8 +6,7 @@ **/ -#ifndef __ANDROID_FASTBOOT_APP_H__ -#define __ANDROID_FASTBOOT_APP_H__ +#pragma once #include #include @@ -33,5 +32,3 @@ ParseAndroidBootImg ( OUT UINTN *RamdiskSize, OUT CHAR8 *KernelArgs ); - -#endif //ifdef __ANDROID_FASTBOOT_APP_H__ diff --git a/EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.h b/EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.h index a3b952f01a..c9e4590d6b 100644 --- a/EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.h +++ b/EmbeddedPkg/Drivers/ConsolePrefDxe/ConsolePrefDxe.h @@ -6,8 +6,7 @@ * **/ -#ifndef __CONSOLE_PREF_DXE_H__ -#define __CONSOLE_PREF_DXE_H__ +#pragma once #include #include @@ -21,5 +20,3 @@ typedef struct { UINT8 Console; UINT8 Reserved[3]; } CONSOLE_PREF_VARSTORE_DATA; - -#endif diff --git a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.h b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.h index d6e9f43d72..4fb99026ad 100644 --- a/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.h +++ b/EmbeddedPkg/Drivers/DtPlatformDxe/DtPlatformDxe.h @@ -6,8 +6,7 @@ * **/ -#ifndef __DT_PLATFORM_DXE_H__ -#define __DT_PLATFORM_DXE_H__ +#pragma once #include #include @@ -21,5 +20,3 @@ typedef struct { UINT8 Pref; UINT8 Reserved[3]; } DT_ACPI_VARSTORE_DATA; - -#endif diff --git a/EmbeddedPkg/Drivers/MemoryAttributeManagerDxe/MemoryAttributeManagerDxe.h b/EmbeddedPkg/Drivers/MemoryAttributeManagerDxe/MemoryAttributeManagerDxe.h index a027f3e4b6..03b4f2a473 100644 --- a/EmbeddedPkg/Drivers/MemoryAttributeManagerDxe/MemoryAttributeManagerDxe.h +++ b/EmbeddedPkg/Drivers/MemoryAttributeManagerDxe/MemoryAttributeManagerDxe.h @@ -6,8 +6,7 @@ **/ -#ifndef MEMORY_ATTRIBUTE_MANAGER_DXE_H_ -#define MEMORY_ATTRIBUTE_MANAGER_DXE_H_ +#pragma once #include @@ -18,5 +17,3 @@ typedef struct { BOOLEAN Enabled; } MEMORY_ATTRIBUTE_MANAGER_VARSTORE_DATA; - -#endif // __MEMORY_ATTRIBUTE_MANAGER_DXE_H__ diff --git a/EmbeddedPkg/Drivers/VirtualKeyboardDxe/ComponentName.h b/EmbeddedPkg/Drivers/VirtualKeyboardDxe/ComponentName.h index 7650e53821..5d4319b6fb 100644 --- a/EmbeddedPkg/Drivers/VirtualKeyboardDxe/ComponentName.h +++ b/EmbeddedPkg/Drivers/VirtualKeyboardDxe/ComponentName.h @@ -7,8 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef _VIRTUAL_KEYBOARD_COMPONENT_NAME_H_ -#define _VIRTUAL_KEYBOARD_COMPONENT_NAME_H_ +#pragma once extern EFI_COMPONENT_NAME_PROTOCOL gVirtualKeyboardComponentName; extern EFI_COMPONENT_NAME2_PROTOCOL gVirtualKeyboardComponentName2; @@ -141,5 +140,3 @@ VirtualKeyboardComponentNameGetControllerName ( IN CHAR8 *Language, OUT CHAR16 **ControllerName ); - -#endif diff --git a/EmbeddedPkg/Drivers/VirtualKeyboardDxe/VirtualKeyboard.h b/EmbeddedPkg/Drivers/VirtualKeyboardDxe/VirtualKeyboard.h index ed14f20507..3f8fde7dd1 100644 --- a/EmbeddedPkg/Drivers/VirtualKeyboardDxe/VirtualKeyboard.h +++ b/EmbeddedPkg/Drivers/VirtualKeyboardDxe/VirtualKeyboard.h @@ -7,8 +7,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef _VIRTUAL_KEYBOARD_H_ -#define _VIRTUAL_KEYBOARD_H_ +#pragma once #include #include @@ -533,5 +532,3 @@ VirtualKeyboardReadKeyStrokeEx ( IN EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, OUT EFI_KEY_DATA *KeyData ); - -#endif /* _VIRTUAL_KEYBOARD_H_ */ diff --git a/EmbeddedPkg/GdbStub/GdbStubInternal.h b/EmbeddedPkg/GdbStub/GdbStubInternal.h index e96a2add3c..54994b3144 100644 --- a/EmbeddedPkg/GdbStub/GdbStubInternal.h +++ b/EmbeddedPkg/GdbStub/GdbStubInternal.h @@ -7,8 +7,7 @@ **/ -#ifndef __GDB_STUB_INTERNAL__ -#define __GDB_STUB_INTERNAL__ +#pragma once #include #include @@ -711,5 +710,3 @@ ValidateException ( IN EFI_EXCEPTION_TYPE ExceptionType, IN OUT EFI_SYSTEM_CONTEXT SystemContext ); - -#endif diff --git a/EmbeddedPkg/Include/Guid/ConsolePrefFormSet.h b/EmbeddedPkg/Include/Guid/ConsolePrefFormSet.h index 2f1174c2b0..4463466b10 100644 --- a/EmbeddedPkg/Include/Guid/ConsolePrefFormSet.h +++ b/EmbeddedPkg/Include/Guid/ConsolePrefFormSet.h @@ -6,12 +6,9 @@ * **/ -#ifndef __CONSOLE_PREF_FORMSET_H__ -#define __CONSOLE_PREF_FORMSET_H__ +#pragma once #define CONSOLE_PREF_FORMSET_GUID \ { 0x2d2358b4, 0xe96c, 0x484d, { 0xb2, 0xdd, 0x7c, 0x2e, 0xdf, 0xc7, 0xd5, 0x6f } } extern EFI_GUID gConsolePrefFormSetGuid; - -#endif diff --git a/EmbeddedPkg/Include/Guid/DtPlatformDefaultDtbFile.h b/EmbeddedPkg/Include/Guid/DtPlatformDefaultDtbFile.h index d95863066e..4d6c4aedf6 100644 --- a/EmbeddedPkg/Include/Guid/DtPlatformDefaultDtbFile.h +++ b/EmbeddedPkg/Include/Guid/DtPlatformDefaultDtbFile.h @@ -6,12 +6,9 @@ * **/ -#ifndef __DT_PLATFORM_DEFAULT_DTB_FILE_H__ -#define __DT_PLATFORM_DEFAULT_DTB_FILE_H__ +#pragma once #define DT_PLATFORM_DEFAULT_DTB_FILE_GUID \ { 0x25462cda, 0x221f, 0x47df, { 0xac, 0x1d, 0x25, 0x9c, 0xfa, 0xa4, 0xe3, 0x26 } } extern EFI_GUID gDtPlatformDefaultDtbFileGuid; - -#endif diff --git a/EmbeddedPkg/Include/Guid/DtPlatformFormSet.h b/EmbeddedPkg/Include/Guid/DtPlatformFormSet.h index 5d751bbd96..64656342a4 100644 --- a/EmbeddedPkg/Include/Guid/DtPlatformFormSet.h +++ b/EmbeddedPkg/Include/Guid/DtPlatformFormSet.h @@ -6,12 +6,9 @@ * **/ -#ifndef __DT_PLATFORM_FORMSET_H__ -#define __DT_PLATFORM_FORMSET_H__ +#pragma once #define DT_PLATFORM_FORMSET_GUID \ { 0x2b7a240d, 0xd5ad, 0x4fd6, { 0xbe, 0x1c, 0xdf, 0xa4, 0x41, 0x5f, 0x55, 0x26 } } extern EFI_GUID gDtPlatformFormSetGuid; - -#endif diff --git a/EmbeddedPkg/Include/Guid/ExtractSection.h b/EmbeddedPkg/Include/Guid/ExtractSection.h index 7346296fbc..2fc80392b0 100644 --- a/EmbeddedPkg/Include/Guid/ExtractSection.h +++ b/EmbeddedPkg/Include/Guid/ExtractSection.h @@ -6,8 +6,7 @@ **/ -#ifndef __EXTRACT_SECTION_GUID_H__ -#define __EXTRACT_SECTION_GUID_H__ +#pragma once #include @@ -24,5 +23,3 @@ typedef struct { EFI_HOB_GUID_TYPE Hob; EXTRACT_SECTION_DATA Data; } EXTRACT_SECTION_HOB; - -#endif diff --git a/EmbeddedPkg/Include/Guid/MemoryAttributeManagerFormSet.h b/EmbeddedPkg/Include/Guid/MemoryAttributeManagerFormSet.h index 2efdf03216..ce8f728b99 100644 --- a/EmbeddedPkg/Include/Guid/MemoryAttributeManagerFormSet.h +++ b/EmbeddedPkg/Include/Guid/MemoryAttributeManagerFormSet.h @@ -6,12 +6,9 @@ **/ -#ifndef MEMORY_ATTRIBUTE_MANAGER_FORMSET_H_ -#define MEMORY_ATTRIBUTE_MANAGER_FORMSET_H_ +#pragma once #define MEMORY_ATTRIBUTE_MANAGER_FORMSET_GUID \ { 0xefab3427, 0x4793, 0x4e9e, { 0xaa, 0x29, 0x88, 0x0c, 0x9a, 0x77, 0x5b, 0x5f } } extern EFI_GUID gMemoryAttributeManagerFormSetGuid; - -#endif // __MEMORY_ATTRIBUTE_MANAGER_FORMSET_H__ diff --git a/EmbeddedPkg/Include/Guid/NvVarStoreFormatted.h b/EmbeddedPkg/Include/Guid/NvVarStoreFormatted.h index 96e1e91caf..7ace198a38 100644 --- a/EmbeddedPkg/Include/Guid/NvVarStoreFormatted.h +++ b/EmbeddedPkg/Include/Guid/NvVarStoreFormatted.h @@ -18,8 +18,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef __EDKII_NV_VAR_STORE_FORMATTED_H__ -#define __EDKII_NV_VAR_STORE_FORMATTED_H__ +#pragma once #define EDKII_NV_VAR_STORE_FORMATTED_GUID \ { \ @@ -28,5 +27,3 @@ } extern EFI_GUID gEdkiiNvVarStoreFormattedGuid; - -#endif diff --git a/EmbeddedPkg/Include/Guid/PlatformHasDeviceTree.h b/EmbeddedPkg/Include/Guid/PlatformHasDeviceTree.h index d05f109039..2e08e081e6 100644 --- a/EmbeddedPkg/Include/Guid/PlatformHasDeviceTree.h +++ b/EmbeddedPkg/Include/Guid/PlatformHasDeviceTree.h @@ -14,8 +14,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef __EDKII_PLATFORM_HAS_DEVICE_TREE_H__ -#define __EDKII_PLATFORM_HAS_DEVICE_TREE_H__ +#pragma once #define EDKII_PLATFORM_HAS_DEVICE_TREE_GUID \ { \ @@ -24,5 +23,3 @@ } extern EFI_GUID gEdkiiPlatformHasDeviceTreeGuid; - -#endif diff --git a/EmbeddedPkg/Include/Library/AcpiLib.h b/EmbeddedPkg/Include/Library/AcpiLib.h index 29137a4a53..026072748c 100644 --- a/EmbeddedPkg/Include/Library/AcpiLib.h +++ b/EmbeddedPkg/Include/Library/AcpiLib.h @@ -8,8 +8,7 @@ **/ -#ifndef __ACPI_LIB_H__ -#define __ACPI_LIB_H__ +#pragma once #include @@ -198,5 +197,3 @@ AcpiAmlObjectUpdateInteger ( IN CHAR8 *AsciiObjectPath, IN UINTN Value ); - -#endif // __ACPI_LIB_H__ diff --git a/EmbeddedPkg/Include/Library/AndroidBootImgLib.h b/EmbeddedPkg/Include/Library/AndroidBootImgLib.h index d58a4d2d32..d4abaa1ae2 100644 --- a/EmbeddedPkg/Include/Library/AndroidBootImgLib.h +++ b/EmbeddedPkg/Include/Library/AndroidBootImgLib.h @@ -7,8 +7,7 @@ **/ -#ifndef __ABOOTIMG_H__ -#define __ABOOTIMG_H__ +#pragma once #include #include @@ -62,5 +61,3 @@ AndroidBootImgBoot ( IN VOID *Buffer, IN UINTN BufferSize ); - -#endif /* __ABOOTIMG_H__ */ diff --git a/EmbeddedPkg/Include/Library/DebugAgentTimerLib.h b/EmbeddedPkg/Include/Library/DebugAgentTimerLib.h index d6f3b67d45..40bfa6aea0 100644 --- a/EmbeddedPkg/Include/Library/DebugAgentTimerLib.h +++ b/EmbeddedPkg/Include/Library/DebugAgentTimerLib.h @@ -9,8 +9,7 @@ **/ -#ifndef __GDB_TIMER_LIB__ -#define __GDB_TIMER_LIB__ +#pragma once /** Setup all the hardware needed for the debug agents timer. @@ -46,5 +45,3 @@ EFIAPI DebugAgentTimerEndOfInterrupt ( VOID ); - -#endif diff --git a/EmbeddedPkg/Include/Library/DmaLib.h b/EmbeddedPkg/Include/Library/DmaLib.h index 44bc71a1f6..1c58ae7a21 100644 --- a/EmbeddedPkg/Include/Library/DmaLib.h +++ b/EmbeddedPkg/Include/Library/DmaLib.h @@ -31,8 +31,7 @@ **/ -#ifndef __DMA_LIB_H__ -#define __DMA_LIB_H__ +#pragma once typedef enum { /// @@ -167,5 +166,3 @@ DmaAllocateAlignedBuffer ( IN UINTN Alignment, OUT VOID **HostAddress ); - -#endif diff --git a/EmbeddedPkg/Include/Library/DtPlatformDtbLoaderLib.h b/EmbeddedPkg/Include/Library/DtPlatformDtbLoaderLib.h index 1309d85186..392b3cbba3 100644 --- a/EmbeddedPkg/Include/Library/DtPlatformDtbLoaderLib.h +++ b/EmbeddedPkg/Include/Library/DtPlatformDtbLoaderLib.h @@ -6,8 +6,7 @@ * **/ -#ifndef __DT_PLATFORM_DTB_LOADER_LIB_H__ -#define __DT_PLATFORM_DTB_LOADER_LIB_H__ +#pragma once #include @@ -29,5 +28,3 @@ DtPlatformLoadDtb ( OUT VOID **Dtb, OUT UINTN *DtbSize ); - -#endif diff --git a/EmbeddedPkg/Include/Library/EfiFileLib.h b/EmbeddedPkg/Include/Library/EfiFileLib.h index bae19ec78a..032371490e 100644 --- a/EmbeddedPkg/Include/Library/EfiFileLib.h +++ b/EmbeddedPkg/Include/Library/EfiFileLib.h @@ -29,8 +29,7 @@ **/ -#ifndef __EFI_FILE_LIB_H__ -#define __EFI_FILE_LIB_H__ +#pragma once #include #include @@ -328,5 +327,3 @@ CHAR8 * EfiGetCwd ( VOID ); - -#endif diff --git a/EmbeddedPkg/Include/Library/FdtLoadLib.h b/EmbeddedPkg/Include/Library/FdtLoadLib.h index 952dd8f751..ce4a4076b5 100644 --- a/EmbeddedPkg/Include/Library/FdtLoadLib.h +++ b/EmbeddedPkg/Include/Library/FdtLoadLib.h @@ -6,8 +6,7 @@ * **/ -#ifndef _FDT_LOAD_LIB_H_ -#define _FDT_LOAD_LIB_H_ +#pragma once /** Load and Install FDT from Semihosting @@ -38,5 +37,3 @@ EFI_STATUS InstallFdtFromFv ( IN CONST EFI_GUID *FileName ); - -#endif diff --git a/EmbeddedPkg/Include/Library/GdbSerialLib.h b/EmbeddedPkg/Include/Library/GdbSerialLib.h index 58c3a5643c..b22e2416d7 100644 --- a/EmbeddedPkg/Include/Library/GdbSerialLib.h +++ b/EmbeddedPkg/Include/Library/GdbSerialLib.h @@ -7,8 +7,7 @@ **/ -#ifndef __GDB_SERIAL_LIB_H__ -#define __GDB_SERIAL_LIB_H__ +#pragma once /** Sets the baud rate, receive FIFO depth, transmit/receive time out, parity, @@ -90,5 +89,3 @@ VOID GdbPutString ( IN CHAR8 *String ); - -#endif diff --git a/EmbeddedPkg/Include/Library/HalRuntimeServicesLib.h b/EmbeddedPkg/Include/Library/HalRuntimeServicesLib.h index be1c03bb10..48fb7c4cee 100644 --- a/EmbeddedPkg/Include/Library/HalRuntimeServicesLib.h +++ b/EmbeddedPkg/Include/Library/HalRuntimeServicesLib.h @@ -6,8 +6,7 @@ **/ -#ifndef __RUNTIME_SERVICES_LIB_H__ -#define __RUNTIME_SERVICES_LIB_H__ +#pragma once VOID LibMtcInitialize ( @@ -168,5 +167,3 @@ LibReportStatusCode ( IN EFI_GUID *CallerId, IN EFI_STATUS_CODE_DATA *Data OPTIONAL ); - -#endif diff --git a/EmbeddedPkg/Include/Library/NorFlashInfoLib.h b/EmbeddedPkg/Include/Library/NorFlashInfoLib.h index 9a26159d19..d9bcd8f712 100644 --- a/EmbeddedPkg/Include/Library/NorFlashInfoLib.h +++ b/EmbeddedPkg/Include/Library/NorFlashInfoLib.h @@ -6,8 +6,7 @@ * **/ -#ifndef __NOR_FLASH_ID_LIB_H__ -#define __NOR_FLASH_ID_LIB_H__ +#pragma once #include @@ -87,5 +86,3 @@ EFIAPI NorFlashPrintInfo ( IN NOR_FLASH_INFO *Info ); - -#endif diff --git a/EmbeddedPkg/Include/Library/PrePiHobListPointerLib.h b/EmbeddedPkg/Include/Library/PrePiHobListPointerLib.h index a05ee8fd6b..c377c5603a 100644 --- a/EmbeddedPkg/Include/Library/PrePiHobListPointerLib.h +++ b/EmbeddedPkg/Include/Library/PrePiHobListPointerLib.h @@ -6,8 +6,7 @@ * **/ -#ifndef __PREPI_HOBLIST_POINTER_LIB_H__ -#define __PREPI_HOBLIST_POINTER_LIB_H__ +#pragma once /** Returns the pointer to the HOB list. @@ -34,5 +33,3 @@ EFIAPI PrePeiSetHobList ( IN VOID *HobList ); - -#endif diff --git a/EmbeddedPkg/Include/Library/PrePiLib.h b/EmbeddedPkg/Include/Library/PrePiLib.h index 0f5bd563ab..54418013e5 100644 --- a/EmbeddedPkg/Include/Library/PrePiLib.h +++ b/EmbeddedPkg/Include/Library/PrePiLib.h @@ -7,8 +7,7 @@ **/ -#ifndef __PRE_PI_LIB_H__ -#define __PRE_PI_LIB_H__ +#pragma once #include #include @@ -787,5 +786,3 @@ EFIAPI DecompressFirstFv ( VOID ); - -#endif diff --git a/EmbeddedPkg/Include/Library/TimeBaseLib.h b/EmbeddedPkg/Include/Library/TimeBaseLib.h index 320a695b27..d31d668390 100644 --- a/EmbeddedPkg/Include/Library/TimeBaseLib.h +++ b/EmbeddedPkg/Include/Library/TimeBaseLib.h @@ -8,8 +8,7 @@ * **/ -#ifndef _TIME_BASE_LIB_H_ -#define _TIME_BASE_LIB_H_ +#pragma once #include @@ -174,5 +173,3 @@ UINTN EfiTimeToWday ( IN EFI_TIME *Time ); - -#endif diff --git a/EmbeddedPkg/Include/Ppi/EmbeddedGpio.h b/EmbeddedPkg/Include/Ppi/EmbeddedGpio.h index b0d1b3703f..5d3922d75c 100644 --- a/EmbeddedPkg/Include/Ppi/EmbeddedGpio.h +++ b/EmbeddedPkg/Include/Ppi/EmbeddedGpio.h @@ -7,8 +7,7 @@ **/ -#ifndef __EMBEDDED_GPIO_PPI_H__ -#define __EMBEDDED_GPIO_PPI_H__ +#pragma once // // Protocol interface structure @@ -138,5 +137,3 @@ struct _EMBEDDED_GPIO_PPI { }; extern EFI_GUID gEmbeddedGpioPpiGuid; - -#endif diff --git a/EmbeddedPkg/Include/Protocol/AndroidBootImg.h b/EmbeddedPkg/Include/Protocol/AndroidBootImg.h index 128a5d8f0d..d5655600af 100644 --- a/EmbeddedPkg/Include/Protocol/AndroidBootImg.h +++ b/EmbeddedPkg/Include/Protocol/AndroidBootImg.h @@ -6,8 +6,7 @@ **/ -#ifndef __ANDROID_BOOTIMG_PROTOCOL_H__ -#define __ANDROID_BOOTIMG_PROTOCOL_H__ +#pragma once // // Protocol interface structure @@ -37,5 +36,3 @@ struct _ANDROID_BOOTIMG_PROTOCOL { }; extern EFI_GUID gAndroidBootImgProtocolGuid; - -#endif /* __ANDROID_BOOTIMG_PROTOCOL_H__ */ diff --git a/EmbeddedPkg/Include/Protocol/AndroidFastbootPlatform.h b/EmbeddedPkg/Include/Protocol/AndroidFastbootPlatform.h index e3e51ebefd..771892ca79 100644 --- a/EmbeddedPkg/Include/Protocol/AndroidFastbootPlatform.h +++ b/EmbeddedPkg/Include/Protocol/AndroidFastbootPlatform.h @@ -6,8 +6,7 @@ **/ -#ifndef __ANDROID_FASTBOOT_PLATFORM_H__ -#define __ANDROID_FASTBOOT_PLATFORM_H__ +#pragma once extern EFI_GUID gAndroidFastbootPlatformProtocolGuid; @@ -135,5 +134,3 @@ typedef struct _FASTBOOT_PLATFORM_PROTOCOL { FASTBOOT_PLATFORM_GETVAR GetVar; FASTBOOT_PLATFORM_OEM_COMMAND DoOemCommand; } FASTBOOT_PLATFORM_PROTOCOL; - -#endif diff --git a/EmbeddedPkg/Include/Protocol/EmbeddedDevice.h b/EmbeddedPkg/Include/Protocol/EmbeddedDevice.h index e6a1fdc2a1..4ea1a80893 100644 --- a/EmbeddedPkg/Include/Protocol/EmbeddedDevice.h +++ b/EmbeddedPkg/Include/Protocol/EmbeddedDevice.h @@ -20,8 +20,7 @@ **/ -#ifndef __EMBEDDED_DEVICE_PROTOCOL_H__ -#define __EMBEDDED_DEVICE_PROTOCOL_H__ +#pragma once // // Protocol GUID @@ -43,5 +42,3 @@ typedef struct { } EMBEDDED_DEVICE_PROTOCOL; extern EFI_GUID gEmbeddedDeviceGuid; - -#endif diff --git a/EmbeddedPkg/Include/Protocol/EmbeddedExternalDevice.h b/EmbeddedPkg/Include/Protocol/EmbeddedExternalDevice.h index 52c7fb6723..82d558b004 100644 --- a/EmbeddedPkg/Include/Protocol/EmbeddedExternalDevice.h +++ b/EmbeddedPkg/Include/Protocol/EmbeddedExternalDevice.h @@ -6,8 +6,7 @@ **/ -#ifndef __EMBEDDED_EXTERNAL_DEVICE_H__ -#define __EMBEDDED_EXTERNAL_DEVICE_H__ +#pragma once // // Protocol GUID @@ -86,5 +85,3 @@ struct _EMBEDDED_EXTERNAL_DEVICE { }; extern EFI_GUID gEmbeddedExternalDeviceProtocolGuid; - -#endif // __EMBEDDED_EXTERNAL_DEVICE_H__ diff --git a/EmbeddedPkg/Include/Protocol/EmbeddedGpio.h b/EmbeddedPkg/Include/Protocol/EmbeddedGpio.h index 3cd5b74a48..a19aff4b04 100644 --- a/EmbeddedPkg/Include/Protocol/EmbeddedGpio.h +++ b/EmbeddedPkg/Include/Protocol/EmbeddedGpio.h @@ -6,8 +6,7 @@ **/ -#ifndef __EMBEDDED_GPIO_H__ -#define __EMBEDDED_GPIO_H__ +#pragma once // // Protocol interface structure @@ -173,5 +172,3 @@ struct _PLATFORM_GPIO_CONTROLLER { }; extern EFI_GUID gPlatformGpioProtocolGuid; - -#endif diff --git a/EmbeddedPkg/Include/Protocol/FdtClient.h b/EmbeddedPkg/Include/Protocol/FdtClient.h index 723be88cfc..790df5fbcc 100644 --- a/EmbeddedPkg/Include/Protocol/FdtClient.h +++ b/EmbeddedPkg/Include/Protocol/FdtClient.h @@ -9,8 +9,7 @@ **/ -#ifndef __FDT_CLIENT_H__ -#define __FDT_CLIENT_H__ +#pragma once #define FDT_CLIENT_PROTOCOL_GUID {\ 0xE11FACA0, 0x4710, 0x4C8E, {0xA7, 0xA2, 0x01, 0xBA, 0xA2, 0x59, 0x1B, 0x4C} \ @@ -125,5 +124,3 @@ struct _FDT_CLIENT_PROTOCOL { }; extern EFI_GUID gFdtClientProtocolGuid; - -#endif diff --git a/EmbeddedPkg/Include/Protocol/HardwareInterrupt.h b/EmbeddedPkg/Include/Protocol/HardwareInterrupt.h index 412e99b6d1..332b8dea3d 100644 --- a/EmbeddedPkg/Include/Protocol/HardwareInterrupt.h +++ b/EmbeddedPkg/Include/Protocol/HardwareInterrupt.h @@ -15,8 +15,7 @@ **/ -#ifndef __HARDWARE_INTERRUPT_H__ -#define __HARDWARE_INTERRUPT_H__ +#pragma once #include @@ -148,5 +147,3 @@ struct _EFI_HARDWARE_INTERRUPT_PROTOCOL { }; extern EFI_GUID gHardwareInterruptProtocolGuid; - -#endif diff --git a/EmbeddedPkg/Include/Protocol/HardwareInterrupt2.h b/EmbeddedPkg/Include/Protocol/HardwareInterrupt2.h index d5b2f15629..6649b59b02 100644 --- a/EmbeddedPkg/Include/Protocol/HardwareInterrupt2.h +++ b/EmbeddedPkg/Include/Protocol/HardwareInterrupt2.h @@ -6,8 +6,7 @@ **/ -#ifndef __HARDWARE_INTERRUPT2_H__ -#define __HARDWARE_INTERRUPT2_H__ +#pragma once #include @@ -168,5 +167,3 @@ struct _EFI_HARDWARE_INTERRUPT2_PROTOCOL { }; extern EFI_GUID gHardwareInterrupt2ProtocolGuid; - -#endif diff --git a/EmbeddedPkg/Include/Protocol/MmcHost.h b/EmbeddedPkg/Include/Protocol/MmcHost.h index 881ae5e3d1..fa284d4cfb 100644 --- a/EmbeddedPkg/Include/Protocol/MmcHost.h +++ b/EmbeddedPkg/Include/Protocol/MmcHost.h @@ -7,8 +7,7 @@ **/ -#ifndef __MMC_HOST_H__ -#define __MMC_HOST_H__ +#pragma once /// /// Global ID for the MMC Host Protocol @@ -177,5 +176,3 @@ struct _EFI_MMC_HOST_PROTOCOL { Host->IsMultiBlock != NULL) extern EFI_GUID gEmbeddedMmcHostProtocolGuid; - -#endif diff --git a/EmbeddedPkg/Include/Protocol/PeCoffLoader.h b/EmbeddedPkg/Include/Protocol/PeCoffLoader.h index 08738e9927..daf569be46 100644 --- a/EmbeddedPkg/Include/Protocol/PeCoffLoader.h +++ b/EmbeddedPkg/Include/Protocol/PeCoffLoader.h @@ -6,8 +6,7 @@ **/ -#ifndef __PE_COFF_LOADER_H__ -#define __PE_COFF_LOADER_H__ +#pragma once // Needed for PE_COFF_LOADER_IMAGE_CONTEXT #include @@ -216,5 +215,3 @@ struct _PE_COFF_LOADER_PROTOCOL { }; extern EFI_GUID gPeCoffLoaderProtocolGuid; - -#endif diff --git a/EmbeddedPkg/Include/Protocol/PlatformBootManager.h b/EmbeddedPkg/Include/Protocol/PlatformBootManager.h index f1790d9742..9daae9ed03 100644 --- a/EmbeddedPkg/Include/Protocol/PlatformBootManager.h +++ b/EmbeddedPkg/Include/Protocol/PlatformBootManager.h @@ -6,8 +6,7 @@ **/ -#ifndef __PLATFORM_BOOT_MANAGER_PROTOCOL_H__ -#define __PLATFORM_BOOT_MANAGER_PROTOCOL_H__ +#pragma once // // Protocol interface structure @@ -76,5 +75,3 @@ struct _PLATFORM_BOOT_MANAGER_PROTOCOL { }; extern EFI_GUID gPlatformBootManagerProtocolGuid; - -#endif /* __PLATFORM_BOOT_MANAGER_PROTOCOL_H__ */ diff --git a/EmbeddedPkg/Include/Protocol/PlatformVirtualKeyboard.h b/EmbeddedPkg/Include/Protocol/PlatformVirtualKeyboard.h index 2123d3bc2e..b0afd0ffb0 100644 --- a/EmbeddedPkg/Include/Protocol/PlatformVirtualKeyboard.h +++ b/EmbeddedPkg/Include/Protocol/PlatformVirtualKeyboard.h @@ -6,8 +6,7 @@ **/ -#ifndef __PLATFORM_VIRTUAL_KEYBOARD_H__ -#define __PLATFORM_VIRTUAL_KEYBOARD_H__ +#pragma once // // Protocol interface structure @@ -55,5 +54,3 @@ struct _PLATFORM_VIRTUAL_KBD_PROTOCOL { }; extern EFI_GUID gPlatformVirtualKeyboardProtocolGuid; - -#endif /* __PLATFORM_VIRTUAL_KEYBOARD_H__ */ diff --git a/EmbeddedPkg/Include/Protocol/UsbDevice.h b/EmbeddedPkg/Include/Protocol/UsbDevice.h index b07f459afa..6fe07abaf0 100644 --- a/EmbeddedPkg/Include/Protocol/UsbDevice.h +++ b/EmbeddedPkg/Include/Protocol/UsbDevice.h @@ -6,8 +6,7 @@ **/ -#ifndef __USB_DEVICE_PROTOCOL_H__ -#define __USB_DEVICE_PROTOCOL_H__ +#pragma once #include @@ -108,5 +107,3 @@ struct _USB_DEVICE_PROTOCOL { }; typedef struct _USB_DEVICE_PROTOCOL USB_DEVICE_PROTOCOL; - -#endif //ifndef __USB_DEVICE_PROTOCOL_H__ diff --git a/EmbeddedPkg/Library/PrePiLib/PrePi.h b/EmbeddedPkg/Library/PrePiLib/PrePi.h index a00c946512..17b49ba572 100644 --- a/EmbeddedPkg/Library/PrePiLib/PrePi.h +++ b/EmbeddedPkg/Library/PrePiLib/PrePi.h @@ -7,8 +7,7 @@ **/ -#ifndef _PI_PEI_H_ -#define _PI_PEI_H_ +#pragma once #include @@ -36,5 +35,3 @@ // #define GET_GUID_HOB_DATA(GuidHob) ((VOID *) (((UINT8 *) &((GuidHob)->Name)) + sizeof (EFI_GUID))) #define GET_GUID_HOB_DATA_SIZE(GuidHob) (((GuidHob)->Header).HobLength - sizeof (EFI_HOB_GUID_TYPE)) - -#endif diff --git a/EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtbLoaderLib.h b/EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtbLoaderLib.h index ce0fca2c32..c99b4036e2 100644 --- a/EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtbLoaderLib.h +++ b/EmbeddedPkg/Test/Mock/Include/GoogleTest/Library/MockDtPlatformDtbLoaderLib.h @@ -6,8 +6,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent **/ -#ifndef MOCK_DT_PLATFORM_DTB_LOADER_LIB_H_ -#define MOCK_DT_PLATFORM_DTB_LOADER_LIB_H_ +#pragma once #include #include @@ -27,5 +26,3 @@ struct MockDtPlatformDtbLoaderLib { OUT UINTN *DtbSize) ); }; - -#endif diff --git a/EmbeddedPkg/Universal/MmcDxe/Mmc.h b/EmbeddedPkg/Universal/MmcDxe/Mmc.h index 23cabb7cf5..36939f1526 100644 --- a/EmbeddedPkg/Universal/MmcDxe/Mmc.h +++ b/EmbeddedPkg/Universal/MmcDxe/Mmc.h @@ -7,8 +7,7 @@ **/ -#ifndef __MMC_H -#define __MMC_H +#pragma once #include @@ -518,5 +517,3 @@ VOID PrintCID ( IN UINT32 *Cid ); - -#endif