On Sat, Jun 26, 2021 at 1:17 AM Philippe Mathieu-Daudé <f4...@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é <f4...@amsat.org> > > wrote: > >> > >> Signed-off-by: Philippe Mathieu-Daudé <f4...@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 > > "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