[Replicant] [libsamsung-ipc] [PATCH 06/26] tools: nv_data_imei: get rid of missing initializer warning

Denis 'GNUtoo' Carikli GNUtoo at cyberdimension.org
Mon Mar 28 20:20:20 UTC 2022


Without that fix, we have the following warnings on Replicant 6.0:
    hardware/replicant/libsamsung-ipc/tools/nv_data-imei.c:245:2:
    warning: missing initializer for field 'option' of 'struct
    command_option' [-Wmissing-field-initializers]
      { /* Sentinel */ },
      ^
    In file included from
    hardware/replicant/libsamsung-ipc/tools/nv_data-imei.c:39:0:
    hardware/replicant/libsamsung-ipc/tools/nv_data-imei.h:65:10:
    note: 'option' declared here
    uint8_t option;
            ^
    hardware/replicant/libsamsung-ipc/tools/nv_data-imei.c:277:2:
    warning: missing initializer for field 'name' of 'struct command'
    [-Wmissing-field-initializers]
    { /* Sentinel */ },
      ^
    In file included from
    hardware/replicant/libsamsung-ipc/tools/nv_data-imei.c:39:0:
    hardware/replicant/libsamsung-ipc/tools/nv_data-imei.h:57:14:
    note: 'name' declared here
    const char *name;
                ^

Note that even if the code isn't valid C17 code, the warning is
harmless since the arrays of struct is declared outside functions
(static storage duration), so the "Sentinel" will be filled with zeros
anyway.

Signed-off-by: Denis 'GNUtoo' Carikli <GNUtoo at cyberdimension.org>
---
 tools/nv_data-imei.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/nv_data-imei.c b/tools/nv_data-imei.c
index c5301b7..63b1cb8 100644
--- a/tools/nv_data-imei.c
+++ b/tools/nv_data-imei.c
@@ -242,7 +242,7 @@ static struct command_option commands_options[] = {
 		"--imei=355921041234567",
 		get_imei,
 	},
-	{ /* Sentinel */ },
+	{ 0 },
 };
 
 static struct command commands[] = {
@@ -274,7 +274,7 @@ static struct command commands[] = {
 		OPTION_FILE|OPTION_IMEI,
 		bruteforce_imei_offset,
 	},
-	{ /* Sentinel */ },
+	{ 0 },
 };
 
 #if DEBUG
-- 
2.35.1



More information about the Replicant mailing list