qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [RFC PATCH 06/10] hw/sd: Add sd_cmd_unimplemented() handler


From: Philippe Mathieu-Daudé
Subject: Re: [RFC PATCH 06/10] hw/sd: Add sd_cmd_unimplemented() handler
Date: Sat, 26 Jun 2021 11:43:32 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0

On 6/26/21 5:31 AM, Bin Meng wrote:
> On Sat, Jun 26, 2021 at 1:17 AM Philippe Mathieu-Daudé <f4bug@amsat.org> 
> wrote:
>>
>> On 6/25/21 3:49 PM, Bin Meng wrote:
>>> On Thu, Jun 24, 2021 at 10:28 PM Philippe Mathieu-Daudé <f4bug@amsat.org> 
>>> wrote:
>>>>
>>>> Signed-off-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
>>>> ---
>>>>  hw/sd/sd.c | 21 ++++++++++++---------
>>>>  1 file changed, 12 insertions(+), 9 deletions(-)
>>
>>>>      qemu_log_mask(LOG_GUEST_ERROR, "SD: ACMD%i in a wrong state\n", 
>>>> req.cmd);
>>>> @@ -2096,6 +2096,9 @@ static const SDProto sd_proto_spi = {
>>>>          [26]        = sd_cmd_illegal,
>>>>          [52 ... 54] = sd_cmd_illegal,
>>>>      },
>>>> +    .cmd = {
>>>> +        [6]         = sd_cmd_unimplemented,
>>>> +    },
>>>>  };
>>>
>>> Does this compile?
>>
>> Yes.
>>
>>> Or is this another GCC extension to C?
>>
>> I haven't checked when this was introduced, but QEMU uses it since
>> quite some time now.
>>
>> Apparently this is:
>> https://gcc.gnu.org/onlinedocs/gcc/Designated-Inits.html
> 
> Yep, I know designated initialization of a C array, but I don't know
> gcc does not complain two .cmd here

IIUC GCC would warn if we were using -Woverride-init (but we are not):

   -Woverride-init (C and Objective-C only)

       Warn if an initialized field without side effects
       is overridden when using designated initializers.

>>  "In ISO C99 you can give the elements in any order, specifying
>>   the array indices or structure field names they apply to, and
>>   GNU C allows this as an extension in C90 mode as well."
>>
>>> But I think you wanted to say .acmd = ?
>>
>> Oops!
>>
>> Thanks for the review,
> 
> Regards,
> Bin
> 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]