From: Tomohiro Kusumi Date: Tue, 21 Apr 2020 19:17:12 +0000 (+0900) Subject: json: Fix compile error on RHEL6 X-Git-Tag: fio-3.20~25^2 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=60b49c7cfdb3b92c94fd927d6a72a0f6abd9a8ec;p=fio.git json: Fix compile error on RHEL6 eb2f29b7fd("Make the JSON code easier to analyze") doesn't compile on RHEL6 using gcc4.x. Using "{.object = val,}," for an union field seems to fix the issue, but just use "arg.object = val;" instead as this is guaranteed to compile on supported platforms. -- CC gettime.o In file included from stat.h:7, from thread_options.h:7, from fio.h:18, from gettime.c:7: json.h: In function 'json_object_add_value_object': json.h:95: error: unknown field 'object' specified in initializer json.h:95: warning: missing braces around initializer json.h:95: warning: (near initialization for 'arg.') json.h:95: warning: initialization makes integer from pointer without a cast make: *** [gettime.o] Error 1 Signed-off-by: Tomohiro Kusumi --- diff --git a/json.h b/json.h index b2bb457e..1544ed76 100644 --- a/json.h +++ b/json.h @@ -92,9 +92,9 @@ static inline int json_object_add_value_object(struct json_object *obj, { struct json_value arg = { .type = JSON_TYPE_OBJECT, - .object = val, }; + arg.object = val; return json_object_add_value_type(obj, name, &arg); }