[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v6 00/18] libxl: JSON infrastructure, fixes and prerequisite patches for new API



On Tue, Jun 10, 2014 at 04:51:35PM -0400, Boris Ostrovsky wrote:
> On 06/10/2014 04:10 PM, Boris Ostrovsky wrote:
> >On 06/10/2014 10:14 AM, Ian Campbell wrote:
> >>On Mon, 2014-06-09 at 13:43 +0100, Wei Liu wrote:
> >>>Wei Liu (18):
> >>>  A libxl: make cpupool_qualifier_to_cpupoolid a library function
> >>Applied.
> >>>  A xl: remove parsing of "vncviewer" option in xl domain config file
> >>Applied.
> >>
> >>>  M libxl: fix JSON generator for uint64_t
> >>Acked + applied.
> >>
> >>>  A libxl IDL: rename json_fn to json_gen_fn
> >>>  A libxl_json: introduce libxl__object_from_json
> >>>  A libxl_json: introduce parser functions for builtin types
> >
> >The last one breaks on older gcc:
> >
> >In file included from flexarray.c:16:
> >libxl_internal.h:136: error: redefinition of typedef âlibxl__gcâ
> >libxl_json.h:25: note: previous declaration of âlibxl__gcâ was here
> >In file included from flexarray.c:16:
> >libxl_internal.h:1641: error: redefinition of typedef âlibxl__json_objectâ
> >libxl_json.h:26: note: previous declaration of âlibxl__json_objectâ was
> >here
> >make[4]: *** [flexarray.o] Error 1
> >
> >
> >Looks like at some point gcc started allowing multiple typedefs. So, for
> >example:
> 
> And this is apparently that point (for version 4.6, I believe):
> 
> https://gcc.gnu.org/git/?p=gcc.git;a=commitdiff;h=ce3765bf44e49ef0568a1ad4a0b7f807591d6412
> 
> 
> -boris

Thanks for reporting. Now that I notice these functions really belong to
libxl_internal.h.

Does this patch fix it for you?

Wei.

---8<---
From 5a57f827f644f716b3748beec0214bbefddda4b6 Mon Sep 17 00:00:00 2001
From: Wei Liu <wei.liu2@xxxxxxxxxx>
Date: Tue, 10 Jun 2014 22:16:14 +0100
Subject: [PATCH] libxl: move some internal functions to libxl_internal.h

In 752f181f ("libxl_json: introduce parser functions for builtin types")
a bunch of parser functions are added to libxl_json.h, which breaks
GCC < 4.6.

These functions are internal and libxl_json.h is public header, so move
them to libxl_internal.h.

Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx>
---
 tools/libxl/libxl_internal.h |   32 ++++++++++++++++++++++++++++++++
 tools/libxl/libxl_json.h     |   35 -----------------------------------
 2 files changed, 32 insertions(+), 35 deletions(-)

diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 80ea883..a0d4f24 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -3147,6 +3147,38 @@ void libxl__numa_candidate_put_nodemap(libxl__gc *gc,
  */
 #define CTYPE(isfoo,c) (isfoo((unsigned char)(c)))
 
+int libxl_defbool_parse_json(libxl__gc *gc, const libxl__json_object *o,
+                             libxl_defbool *p);
+int libxl__bool_parse_json(libxl__gc *gc, const libxl__json_object *o,
+                           bool *p);
+int libxl_mac_parse_json(libxl__gc *gc, const libxl__json_object *o,
+                         libxl_mac *p);
+int libxl_bitmap_parse_json(libxl__gc *gc, const libxl__json_object *o,
+                            libxl_bitmap *p);
+int libxl_uuid_parse_json(libxl__gc *gc, const libxl__json_object *o,
+                          libxl_uuid *p);
+int libxl_cpuid_policy_list_parse_json(libxl__gc *gc,
+                                       const libxl__json_object *o,
+                                       libxl_cpuid_policy_list *p);
+int libxl_string_list_parse_json(libxl__gc *gc, const libxl__json_object *o,
+                                 libxl_string_list *p);
+int libxl_key_value_list_parse_json(libxl__gc *gc,
+                                    const libxl__json_object *o,
+                                    libxl_key_value_list *p);
+int libxl_hwcap_parse_json(libxl__gc *gc, const libxl__json_object *o,
+                           libxl_hwcap *p);
+int libxl__int_parse_json(libxl__gc *gc, const libxl__json_object *o,
+                          void *p);
+int libxl__uint8_parse_json(libxl__gc *gc, const libxl__json_object *o,
+                            void *p);
+int libxl__uint16_parse_json(libxl__gc *gc, const libxl__json_object *o,
+                             void *p);
+int libxl__uint32_parse_json(libxl__gc *gc, const libxl__json_object *o,
+                             void *p);
+int libxl__uint64_parse_json(libxl__gc *gc, const libxl__json_object *o,
+                             void *p);
+int libxl__string_parse_json(libxl__gc *gc, const libxl__json_object *o,
+                             char **p);
 
 #endif
 
diff --git a/tools/libxl/libxl_json.h b/tools/libxl/libxl_json.h
index b196c1c..e4c0f6c 100644
--- a/tools/libxl/libxl_json.h
+++ b/tools/libxl/libxl_json.h
@@ -22,52 +22,17 @@
 #  include <yajl/yajl_version.h>
 #endif
 
-typedef struct libxl__gc libxl__gc;
-typedef struct libxl__json_object libxl__json_object;
-
 yajl_gen_status libxl__uint64_gen_json(yajl_gen hand, uint64_t val);
 yajl_gen_status libxl_defbool_gen_json(yajl_gen hand, libxl_defbool *p);
-int libxl_defbool_parse_json(libxl__gc *gc, const libxl__json_object *o,
-                             libxl_defbool *p);
-int libxl__bool_parse_json(libxl__gc *gc, const libxl__json_object *o,
-                           bool *p);
 yajl_gen_status libxl_uuid_gen_json(yajl_gen hand, libxl_uuid *p);
-int libxl_uuid_parse_json(libxl__gc *gc, const libxl__json_object *o,
-                          libxl_uuid *p);
 yajl_gen_status libxl_mac_gen_json(yajl_gen hand, libxl_mac *p);
-int libxl_mac_parse_json(libxl__gc *gc, const libxl__json_object *o,
-                         libxl_mac *p);
 yajl_gen_status libxl_bitmap_gen_json(yajl_gen hand, libxl_bitmap *p);
-int libxl_bitmap_parse_json(libxl__gc *gc, const libxl__json_object *o,
-                            libxl_bitmap *p);
 yajl_gen_status libxl_cpuid_policy_list_gen_json(yajl_gen hand,
                                                  libxl_cpuid_policy_list *p);
-int libxl_cpuid_policy_list_parse_json(libxl__gc *gc,
-                                       const libxl__json_object *o,
-                                       libxl_cpuid_policy_list *p);
 yajl_gen_status libxl_string_list_gen_json(yajl_gen hand, libxl_string_list 
*p);
-int libxl_string_list_parse_json(libxl__gc *gc, const libxl__json_object *o,
-                                 libxl_string_list *p);
 yajl_gen_status libxl_key_value_list_gen_json(yajl_gen hand,
                                               libxl_key_value_list *p);
-int libxl_key_value_list_parse_json(libxl__gc *gc,
-                                    const libxl__json_object *o,
-                                    libxl_key_value_list *p);
 yajl_gen_status libxl_hwcap_gen_json(yajl_gen hand, libxl_hwcap *p);
-int libxl_hwcap_parse_json(libxl__gc *gc, const libxl__json_object *o,
-                           libxl_hwcap *p);
-int libxl__int_parse_json(libxl__gc *gc, const libxl__json_object *o,
-                          void *p);
-int libxl__uint8_parse_json(libxl__gc *gc, const libxl__json_object *o,
-                            void *p);
-int libxl__uint16_parse_json(libxl__gc *gc, const libxl__json_object *o,
-                             void *p);
-int libxl__uint32_parse_json(libxl__gc *gc, const libxl__json_object *o,
-                             void *p);
-int libxl__uint64_parse_json(libxl__gc *gc, const libxl__json_object *o,
-                             void *p);
-int libxl__string_parse_json(libxl__gc *gc, const libxl__json_object *o,
-                             char **p);
 
 #include <_libxl_types_json.h>
 
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.