From 4fc268defe0738c471fea6de5b33d6e356aa7082 Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Wed, 23 Sep 2020 15:21:49 +1000 Subject: build: avoid a spurious compiler warning When compiled with -Os and arm-linux-musleabihf-gcc (crosstool-NG 1.24.0.92-e2957c3) 9.2.0 Signed-off-by: Steve Bennett --- jim-json.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'jim-json.c') diff --git a/jim-json.c b/jim-json.c index 1b3869c..aeeb7cf 100644 --- a/jim-json.c +++ b/jim-json.c @@ -141,7 +141,10 @@ json_decode_dump_container(Jim_Interp *interp, struct json_state *state) json_schema_t container_type = JSON_OBJ; /* JSON_LIST, JSON_MIXED or JSON_OBJ */ if (state->schemaObj) { - json_schema_t list_type; + /* Don't strictly need to initialise this, but some compilers can't figure out it is always + * assigned a value below. + */ + json_schema_t list_type = JSON_STR; /* Figure out the type to use for the container */ if (type == JSMN_ARRAY) { /* If every element of the array is of the same primitive schema type (str, bool or num), -- cgit v1.1