You've already forked edk2-upstream
mirror of
https://github.com/Dasharo/edk2-upstream.git
synced 2026-03-06 15:03:57 -08: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>
46 lines
1.8 KiB
C
46 lines
1.8 KiB
C
/** @file
|
|
Provides services to display completion progress when processing a
|
|
firmware update that updates the firmware image in a firmware device.
|
|
A platform may provide its own instance of this library class to custoimize
|
|
how a user is informed of completion progress.
|
|
|
|
Copyright (c) 2016, Microsoft Corporation
|
|
Copyright (c) 2018, Intel Corporation. All rights reserved.<BR>
|
|
|
|
All rights reserved.
|
|
SPDX-License-Identifier: BSD-2-Clause-Patent
|
|
|
|
**/
|
|
|
|
#pragma once
|
|
|
|
#include <Protocol/GraphicsOutput.h>
|
|
|
|
/**
|
|
Indicates the current completion progress of a firmware update.
|
|
|
|
@param[in] Completion A value between 0 and 100 indicating the current
|
|
completion progress of a firmware update. This
|
|
value must the the same or higher than previous
|
|
calls to this service. The first call of 0 or a
|
|
value of 0 after reaching a value of 100 resets
|
|
the progress indicator to 0.
|
|
@param[in] Color Color of the progress indicator. Only used when
|
|
Completion is 0 to set the color of the progress
|
|
indicator. If Color is NULL, then the default color
|
|
is used.
|
|
|
|
@retval EFI_SUCCESS Progress displayed successfully.
|
|
@retval EFI_INVALID_PARAMETER Completion is not in range 0..100.
|
|
@retval EFI_INVALID_PARAMETER Completion is less than Completion value from
|
|
a previous call to this service.
|
|
@retval EFI_NOT_READY The device used to indicate progress is not
|
|
available.
|
|
**/
|
|
EFI_STATUS
|
|
EFIAPI
|
|
DisplayUpdateProgress (
|
|
IN UINTN Completion,
|
|
IN EFI_GRAPHICS_OUTPUT_BLT_PIXEL_UNION *Color OPTIONAL
|
|
);
|