mirror of
https://github.com/ipxe/ipxe
synced 2025-12-25 17:12:40 +03:00
[efi] Disable static assertions in EFI headers on non-EFI platforms
The EDK2 headers may be included even in builds for non-EFI platforms.
Commits such as 9de6c45 ("[arm] Use -fno-short-enums for all 32-bit
ARM builds") have so far ensured that the compile-time checks within
the EDK2 headers will pass even when building for a non-EFI platform.
As a more general solution, temporarily disable static assertions
while including UefiBaseType.h if building on a non-EFI platform.
This avoids the need to modify the ABI on other platforms.
Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
@@ -43,10 +43,19 @@ FILE_LICENCE ( GPL2_OR_LATER );
|
|||||||
* checking somewhat useless. Work around this bizarre sabotage
|
* checking somewhat useless. Work around this bizarre sabotage
|
||||||
* attempt by redefining EFI_HANDLE as a pointer to an anonymous
|
* attempt by redefining EFI_HANDLE as a pointer to an anonymous
|
||||||
* structure.
|
* structure.
|
||||||
|
*
|
||||||
|
* EFI headers perform some ABI validation checks via _Static_assert()
|
||||||
|
* that may fail when EFI headers are included on a non-EFI platform.
|
||||||
|
* Temporarily disable static assertions to allow these headers to be
|
||||||
|
* included.
|
||||||
*/
|
*/
|
||||||
#define EFI_HANDLE STUPID_EFI_HANDLE
|
#define EFI_HANDLE STUPID_EFI_HANDLE
|
||||||
|
#ifndef PLATFORM_efi
|
||||||
|
#define _Static_assert(expr, msg)
|
||||||
|
#endif
|
||||||
#include <ipxe/efi/Uefi/UefiBaseType.h>
|
#include <ipxe/efi/Uefi/UefiBaseType.h>
|
||||||
#undef EFI_HANDLE
|
#undef EFI_HANDLE
|
||||||
|
#undef _Static_assert
|
||||||
typedef struct {} *EFI_HANDLE;
|
typedef struct {} *EFI_HANDLE;
|
||||||
|
|
||||||
/* Include the top-level EFI header files */
|
/* Include the top-level EFI header files */
|
||||||
|
|||||||
Reference in New Issue
Block a user