]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[efi] Allow compiler to perform type checks on EFI_HANDLE
authorMichael Brown <mcb30@ipxe.org>
Thu, 31 Jul 2014 11:17:59 +0000 (12:17 +0100)
committerMichael Brown <mcb30@ipxe.org>
Thu, 31 Jul 2014 11:17:59 +0000 (12:17 +0100)
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>
src/include/ipxe/efi/efi.h

index 0e029632ae85e05e1d151729f6ea385279701442..a1ba4966edac8490d4b31717a8b9ab3f94113378 100644 (file)
@@ -41,6 +41,16 @@ FILE_LICENCE ( GPL2_OR_LATER );
 #define EFIAPI __attribute__((cdecl,regparm(0)))
 #endif
 
+/* EFI headers define EFI_HANDLE as a void pointer, which renders type
+ * checking somewhat useless.  Work around this bizarre sabotage
+ * attempt by redefining EFI_HANDLE as a pointer to an anonymous
+ * structure.
+ */
+#define EFI_HANDLE STUPID_EFI_HANDLE
+#include <ipxe/efi/Uefi/UefiBaseType.h>
+#undef EFI_HANDLE
+typedef struct {} *EFI_HANDLE;
+
 /* Include the top-level EFI header files */
 #include <ipxe/efi/Uefi.h>
 #include <ipxe/efi/PiDxe.h>