Skip to content

Commit

Permalink
MdePkg: Check if compiler has __has_builtin before trying to use it
Browse files Browse the repository at this point in the history
When building AArch64 code, cpp gets run with the `-undef` flag which on
Fedora 40 with gcc version 14.1.1 20240607 (Red Hat 14.1.1-5) causes
__has_builtin to be undefined. When running the check for
__builtin_unreachable in Base.h it causes an error
"missing binary operator before token "("".

Check that we have __has_builtin before trying to use it.

Signed-off-by: Rebecca Cran <[email protected]>
  • Loading branch information
bexcran authored and mergify[bot] committed Jun 20, 2024
1 parent 95e220e commit 57a890f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion MdePkg/Include/Base.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
/// up to the compiler to remove any code past that point.
///
#define UNREACHABLE() __builtin_unreachable ()
#elif defined (__has_feature)
#elif defined (__has_builtin) && defined (__has_feature)
#if __has_builtin (__builtin_unreachable)
///
/// Signal compilers and analyzers that this call is not reachable. It is
Expand Down

0 comments on commit 57a890f

Please sign in to comment.