[ipxe-devel] [PATCH] [efi] Simplify diagnostic for NULL handle
Bruce Rogers
brogers at suse.com
Fri Jan 25 18:30:01 UTC 2019
>>> On 1/25/2019 at 10:26 AM, Michael Brown <mcb30 at ipxe.org> wrote:
> On 25/01/2019 16:53, Bruce Rogers wrote:
>> Compiling with GCC 9 now warns as follows:
>> interface/efi/efi_debug.c:334:3: error: ‘%s’ directive argument is null
> [-Werror=format-overflow=]
>> 334 | printf ( "HANDLE %s could not retrieve protocols\n",
>> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> 335 | efi_handle_name ( handle ) );
>> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> cc1: all warnings being treated as errors
>>
>> Simplify this diagnostic by simply indicating a <NULL> has been
>> passed as a handle.
>
> I'd prefer not to have to work around that on an instance-by-instance
> basis; we explicitly allow NULL as a value for a %s format specifier,
> and there are multiple other code paths that will do this.
>
Understandable. This one seemed to be the only one noticed by the compiler
however, when I build with a simple make -C src.
> Is there a way to inform GCC 9 that NULL is allowed as a %s value?
>
I don't know if there is. There is a -Wnonnull, but we probably don't
want to do that.
> If not, then does marking efi_handle_name() as noinline fix the warning?
>
Yes, that does indeed avoid this warning, and the object size changes only
slightly. Do you want me to send a patch for that?
Bruce
More information about the ipxe-devel
mailing list