mirror of
https://github.com/tianocore/edk2
synced 2026-08-27 00:23:19 -04:00
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>
82 lines
2.2 KiB
C
82 lines
2.2 KiB
C
/** @file
|
|
GUIDs for HII package list installed by Shell libraries.
|
|
|
|
Copyright (c) 2011 - 2016, Intel Corporation. All rights reserved.<BR>
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
|
|
**/
|
|
|
|
#pragma once
|
|
|
|
#define HANDLE_PARSING_HII_GUID \
|
|
{ \
|
|
0xb8969637, 0x81de, 0x43af, { 0xbc, 0x9a, 0x24, 0xd9, 0x89, 0x13, 0xf2, 0xf6 } \
|
|
}
|
|
|
|
#define SHELL_DEBUG1_HII_GUID \
|
|
{ \
|
|
0x25f200aa, 0xd3cb, 0x470a, { 0xbf, 0x51, 0xe7, 0xd1, 0x62, 0xd2, 0x2e, 0x6f } \
|
|
}
|
|
|
|
#define SHELL_DRIVER1_HII_GUID \
|
|
{ \
|
|
0xaf0b742, 0x63ec, 0x45bd, {0x8d, 0xb6, 0x71, 0xad, 0x7f, 0x2f, 0xe8, 0xe8} \
|
|
}
|
|
|
|
#define SHELL_INSTALL1_HII_GUID \
|
|
{ \
|
|
0x7d574d54, 0xd364, 0x4d4a, { 0x95, 0xe3, 0x49, 0x45, 0xdb, 0x7a, 0xd3, 0xee } \
|
|
}
|
|
|
|
#define SHELL_LEVEL1_HII_GUID \
|
|
{ \
|
|
0xdec5daa4, 0x6781, 0x4820, { 0x9c, 0x63, 0xa7, 0xb0, 0xe4, 0xf1, 0xdb, 0x31 } \
|
|
}
|
|
|
|
#define SHELL_LEVEL2_HII_GUID \
|
|
{ \
|
|
0xf95a7ccc, 0x4c55, 0x4426, { 0xa7, 0xb4, 0xdc, 0x89, 0x61, 0x95, 0xb, 0xae } \
|
|
}
|
|
|
|
#define SHELL_LEVEL3_HII_GUID \
|
|
{ \
|
|
0x4344558d, 0x4ef9, 0x4725, { 0xb1, 0xe4, 0x33, 0x76, 0xe8, 0xd6, 0x97, 0x4f } \
|
|
}
|
|
|
|
#define SHELL_NETWORK1_HII_GUID \
|
|
{ \
|
|
0xf3d301bb, 0xf4a5, 0x45a8, { 0xb0, 0xb7, 0xfa, 0x99, 0x9c, 0x62, 0x37, 0xae } \
|
|
}
|
|
|
|
#define SHELL_NETWORK2_HII_GUID \
|
|
{ \
|
|
0x174b2b5, 0xf505, 0x4b12, { 0xaa, 0x60, 0x59, 0xdf, 0xf8, 0xd6, 0xea, 0x37 } \
|
|
}
|
|
|
|
#define SHELL_TFTP_HII_GUID \
|
|
{ \
|
|
0x738a9314, 0x82c1, 0x4592, { 0x8f, 0xf7, 0xc1, 0xbd, 0xf1, 0xb2, 0x0e, 0xd4 } \
|
|
}
|
|
|
|
#define SHELL_HTTP_HII_GUID \
|
|
{ \
|
|
0x390f84b3, 0x221c, 0x4d9e, { 0xb5, 0x06, 0x6d, 0xb9, 0x42, 0x3e, 0x0a, 0x7e } \
|
|
}
|
|
|
|
#define SHELL_BCFG_HII_GUID \
|
|
{ \
|
|
0x5f5f605d, 0x1583, 0x4a2d, {0xa6, 0xb2, 0xeb, 0x12, 0xda, 0xb4, 0xa2, 0xb6 } \
|
|
}
|
|
|
|
extern EFI_GUID gHandleParsingHiiGuid;
|
|
extern EFI_GUID gShellDebug1HiiGuid;
|
|
extern EFI_GUID gShellDriver1HiiGuid;
|
|
extern EFI_GUID gShellInstall1HiiGuid;
|
|
extern EFI_GUID gShellLevel1HiiGuid;
|
|
extern EFI_GUID gShellLevel2HiiGuid;
|
|
extern EFI_GUID gShellLevel3HiiGuid;
|
|
extern EFI_GUID gShellNetwork1HiiGuid;
|
|
extern EFI_GUID gShellNetwork2HiiGuid;
|
|
extern EFI_GUID gShellTftpHiiGuid;
|
|
extern EFI_GUID gShellHttpHiiGuid;
|
|
extern EFI_GUID gShellBcfgHiiGuid;
|