diff mbox series

[3/3] hw/arm/nseries: Silent -Wmissing-field-initializers warning

Message ID 20221220142520.24094-4-philmd@linaro.org
State New
Headers show
Series hw/arm/nseries: Minor housekeeping | expand

Commit Message

Philippe Mathieu-Daudé Dec. 20, 2022, 2:25 p.m. UTC
Silent when compiling with -Wextra:

  ../hw/arm/nseries.c:1081:12: warning: missing field 'line' initializer [-Wmissing-field-initializers]
      { NULL }
             ^

Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
 hw/arm/nseries.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

Comments

Richard Henderson Dec. 21, 2022, 1:01 a.m. UTC | #1
On 12/20/22 06:25, Philippe Mathieu-Daudé wrote:
> Silent when compiling with -Wextra:
> 
>    ../hw/arm/nseries.c:1081:12: warning: missing field 'line' initializer [-Wmissing-field-initializers]
>        { NULL }
>               ^
> 
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
>   hw/arm/nseries.c | 10 ++++------
>   1 file changed, 4 insertions(+), 6 deletions(-)

Not a fan of this specific warning.


r~
Philippe Mathieu-Daudé Dec. 21, 2022, 7:16 a.m. UTC | #2
On 21/12/22 02:01, Richard Henderson wrote:
> On 12/20/22 06:25, Philippe Mathieu-Daudé wrote:
>> Silent when compiling with -Wextra:
>>
>>    ../hw/arm/nseries.c:1081:12: warning: missing field 'line' 
>> initializer [-Wmissing-field-initializers]
>>        { NULL }
>>               ^
>>
>> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
>> ---
>>   hw/arm/nseries.c | 10 ++++------
>>   1 file changed, 4 insertions(+), 6 deletions(-)
> 
> Not a fan of this specific warning.

Me neither, and I don't think we can enforce it on QEMU codebase.

However I find '{ /* end of list */ }' cleaner/clearer than assigning
the first field.
Richard Henderson Dec. 21, 2022, 5:12 p.m. UTC | #3
On 12/20/22 23:16, Philippe Mathieu-Daudé wrote:
> However I find '{ /* end of list */ }' cleaner/clearer than assigning
> the first field.

I agree with that, for those cases we don't already have a separate sentinal define.


r~
diff mbox series

Patch

diff --git a/hw/arm/nseries.c b/hw/arm/nseries.c
index 2ff29f52e2..c9df063a08 100644
--- a/hw/arm/nseries.c
+++ b/hw/arm/nseries.c
@@ -1078,7 +1078,7 @@  static const struct omap_gpiosw_info_s {
         "headphone", N8X0_HEADPHONE_GPIO,
         OMAP_GPIOSW_TYPE_CONNECTION | OMAP_GPIOSW_INVERTED,
     },
-    { NULL }
+    { /* end of list */ }
 }, n810_gpiosw_info[] = {
     {
         "gps_reset", N810_GPS_RESET_GPIO,
@@ -1099,7 +1099,7 @@  static const struct omap_gpiosw_info_s {
         "slide", N810_SLIDE_GPIO,
         OMAP_GPIOSW_TYPE_COVER | OMAP_GPIOSW_INVERTED,
     },
-    { NULL }
+    { /* end of list */ }
 };
 
 static const struct omap_partition_info_s {
@@ -1113,16 +1113,14 @@  static const struct omap_partition_info_s {
     { 0x00080000, 0x00200000, 0x0, "kernel" },
     { 0x00280000, 0x00200000, 0x3, "initfs" },
     { 0x00480000, 0x0fb80000, 0x3, "rootfs" },
-
-    { 0, 0, 0, NULL }
+    { /* end of list */ }
 }, n810_part_info[] = {
     { 0x00000000, 0x00020000, 0x3, "bootloader" },
     { 0x00020000, 0x00060000, 0x0, "config" },
     { 0x00080000, 0x00220000, 0x0, "kernel" },
     { 0x002a0000, 0x00400000, 0x0, "initfs" },
     { 0x006a0000, 0x0f960000, 0x0, "rootfs" },
-
-    { 0, 0, 0, NULL }
+    { /* end of list */ }
 };
 
 static const uint8_t n8x0_bd_addr[6] = { N8X0_BD_ADDR };