edk2/ArmVirtPkg
Michael Kubacki 4ab0b67f92 ArmVirtPkg: 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 <michael.kubacki@microsoft.com>
2026-02-23 21:01:28 +00:00
..
CloudHvAcpiPlatformDxe ArmVirtPkg: Update code to be more C11 compliant by using __func__ 2023-04-10 14:19:57 +00:00
CloudHvPlatformHasAcpiDtDxe ArmVirtPkg: can't find gUefiOvmfPkgTokenSpaceGuid 2023-03-28 16:27:06 +00:00
Include ArmVirtPkg: Replace include guards with #pragma once 2026-02-23 21:01:28 +00:00
KvmtoolCfgMgrDxe ArmVirtPkg: Replace include guards with #pragma once 2026-02-23 21:01:28 +00:00
KvmtoolPlatformDxe ArmVirtPkg: Dispatch variable service if variable emulation is enabled 2023-05-29 15:14:00 +00:00
Library ArmVirtPkg: Replace include guards with #pragma once 2026-02-23 21:01:28 +00:00
MemoryInitPei ArmVirtPkg/MemoryInitPei: Remove Non-RT Types from Mem Type Info HOB 2024-11-11 16:45:29 +00:00
PlatformCI ArmVirtPkg: Update wiki links 2026-02-10 05:44:46 +00:00
PrePi ArmVirtPkg: Replace include guards with #pragma once 2026-02-23 21:01:28 +00:00
XenAcpiPlatformDxe ArmVirtPkg/XenAcpiPlatformDxe: Install FACS table from DT 2024-02-25 18:52:27 +00:00
XenioFdtDxe ArmVirtPkg: fix boot under Xen 2025-05-29 12:36:48 +00:00
XenPlatformHasAcpiDtDxe ArmVirtPkg: Apply uncrustify changes 2021-12-07 17:24:28 +00:00
ArmVirt.dsc.inc ArmVirtPkg: Add CLANGPDB Support 2026-01-15 17:10:46 +00:00
ArmVirtCloudHv.dsc ArmVirtPkg: Drop ARM Virtual Platforms 2025-09-09 18:49:32 +00:00
ArmVirtCloudHv.fdf ArmVirtPkg: Drop ARM Virtual Platforms 2025-09-09 18:49:32 +00:00
ArmVirtKvmTool.dsc ArmVirtPkg: Drop ARM Virtual Platforms 2025-09-09 18:49:32 +00:00
ArmVirtKvmTool.fdf ArmVirtPkg: Drop ARM Virtual Platforms 2025-09-09 18:49:32 +00:00
ArmVirtPkg.ci.yaml ArmPkg,ArmPlatformPkg,ArmVirtPkg: Add UefiCpuPkg to AcceptableDependencies 2025-07-04 22:39:10 +00:00
ArmVirtPkg.dec ArmVirtPkg: Remove DXE_SAL_DRIVER 2025-10-30 10:00:32 +00:00
ArmVirtQemu.dsc ArmVirtPkg: use MemDebugLogPeiCoreLib for PEIMs 2026-01-30 15:17:50 +00:00
ArmVirtQemu.fdf ArmVirtPkg: Drop ARM Virtual Platforms 2025-09-09 18:49:32 +00:00
ArmVirtQemuFvMain.fdf.inc OvmfPkg,ArmVirtPkg,NetworkPkg: Fix build with -D NETWORK_ENABLE=0 2025-11-21 12:08:00 +01:00
ArmVirtQemuKernel.dsc OvmfPkg,ArmVirtPkg,NetworkPkg: Fix build with -D NETWORK_ENABLE=0 2025-11-21 12:08:00 +01:00
ArmVirtQemuKernel.fdf ArmVirtPkg: Drop ARM Virtual Platforms 2025-09-09 18:49:32 +00:00
ArmVirtRules.fdf.inc ArmVirtPkg: add FDF rule for self-relocating PrePi 2020-06-12 22:17:46 +00:00
ArmVirtStackCookies.dsc.inc ArmVirtPkg: Drop ARM Virtual Platforms 2025-09-09 18:49:32 +00:00
ArmVirtXen.dsc ArmVirtPkg: Drop ARM Virtual Platforms 2025-09-09 18:49:32 +00:00
ArmVirtXen.fdf ArmVirtPkg: Drop ARM Virtual Platforms 2025-09-09 18:49:32 +00:00
VarStore.fdf.inc ArmVirtPkg: Enable the non-hardcode version FdtNorFlashQemuLib 2024-06-04 22:51:09 +00:00