Przeglądaj źródła

[efi] Allow compiler to perform type checks on EFI_HANDLE

The EFI headers define EFI_HANDLE as a void pointer, which renders
type checking on anything dealing with EFI handles somewhat useless.
Work around this bizarre sabotage attempt by redefining EFI_HANDLE as
a pointer to an anonymous structure.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
tags/v1.20.1
Michael Brown 9 lat temu
rodzic
commit
88bd71a27a
1 zmienionych plików z 10 dodań i 0 usunięć
  1. 10
    0
      src/include/ipxe/efi/efi.h

+ 10
- 0
src/include/ipxe/efi/efi.h Wyświetl plik

@@ -41,6 +41,16 @@ FILE_LICENCE ( GPL2_OR_LATER );
41 41
 #define EFIAPI __attribute__((cdecl,regparm(0)))
42 42
 #endif
43 43
 
44
+/* EFI headers define EFI_HANDLE as a void pointer, which renders type
45
+ * checking somewhat useless.  Work around this bizarre sabotage
46
+ * attempt by redefining EFI_HANDLE as a pointer to an anonymous
47
+ * structure.
48
+ */
49
+#define EFI_HANDLE STUPID_EFI_HANDLE
50
+#include <ipxe/efi/Uefi/UefiBaseType.h>
51
+#undef EFI_HANDLE
52
+typedef struct {} *EFI_HANDLE;
53
+
44 54
 /* Include the top-level EFI header files */
45 55
 #include <ipxe/efi/Uefi.h>
46 56
 #include <ipxe/efi/PiDxe.h>

Ładowanie…
Anuluj
Zapisz