tianocore / edk2

EDK II
https://github.com/tianocore/tianocore.github.io/wiki/EDK-II
Other
4.58k stars 2.47k forks source link

MdePkg: Check if compiler has __has_builtin before trying to use it #5781

Closed bcran closed 3 months ago

bcran commented 3 months ago

Description

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.

How This Was Tested

Built code on Fedora Server 40 before and after this change and verified the build now succeeds.

Integration Instructions

N/A

lgao4 commented 3 months ago

The change is good. Please first check what CI issue here.