From: Roger Pau Monne <roger.pau@citrix.com>
To: xen-devel@lists.xenproject.org
Cc: Wei Liu <wei.liu2@citrix.com>,
Ian Jackson <ian.jackson@eu.citrix.com>,
Roger Pau Monne <roger.pau@citrix.com>
Subject: [PATCH v3 for-4.7 12/16] libxl: add explicit casts from yajl_gen_status to yajl_status
Date: Wed, 27 Apr 2016 13:11:50 +0200 [thread overview]
Message-ID: <1461755514-23754-13-git-send-email-roger.pau@citrix.com> (raw)
In-Reply-To: <1461755514-23754-1-git-send-email-roger.pau@citrix.com>
Or else clang complains with:
implicit conversion from enumeration type 'yajl_gen_status' to different
enumeration type 'yajl_status' [-Werror,-Wenum-conversion]
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
tools/libxl/libxl_json.c | 29 ++++++++++++++++++-----------
1 file changed, 18 insertions(+), 11 deletions(-)
diff --git a/tools/libxl/libxl_json.c b/tools/libxl/libxl_json.c
index 3b695dd..6bb0695 100644
--- a/tools/libxl/libxl_json.c
+++ b/tools/libxl/libxl_json.c
@@ -617,42 +617,48 @@ yajl_status libxl__json_object_to_yajl_gen(libxl__gc *gc,
int idx = 0;
yajl_status rc;
+#define CONVERT_YAJL_GEN_TO_STATUS(gen) \
+ ((gen) == yajl_gen_status_ok ? yajl_status_ok : yajl_status_error);
+
switch (obj->type) {
case JSON_NULL:
- return yajl_gen_null(hand);
+ return CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_null(hand));
case JSON_BOOL:
- return yajl_gen_bool(hand, obj->u.b);
+ return CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_bool(hand, obj->u.b));
case JSON_INTEGER:
- return yajl_gen_integer(hand, obj->u.i);
+ return CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_integer(hand, obj->u.i));
case JSON_DOUBLE:
- return yajl_gen_double(hand, obj->u.d);
+ return CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_double(hand, obj->u.d));
case JSON_NUMBER:
- return yajl_gen_number(hand, obj->u.string, strlen(obj->u.string));
+ return CONVERT_YAJL_GEN_TO_STATUS(
+ yajl_gen_number(hand, obj->u.string, strlen(obj->u.string)));
case JSON_STRING:
- return libxl__yajl_gen_asciiz(hand, obj->u.string);
+ return CONVERT_YAJL_GEN_TO_STATUS(
+ libxl__yajl_gen_asciiz(hand, obj->u.string));
case JSON_MAP: {
libxl__json_map_node *node = NULL;
- rc = yajl_gen_map_open(hand);
+ rc = CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_map_open(hand));
if (rc != yajl_status_ok)
return rc;
for (idx = 0; idx < obj->u.map->count; idx++) {
if (flexarray_get(obj->u.map, idx, (void**)&node) != 0)
break;
- rc = libxl__yajl_gen_asciiz(hand, node->map_key);
+ rc = CONVERT_YAJL_GEN_TO_STATUS(
+ libxl__yajl_gen_asciiz(hand, node->map_key));
if (rc != yajl_status_ok)
return rc;
rc = libxl__json_object_to_yajl_gen(gc, hand, node->obj);
if (rc != yajl_status_ok)
return rc;
}
- return yajl_gen_map_close(hand);
+ return CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_map_close(hand));
}
case JSON_ARRAY: {
libxl__json_object *node = NULL;
- rc = yajl_gen_array_open(hand);
+ rc = CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_array_open(hand));
if (rc != yajl_status_ok)
return rc;
for (idx = 0; idx < obj->u.array->count; idx++) {
@@ -662,13 +668,14 @@ yajl_status libxl__json_object_to_yajl_gen(libxl__gc *gc,
if (rc != yajl_status_ok)
return rc;
}
- return yajl_gen_array_close(hand);
+ return CONVERT_YAJL_GEN_TO_STATUS(yajl_gen_array_close(hand));
}
case JSON_ANY:
/* JSON_ANY is not a valid value for obj->type. */
;
}
abort();
+#undef CONVERT_YAJL_GEN_TO_STATUS
}
--
2.6.4 (Apple Git-63)
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
http://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-04-27 11:12 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-27 11:11 [PATCH v3 for-4.7 00/16] Fixes for compiling with clang Roger Pau Monne
2016-04-27 11:11 ` [PATCH v3 for-4.7 01/16] build: make HOSTCC conditional on the value of clang Roger Pau Monne
2016-04-27 11:11 ` [PATCH v3 for-4.7 02/16] build: set HOSTCXX based on clang value for Kconfig xconfig target Roger Pau Monne
2016-04-27 11:11 ` [PATCH v3 for-4.7 03/16] build: pass HOST{CC/CXX} value down to Kconfig Roger Pau Monne
2016-04-27 11:11 ` [PATCH v3 for-4.7 04/16] build: remove Kconfig forced gcc selection Roger Pau Monne
2016-04-27 11:11 ` [PATCH v3 for-4.7 05/16] tools/headers: prevent adding two __align8__ to uint64_t in ARM headers Roger Pau Monne
2016-04-27 11:11 ` [PATCH v3 for-4.7 06/16] xen/tools: fix substitution of __align8__ uint64_t inside of headers Roger Pau Monne
2016-04-27 11:11 ` [PATCH v3 for-4.7 07/16] libxc: fix usage of uninitialized variable Roger Pau Monne
2016-04-27 11:22 ` Wei Liu
2016-04-27 13:18 ` Wei Liu
2016-04-28 17:43 ` Ian Jackson
2016-05-09 17:10 ` Ian Jackson
2016-04-27 11:11 ` [PATCH v3 for-4.7 08/16] libxl: fix shutdown_reason type in list_domains Roger Pau Monne
2016-04-27 11:11 ` [PATCH v3 for-4.7 09/16] xl: fix usage of libxl_get_scheduler Roger Pau Monne
2016-04-27 11:24 ` Wei Liu
2016-04-27 11:11 ` [PATCH v3 for-4.7 10/16] libxl: add the printf-like attributes to a couple of functions Roger Pau Monne
2016-04-27 11:25 ` Wei Liu
2016-04-27 11:11 ` [PATCH v3 for-4.7 11/16] libxl: convert libxl__device_model_xs_path to a macro Roger Pau Monne
2016-04-27 11:26 ` Wei Liu
2016-04-27 11:11 ` Roger Pau Monne [this message]
2016-04-27 11:11 ` [PATCH v3 for-4.7 13/16] libxl: fix passing the type argument to xc_psr_* Roger Pau Monne
2016-04-27 11:11 ` [PATCH v3 for-4.7 14/16] oxenstored: fix error when shifting negative value Roger Pau Monne
2016-04-27 11:26 ` Wei Liu
2016-04-27 11:11 ` [PATCH v3 for-4.7 15/16] tools/python: corrently use LDFLAGS and CFLAGS Roger Pau Monne
2016-04-27 11:11 ` [PATCH v3 for-4.7 16/16] tools/pygrub: fix usage of LDFLAGS Roger Pau Monne
2016-04-27 11:27 ` Wei Liu
2016-04-27 13:23 ` [PATCH v3 for-4.7 00/16] Fixes for compiling with clang Wei Liu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1461755514-23754-13-git-send-email-roger.pau@citrix.com \
--to=roger.pau@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).