svn commit: r313166 - head/sys/boot/efi/libefi

Warner Losh imp at bsdimp.com
Fri Feb 3 16:49:28 UTC 2017


On Fri, Feb 3, 2017 at 9:47 AM, Ian Lepore <ian at freebsd.org> wrote:
> On Fri, 2017-02-03 at 16:39 +0000, Toomas Soome wrote:
>> Author: tsoome
>> Date: Fri Feb  3 16:39:10 2017
>> New Revision: 313166
>> URL: https://svnweb.freebsd.org/changeset/base/313166
>>
>> Log:
>>   loader: libefi/env.c warnings in arm build
>>
>>   The arm build has revealed some of the warnings, the fix for CHAR16
>>   warning is to switch the warning off for env.c (same as for
>> efinet.c).
>>
>
> How is disabling the warning instead of just fixing it the right thing
> to do?  I think disabling a printf format warning is never the right
> thing to do, it just turns a compile warning into a runtime failure.

Because clang's understanding of %S in the bootloader doesn't match
how it's actually used and there's no casting that will fix that.

Warner

> -- Ian
>
>>   For error code we need to use macro.
>>
>>   Reported by:        gjb
>>   Reviewed by:        imp
>>   Approved by:        imp (mentor)
>>   Differential Revision:      https://reviews.freebsd.org/D9422
>>
>> Modified:
>>   head/sys/boot/efi/libefi/Makefile
>>   head/sys/boot/efi/libefi/env.c
>>
>> Modified: head/sys/boot/efi/libefi/Makefile
>> =====================================================================
>> =========
>> --- head/sys/boot/efi/libefi/Makefile Fri Feb  3 16:36:14 2017
>>       (r313165)
>> +++ head/sys/boot/efi/libefi/Makefile Fri Feb  3 16:39:10 2017
>>       (r313166)
>> @@ -26,6 +26,7 @@ SRCS+=      time_event.c
>>  # of a short. There's no good cast to use here so just ignore the
>>  # warnings for now.
>>  CWARNFLAGS.efinet.c+=        -Wno-format
>> +CWARNFLAGS.env.c+=   -Wno-format
>>
>>  .if ${MACHINE_CPUARCH} == "aarch64"
>>  CFLAGS+=     -msoft-float -mgeneral-regs-only
>>
>> Modified: head/sys/boot/efi/libefi/env.c
>> =====================================================================
>> =========
>> --- head/sys/boot/efi/libefi/env.c    Fri Feb  3 16:36:14 2017
>> (r313165)
>> +++ head/sys/boot/efi/libefi/env.c    Fri Feb  3 16:39:10 2017
>> (r313166)
>> @@ -94,14 +94,16 @@ efi_print_var(CHAR16 *varnamearg, EFI_GU
>>       status = RS->GetVariable(varnamearg, matchguid, &attr,
>>           &datasz, NULL);
>>       if (status != EFI_BUFFER_TOO_SMALL) {
>> -             printf("Can't get the variable: error %#lx\n",
>> status);
>> +             printf("Can't get the variable: error %#lx\n",
>> +                 EFI_ERROR_CODE(status));
>>               return (CMD_ERROR);
>>       }
>>       data = malloc(datasz);
>>       status = RS->GetVariable(varnamearg, matchguid, &attr,
>>           &datasz, data);
>>       if (status != EFI_SUCCESS) {
>> -             printf("Can't get the variable: error %#lx\n",
>> status);
>> +             printf("Can't get the variable: error %#lx\n",
>> +                 EFI_ERROR_CODE(status));
>>               return (CMD_ERROR);
>>       }
>>       uuid_to_string((uuid_t *)matchguid, &str, &uuid_status);
>>
>


More information about the svn-src-head mailing list