]> git.ipfire.org Git - thirdparty/ipxe.git/commitdiff
[efi] Use standard va_args macros instead of VA_START() etc
authorMichael Brown <mcb30@ipxe.org>
Sun, 15 Sep 2024 01:01:46 +0000 (02:01 +0100)
committerMichael Brown <mcb30@ipxe.org>
Sun, 15 Sep 2024 09:01:35 +0000 (10:01 +0100)
The EDK2 header macros VA_START(), VA_ARG() etc produce build errors
on some CPU architectures (notably on 32-bit RISC-V, which is not yet
supported by EDK2).

Fix by using the standard variable argument list macros.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
src/interface/efi/efi_wrap.c

index 5d5d2caeea82e4fa068b0d31255d85a04214eba6..c2fab66472a9ed45c36ee83bcf3a51e7705ffbb2 100644 (file)
@@ -1059,7 +1059,7 @@ efi_install_multiple_protocol_interfaces_wrapper ( EFI_HANDLE *handle, ... ) {
        void *retaddr = __builtin_return_address ( 0 );
        EFI_GUID *protocol[ MAX_WRAP_MULTI + 1 ];
        VOID *interface[MAX_WRAP_MULTI];
-       VA_LIST ap;
+       va_list ap;
        unsigned int i;
        EFI_STATUS efirc;
 
@@ -1067,20 +1067,20 @@ efi_install_multiple_protocol_interfaces_wrapper ( EFI_HANDLE *handle, ... ) {
               efi_handle_name ( *handle ) );
        memset ( protocol, 0, sizeof ( protocol ) );
        memset ( interface, 0, sizeof ( interface ) );
-       VA_START ( ap, handle );
-       for ( i = 0 ; ( protocol[i] = VA_ARG ( ap, EFI_GUID * ) ) ; i++ ) {
+       va_start ( ap, handle );
+       for ( i = 0 ; ( protocol[i] = va_arg ( ap, EFI_GUID * ) ) ; i++ ) {
                if ( i == MAX_WRAP_MULTI ) {
-                       VA_END ( ap );
+                       va_end ( ap );
                        efirc = EFI_OUT_OF_RESOURCES;
                        DBGC ( colour, "<FATAL: too many arguments> ) = %s "
                               "-> %p\n", efi_status ( efirc ), retaddr );
                        return efirc;
                }
-               interface[i] = VA_ARG ( ap, VOID * );
+               interface[i] = va_arg ( ap, VOID * );
                DBGC ( colour, ", %s, %p",
                       efi_guid_ntoa ( protocol[i] ), interface[i] );
        }
-       VA_END ( ap );
+       va_end ( ap );
        DBGC ( colour, " ) " );
        efirc = bs->InstallMultipleProtocolInterfaces ( handle,
                protocol[0], interface[0], protocol[1], interface[1],
@@ -1109,7 +1109,7 @@ efi_uninstall_multiple_protocol_interfaces_wrapper ( EFI_HANDLE handle, ... ) {
        void *retaddr = __builtin_return_address ( 0 );
        EFI_GUID *protocol[ MAX_WRAP_MULTI  + 1 ];
        VOID *interface[MAX_WRAP_MULTI];
-       VA_LIST ap;
+       va_list ap;
        unsigned int i;
        EFI_STATUS efirc;
 
@@ -1117,20 +1117,20 @@ efi_uninstall_multiple_protocol_interfaces_wrapper ( EFI_HANDLE handle, ... ) {
               efi_handle_name ( handle ) );
        memset ( protocol, 0, sizeof ( protocol ) );
        memset ( interface, 0, sizeof ( interface ) );
-       VA_START ( ap, handle );
-       for ( i = 0 ; ( protocol[i] = VA_ARG ( ap, EFI_GUID * ) ) ; i++ ) {
+       va_start ( ap, handle );
+       for ( i = 0 ; ( protocol[i] = va_arg ( ap, EFI_GUID * ) ) ; i++ ) {
                if ( i == MAX_WRAP_MULTI ) {
-                       VA_END ( ap );
+                       va_end ( ap );
                        efirc = EFI_OUT_OF_RESOURCES;
                        DBGC ( colour, "<FATAL: too many arguments> ) = %s "
                               "-> %p\n", efi_status ( efirc ), retaddr );
                        return efirc;
                }
-               interface[i] = VA_ARG ( ap, VOID * );
+               interface[i] = va_arg ( ap, VOID * );
                DBGC ( colour, ", %s, %p",
                       efi_guid_ntoa ( protocol[i] ), interface[i] );
        }
-       VA_END ( ap );
+       va_end ( ap );
        DBGC ( colour, " ) " );
        efirc = bs->UninstallMultipleProtocolInterfaces ( handle,
                protocol[0], interface[0], protocol[1], interface[1],