xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 for-4.7 00/16] Fixes for compiling with clang
@ 2016-04-27 11:11 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
                   ` (16 more replies)
  0 siblings, 17 replies; 27+ messages in thread
From: Roger Pau Monne @ 2016-04-27 11:11 UTC (permalink / raw)
  To: xen-devel

Hello,

This is a set of bug fixes for compiling both the hypervisor and the 
toolstack with clang. I've only tested it with clang 3.8.0 from base 
FreeBSD, so I'm not sure if it's going to work with _all_ clang versions, 
but should be better than nothing.

AFAICT, most of the issues that clang found on the toolstack are actual 
bugs, so it's worth trying to fix them before the release.

Patches 1-4 are for the hypervisor, while patches 5-16 are for the 
toolstack.

FWIW, I've also pushed the series to my git repo:

git://xenbits.xen.org/people/royger/xen.git clang_v3

Thanks, Roger.


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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH v3 for-4.7 01/16] build: make HOSTCC conditional on the value of clang
  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 ` 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
                   ` (15 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: Roger Pau Monne @ 2016-04-27 11:11 UTC (permalink / raw)
  To: xen-devel
  Cc: Keir Fraser, Tim Deegan, Ian Jackson, Jan Beulich, Roger Pau Monne

Previously HOSTCC was always hardcoded to gcc

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Keir Fraser <keir@xen.org>
Cc: Tim Deegan <tim@xen.org>
---
Changes since v1:
 - Use ?= instead of =
---
 Config.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/Config.mk b/Config.mk
index a0e6d4e..fd8371a 100644
--- a/Config.mk
+++ b/Config.mk
@@ -36,7 +36,6 @@ CONFIG_$(XEN_OS) := y
 SHELL     ?= /bin/sh
 
 # Tools to run on system hosting the build
-HOSTCC      = gcc
 HOSTCFLAGS  = -Wall -Werror -Wstrict-prototypes -O2 -fomit-frame-pointer
 HOSTCFLAGS += -fno-strict-aliasing
 
@@ -50,8 +49,10 @@ DESTDIR     ?= /
 clang ?= n
 ifeq ($(clang),n)
 gcc := y
+HOSTCC ?= gcc
 else
 gcc := n
+HOSTCC ?= clang
 endif
 
 
-- 
2.6.4 (Apple Git-63)


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

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 for-4.7 02/16] build: set HOSTCXX based on clang value for Kconfig xconfig target
  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 ` 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
                   ` (14 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: Roger Pau Monne @ 2016-04-27 11:11 UTC (permalink / raw)
  To: xen-devel
  Cc: Keir Fraser, Tim Deegan, Ian Jackson, Jan Beulich, Roger Pau Monne

The xconfig Kconfig target requires a C++ compiler because it uses Qt.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Keir Fraser <keir@xen.org>
Cc: Tim Deegan <tim@xen.org>
---
 Config.mk | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Config.mk b/Config.mk
index fd8371a..4a5ebed 100644
--- a/Config.mk
+++ b/Config.mk
@@ -50,9 +50,11 @@ clang ?= n
 ifeq ($(clang),n)
 gcc := y
 HOSTCC ?= gcc
+HOSTCXX ?= g++
 else
 gcc := n
 HOSTCC ?= clang
+HOSTCXX ?= clang++
 endif
 
 
-- 
2.6.4 (Apple Git-63)


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

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 for-4.7 03/16] build: pass HOST{CC/CXX} value down to Kconfig
  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 ` Roger Pau Monne
  2016-04-27 11:11 ` [PATCH v3 for-4.7 04/16] build: remove Kconfig forced gcc selection Roger Pau Monne
                   ` (13 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: Roger Pau Monne @ 2016-04-27 11:11 UTC (permalink / raw)
  To: xen-devel
  Cc: Keir Fraser, Tim Deegan, Ian Jackson, Jan Beulich, Roger Pau Monne

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Ian Jackson <ian.jackson@eu.citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Jan Beulich <jbeulich@suse.com>
Cc: Keir Fraser <keir@xen.org>
Cc: Tim Deegan <tim@xen.org>
---
 xen/Makefile | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/xen/Makefile b/xen/Makefile
index c908544..b483823 100644
--- a/xen/Makefile
+++ b/xen/Makefile
@@ -242,14 +242,14 @@ kconfig := silentoldconfig oldconfig config menuconfig defconfig \
 	randconfig
 .PHONY: $(kconfig)
 $(kconfig):
-	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) $@
+	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) HOSTCC=$(HOSTCC) HOSTCXX=$(HOSTCXX) $@
 
 include/config/%.conf: include/config/auto.conf.cmd $(KCONFIG_CONFIG)
-	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) silentoldconfig
+	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) HOSTCC=$(HOSTCC) HOSTCXX=$(HOSTCXX) silentoldconfig
 
 # Allow people to just run `make` as before and not force them to configure
 $(KCONFIG_CONFIG):
-	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) defconfig
+	$(MAKE) -f $(BASEDIR)/tools/kconfig/Makefile.kconfig ARCH=$(ARCH) SRCARCH=$(SRCARCH) HOSTCC=$(HOSTCC) HOSTCXX=$(HOSTCXX) defconfig
 
 # Break the dependency chain for the first run
 include/config/auto.conf.cmd: ;
-- 
2.6.4 (Apple Git-63)


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

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 for-4.7 04/16] build: remove Kconfig forced gcc selection
  2016-04-27 11:11 [PATCH v3 for-4.7 00/16] Fixes for compiling with clang Roger Pau Monne
                   ` (2 preceding siblings ...)
  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 ` 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
                   ` (12 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: Roger Pau Monne @ 2016-04-27 11:11 UTC (permalink / raw)
  To: xen-devel; +Cc: Doug Goldstein, Roger Pau Monne

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Doug Goldstein <cardoe@cardoe.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
Cc: Doug Goldstein <cardoe@cardoe.com>
---
 xen/tools/kconfig/Makefile.kconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/xen/tools/kconfig/Makefile.kconfig b/xen/tools/kconfig/Makefile.kconfig
index 815f306..dbd8912 100644
--- a/xen/tools/kconfig/Makefile.kconfig
+++ b/xen/tools/kconfig/Makefile.kconfig
@@ -36,8 +36,8 @@ KBUILD_DEFCONFIG := $(ARCH)_defconfig
 CONFIG_SHELL := $(SHELL)
 
 # provide the host compiler
-HOSTCC := gcc
-HOSTCXX := g++
+HOSTCC ?= gcc
+HOSTCXX ?= g++
 
 # force target
 PHONY += FORCE
-- 
2.6.4 (Apple Git-63)


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

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 for-4.7 05/16] tools/headers: prevent adding two __align8__ to uint64_t in ARM headers
  2016-04-27 11:11 [PATCH v3 for-4.7 00/16] Fixes for compiling with clang Roger Pau Monne
                   ` (3 preceding siblings ...)
  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 ` 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
                   ` (11 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: Roger Pau Monne @ 2016-04-27 11:11 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Ian Jackson, Roger Pau Monne

Due to the fact that on ARM headers types are substituted to uint64_t and
then uint64_t is also substituted to contain the aligment, this would lead
to some types containing two __align8__ directives. Fix this by first
expanding Xen specific types to uint64_t only, and then replacing all the
uint64_t types to __align8__ uint64_t. This relies on the fact that all
Xen-specific types will have longer names, so they will always be replaced
first.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
 tools/include/xen-foreign/mkheader.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/include/xen-foreign/mkheader.py b/tools/include/xen-foreign/mkheader.py
index 0504cb8..0e42e14 100644
--- a/tools/include/xen-foreign/mkheader.py
+++ b/tools/include/xen-foreign/mkheader.py
@@ -20,8 +20,8 @@ footer = {};
 inttypes["arm32"] = {
     "unsigned long" : "__danger_unsigned_long_on_arm32",
     "long"          : "__danger_long_on_arm32",
-    "xen_pfn_t"     : "__align8__ uint64_t",
-    "xen_ulong_t"   : "__align8__ uint64_t",
+    "xen_pfn_t"     : "uint64_t",
+    "xen_ulong_t"   : "uint64_t",
     "uint64_t"      : "__align8__ uint64_t",
 };
 header["arm32"] = """
@@ -41,8 +41,8 @@ footer["arm32"] = """
 inttypes["arm64"] = {
     "unsigned long" : "__danger_unsigned_long_on_arm64",
     "long"          : "__danger_long_on_arm64",
-    "xen_pfn_t"     : "__align8__ uint64_t",
-    "xen_ulong_t"   : "__align8__ uint64_t",
+    "xen_pfn_t"     : "uint64_t",
+    "xen_ulong_t"   : "uint64_t",
     "uint64_t"      : "__align8__ uint64_t",
 };
 header["arm64"] = """
-- 
2.6.4 (Apple Git-63)


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

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 for-4.7 06/16] xen/tools: fix substitution of __align8__ uint64_t inside of headers
  2016-04-27 11:11 [PATCH v3 for-4.7 00/16] Fixes for compiling with clang Roger Pau Monne
                   ` (4 preceding siblings ...)
  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 ` Roger Pau Monne
  2016-04-27 11:11 ` [PATCH v3 for-4.7 07/16] libxc: fix usage of uninitialized variable Roger Pau Monne
                   ` (10 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: Roger Pau Monne @ 2016-04-27 11:11 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Ian Jackson, Roger Pau Monne

The current seedery doesn't work with BSD sed, so remove the try to match
int64_t also (since there's none at the moment). Also, apply the same
treatment to all arch headers, currently this is only done to x86_64
headers.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
 tools/include/xen-foreign/Makefile | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/tools/include/xen-foreign/Makefile b/tools/include/xen-foreign/Makefile
index 270a975..e395011 100644
--- a/tools/include/xen-foreign/Makefile
+++ b/tools/include/xen-foreign/Makefile
@@ -25,18 +25,30 @@ check-headers: checker
 	rm tmp.size
 
 arm32.h: mkheader.py structs.py $(ROOT)/arch-arm.h $(ROOT)/xen.h
-	$(PYTHON) $< $* $@ $(filter %.h,$^)
+	$(PYTHON) $< $* $@.tmp $(filter %.h,$^)
+	#Avoid mixing an alignment directive with a uint64_t cast or sizeof expression
+	sed 's/(__align8__ \(uint64_t\))/(\1)/g' < $@.tmp > $@.tmp2
+	rm $@.tmp
+	$(call move-if-changed,$@.tmp2,$@)
 
 arm64.h: mkheader.py structs.py $(ROOT)/arch-arm.h $(ROOT)/xen.h
-	$(PYTHON) $< $* $@ $(filter %.h,$^)
+	$(PYTHON) $< $* $@.tmp $(filter %.h,$^)
+	#Avoid mixing an alignment directive with a uint64_t cast or sizeof expression
+	sed 's/(__align8__ \(uint64_t\))/(\1)/g' < $@.tmp > $@.tmp2
+	rm $@.tmp
+	$(call move-if-changed,$@.tmp2,$@)
 
 x86_32.h: mkheader.py structs.py $(ROOT)/arch-x86/xen-x86_32.h $(ROOT)/arch-x86/xen.h $(ROOT)/xen.h
-	$(PYTHON) $< $* $@ $(filter %.h,$^)
+	$(PYTHON) $< $* $@.tmp $(filter %.h,$^)
+	#Avoid mixing an alignment directive with a uint64_t cast or sizeof expression
+	sed 's/(__align8__ \(uint64_t\))/(\1)/g' < $@.tmp > $@.tmp2
+	rm $@.tmp
+	$(call move-if-changed,$@.tmp2,$@)
 
 x86_64.h: mkheader.py structs.py $(ROOT)/arch-x86/xen-x86_64.h $(ROOT)/arch-x86/xen.h $(ROOT)/xen.h
 	$(PYTHON) $< $* $@.tmp $(filter %.h,$^)
 	#Avoid mixing an alignment directive with a uint64_t cast or sizeof expression
-	sed 's/(__align8__ \(u\?int64_t\))/(\1)/g' < $@.tmp > $@.tmp2
+	sed 's/(__align8__ \(uint64_t\))/(\1)/g' < $@.tmp > $@.tmp2
 	rm $@.tmp
 	$(call move-if-changed,$@.tmp2,$@)
 
-- 
2.6.4 (Apple Git-63)


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

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 for-4.7 07/16] libxc: fix usage of uninitialized variable
  2016-04-27 11:11 [PATCH v3 for-4.7 00/16] Fixes for compiling with clang Roger Pau Monne
                   ` (5 preceding siblings ...)
  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 ` Roger Pau Monne
  2016-04-27 11:22   ` Wei Liu
  2016-04-27 13:18   ` Wei Liu
  2016-04-27 11:11 ` [PATCH v3 for-4.7 08/16] libxl: fix shutdown_reason type in list_domains Roger Pau Monne
                   ` (9 subsequent siblings)
  16 siblings, 2 replies; 27+ messages in thread
From: Roger Pau Monne @ 2016-04-27 11:11 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Ian Jackson, Roger Pau Monne

*size should be used instead, because it contains the size of the buffer in
out_buf.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
Changes since v2:
 - Use *size instead of 0, because it will contain the actual size of the
   out_buf buffer.
---
 tools/libxc/xc_dom_bzimageloader.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxc/xc_dom_bzimageloader.c b/tools/libxc/xc_dom_bzimageloader.c
index 7fde42a..33ba06b 100644
--- a/tools/libxc/xc_dom_bzimageloader.c
+++ b/tools/libxc/xc_dom_bzimageloader.c
@@ -482,7 +482,7 @@ static int xc_try_lzo1x_decode(
         if ( !dst_len )
         {
             msg = "Error registering stream output";
-            if ( xc_dom_register_external(dom, out_buf, out_len) )
+            if ( xc_dom_register_external(dom, out_buf, *size) )
                 break;
 
             return 0;
-- 
2.6.4 (Apple Git-63)


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

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 for-4.7 08/16] libxl: fix shutdown_reason type in list_domains
  2016-04-27 11:11 [PATCH v3 for-4.7 00/16] Fixes for compiling with clang Roger Pau Monne
                   ` (6 preceding siblings ...)
  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:11 ` 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
                   ` (8 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: Roger Pau Monne @ 2016-04-27 11:11 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Ian Jackson, Roger Pau Monne

It should be an enum, not an unsigned.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Acked-by: Wei Liu <wei.liu2@citrix.com>
Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxl/xl_cmdimpl.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 6346017..8ff54e1 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -4254,7 +4254,7 @@ static void list_domains(bool verbose, bool context, bool claim, bool numa,
     printf("\n");
     for (i = 0; i < nb_domain; i++) {
         char *domname;
-        unsigned shutdown_reason;
+        libxl_shutdown_reason shutdown_reason;
         domname = libxl_domid_to_name(ctx, info[i].domid);
         shutdown_reason = info[i].shutdown ? info[i].shutdown_reason : 0;
         printf("%-40s %5d %5lu %5d     %c%c%c%c%c%c  %8.1f",
-- 
2.6.4 (Apple Git-63)


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

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 for-4.7 09/16] xl: fix usage of libxl_get_scheduler
  2016-04-27 11:11 [PATCH v3 for-4.7 00/16] Fixes for compiling with clang Roger Pau Monne
                   ` (7 preceding siblings ...)
  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 ` 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
                   ` (7 subsequent siblings)
  16 siblings, 1 reply; 27+ messages in thread
From: Roger Pau Monne @ 2016-04-27 11:11 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Ian Jackson, Roger Pau Monne

It returns an int, not a libxl_scheduler.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Doug Goldstein <cardoe@cardoe.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
Changes since v2:
 - s/sched_rc/rc/
---
 tools/libxl/xl_cmdimpl.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
index 8ff54e1..dfb1b01 100644
--- a/tools/libxl/xl_cmdimpl.c
+++ b/tools/libxl/xl_cmdimpl.c
@@ -5894,16 +5894,19 @@ static void output_xeninfo(void)
 {
     const libxl_version_info *info;
     libxl_scheduler sched;
+    int rc;
 
     if (!(info = libxl_get_version_info(ctx))) {
         fprintf(stderr, "libxl_get_version_info failed.\n");
         return;
     }
 
-    if ((sched = libxl_get_scheduler(ctx)) < 0) {
+    rc = libxl_get_scheduler(ctx);
+    if (rc < 0) {
         fprintf(stderr, "get_scheduler sysctl failed.\n");
         return;
     }
+    sched = rc;
 
     printf("xen_major              : %d\n", info->xen_version_major);
     printf("xen_minor              : %d\n", info->xen_version_minor);
@@ -8084,10 +8087,12 @@ int main_cpupoolcreate(int argc, char **argv)
             goto out_cfg;
         }
     } else {
-        if ((sched = libxl_get_scheduler(ctx)) < 0) {
+        rc = libxl_get_scheduler(ctx);
+        if (rc < 0) {
             fprintf(stderr, "get_scheduler sysctl failed.\n");
             goto out_cfg;
         }
+        sched = rc;
     }
 
     if (libxl_get_freecpus(ctx, &freemap)) {
-- 
2.6.4 (Apple Git-63)


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

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 for-4.7 10/16] libxl: add the printf-like attributes to a couple of functions
  2016-04-27 11:11 [PATCH v3 for-4.7 00/16] Fixes for compiling with clang Roger Pau Monne
                   ` (8 preceding siblings ...)
  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:11 ` 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
                   ` (6 subsequent siblings)
  16 siblings, 1 reply; 27+ messages in thread
From: Roger Pau Monne @ 2016-04-27 11:11 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Ian Jackson, Roger Pau Monne

Or else clang complains with:

error: format string is not a string literal

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
 tools/libxl/libxl_internal.h    | 4 ++--
 tools/libxl/libxl_save_helper.c | 1 +
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 8e2cf3e..662d01a 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -636,7 +636,7 @@ _hidden void *libxl__realloc(libxl__gc *gc_opt, void *ptr, size_t new_size) NN1;
 /* print @fmt into an allocated string large enoughto contain the result.
  * (similar to gc'd asprintf(3)). */
 _hidden char *libxl__sprintf(libxl__gc *gc_opt, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3) NN1;
-_hidden char *libxl__vsprintf(libxl__gc *gc, const char *format, va_list ap);
+_hidden char *libxl__vsprintf(libxl__gc *gc, const char *format, va_list ap) PRINTF_ATTRIBUTE(2, 0);
 /* duplicate the string @c (similar to a gc'd strdup(3)). */
 _hidden char *libxl__strdup(libxl__gc *gc_opt,
                             const char *c /* may be NULL */) NN1;
@@ -709,7 +709,7 @@ _hidden char *libxl__xs_libxl_path(libxl__gc *gc, uint32_t domid);
  */
 
 int libxl__xs_vprintf(libxl__gc *gc, xs_transaction_t t,
-                      const char *path, const char *fmt, va_list ap);
+                      const char *path, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(4, 0);
 int libxl__xs_printf(libxl__gc *gc, xs_transaction_t t,
                      const char *path, const char *fmt, ...) PRINTF_ATTRIBUTE(4, 5);
 
diff --git a/tools/libxl/libxl_save_helper.c b/tools/libxl/libxl_save_helper.c
index 5fe642a..d3def6b 100644
--- a/tools/libxl/libxl_save_helper.c
+++ b/tools/libxl/libxl_save_helper.c
@@ -52,6 +52,7 @@
 
 /*----- logger -----*/
 
+__attribute__((format(printf, 5, 0)))
 static void tellparent_vmessage(xentoollog_logger *logger_in,
                                 xentoollog_level level,
                                 int errnoval,
-- 
2.6.4 (Apple Git-63)


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

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 for-4.7 11/16] libxl: convert libxl__device_model_xs_path to a macro
  2016-04-27 11:11 [PATCH v3 for-4.7 00/16] Fixes for compiling with clang Roger Pau Monne
                   ` (9 preceding siblings ...)
  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:11 ` Roger Pau Monne
  2016-04-27 11:26   ` Wei Liu
  2016-04-27 11:11 ` [PATCH v3 for-4.7 12/16] libxl: add explicit casts from yajl_gen_status to yajl_status Roger Pau Monne
                   ` (5 subsequent siblings)
  16 siblings, 1 reply; 27+ messages in thread
From: Roger Pau Monne @ 2016-04-27 11:11 UTC (permalink / raw)
  To: xen-devel; +Cc: Ian Jackson, Wei Liu, Roger Pau Monne

Since it's unsafe to code it as a function because it would end up passing a
non literal string to a printf like function.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Wei Liu <wei.liu2@citrix.com>
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
---
Changes since v2:
 - Split the libxl__device_model_xs_path convert to a separate patch.
 - s/libxl__device_model_xs_path/DEVICE_MODEL_XS_PATH/
---
 tools/libxl/libxl_device.c      |  2 +-
 tools/libxl/libxl_dm.c          | 20 ++++++++------------
 tools/libxl/libxl_dom.c         |  2 +-
 tools/libxl/libxl_dom_save.c    | 12 ++++++------
 tools/libxl/libxl_dom_suspend.c |  2 +-
 tools/libxl/libxl_internal.c    | 16 ----------------
 tools/libxl/libxl_internal.h    |  7 ++++---
 tools/libxl/libxl_pci.c         | 14 +++++++-------
 8 files changed, 28 insertions(+), 47 deletions(-)

diff --git a/tools/libxl/libxl_device.c b/tools/libxl/libxl_device.c
index a98707c..f79e536 100644
--- a/tools/libxl/libxl_device.c
+++ b/tools/libxl/libxl_device.c
@@ -1264,7 +1264,7 @@ int libxl__wait_for_device_model_deprecated(libxl__gc *gc,
     char *path;
     uint32_t dm_domid = libxl_get_stubdom_id(CTX, domid);
 
-    path = libxl__device_model_xs_path(gc, dm_domid, domid, "/state");
+    path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "/state");
     return libxl__xenstore_child_wait_deprecated(gc, domid,
                                      LIBXL_DEVICE_MODEL_START_TIMEOUT,
                                      "Device Model", path, state, spawning,
diff --git a/tools/libxl/libxl_dm.c b/tools/libxl/libxl_dm.c
index fd12844..a1f7bd8 100644
--- a/tools/libxl/libxl_dm.c
+++ b/tools/libxl/libxl_dm.c
@@ -1762,11 +1762,9 @@ void libxl__spawn_stub_dm(libxl__egc *egc, libxl__stub_dm_spawn_state *sdss)
     perm[1].perms = XS_PERM_READ;
 retry_transaction:
     t = xs_transaction_start(ctx->xsh);
-    xs_mkdir(ctx->xsh, t,
-             libxl__device_model_xs_path(gc, dm_domid, guest_domid, ""));
+    xs_mkdir(ctx->xsh, t, DEVICE_MODEL_XS_PATH(gc, dm_domid, guest_domid, ""));
     xs_set_permissions(ctx->xsh, t,
-                       libxl__device_model_xs_path(gc, dm_domid,
-                                                   guest_domid, ""),
+                       DEVICE_MODEL_XS_PATH(gc, dm_domid, guest_domid, ""),
                        perm, ARRAY_SIZE(perm));
     if (!xs_transaction_end(ctx->xsh, t, 0))
         if (errno == EAGAIN)
@@ -1926,9 +1924,8 @@ static void stubdom_pvqemu_cb(libxl__egc *egc,
     sdss->xswait.ao = ao;
     sdss->xswait.what = GCSPRINTF("Stubdom %u for %u startup",
                                   dm_domid, sdss->dm.guest_domid);
-    sdss->xswait.path =
-        libxl__device_model_xs_path(gc, dm_domid, sdss->dm.guest_domid,
-                                    "/state");
+    sdss->xswait.path = DEVICE_MODEL_XS_PATH(gc, dm_domid, sdss->dm.guest_domid,
+                                             "/state");
     sdss->xswait.timeout_ms = LIBXL_STUBDOM_START_TIMEOUT * 1000;
     sdss->xswait.callback = stubdom_xswait_cb;
     rc = libxl__xswait_start(gc, &sdss->xswait);
@@ -2035,7 +2032,7 @@ void libxl__spawn_local_dm(libxl__egc *egc, libxl__dm_spawn_state *dmss)
         free(path);
     }
 
-    path = libxl__device_model_xs_path(gc, LIBXL_TOOLSTACK_DOMID, domid, "");
+    path = DEVICE_MODEL_XS_PATH(gc, LIBXL_TOOLSTACK_DOMID, domid, "");
     xs_mkdir(ctx->xsh, XBT_NULL, path);
 
     if (b_info->type == LIBXL_DOMAIN_TYPE_HVM &&
@@ -2089,8 +2086,8 @@ retry_transaction:
     }
 
     spawn->what = GCSPRINTF("domain %d device model", domid);
-    spawn->xspath = libxl__device_model_xs_path(gc, LIBXL_TOOLSTACK_DOMID,
-                                                domid, "/state");
+    spawn->xspath = DEVICE_MODEL_XS_PATH(gc, LIBXL_TOOLSTACK_DOMID, domid,
+                                         "/state");
     spawn->timeout_ms = LIBXL_DEVICE_MODEL_START_TIMEOUT * 1000;
     spawn->pidpath = GCSPRINTF("%s/image/device-model-pid", dom_path);
     spawn->midproc_cb = libxl__spawn_record_pid;
@@ -2320,8 +2317,7 @@ out:
 
 int libxl__destroy_device_model(libxl__gc *gc, uint32_t domid)
 {
-    char *path = libxl__device_model_xs_path(gc, LIBXL_TOOLSTACK_DOMID,
-                                             domid, "");
+    char *path = DEVICE_MODEL_XS_PATH(gc, LIBXL_TOOLSTACK_DOMID, domid, "");
     if (!xs_rm(CTX->xsh, XBT_NULL, path))
         LOG(ERROR, "xs_rm failed for %s", path);
     /* We should try to destroy the device model anyway. */
diff --git a/tools/libxl/libxl_dom.c b/tools/libxl/libxl_dom.c
index 09d3bca..9b20cf5 100644
--- a/tools/libxl/libxl_dom.c
+++ b/tools/libxl/libxl_dom.c
@@ -1106,7 +1106,7 @@ int libxl__qemu_traditional_cmd(libxl__gc *gc, uint32_t domid,
 {
     char *path = NULL;
     uint32_t dm_domid = libxl_get_stubdom_id(CTX, domid);
-    path = libxl__device_model_xs_path(gc, dm_domid, domid, "/command");
+    path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "/command");
     return libxl__xs_printf(gc, XBT_NULL, path, "%s", cmd);
 }
 
diff --git a/tools/libxl/libxl_dom_save.c b/tools/libxl/libxl_dom_save.c
index 821f862..076be04 100644
--- a/tools/libxl/libxl_dom_save.c
+++ b/tools/libxl/libxl_dom_save.c
@@ -62,10 +62,10 @@ static void domain_suspend_switch_qemu_xen_traditional_logdirty
 
     if (!lds->cmd_path) {
         uint32_t dm_domid = libxl_get_stubdom_id(CTX, domid);
-        lds->cmd_path = libxl__device_model_xs_path(gc, dm_domid, domid,
-                                                    "/logdirty/cmd");
-        lds->ret_path = libxl__device_model_xs_path(gc, dm_domid, domid,
-                                                    "/logdirty/ret");
+        lds->cmd_path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid,
+                                             "/logdirty/cmd");
+        lds->ret_path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid,
+                                             "/logdirty/ret");
     }
     lds->cmd = enable ? "enable" : "disable";
 
@@ -290,7 +290,7 @@ int libxl__save_emulator_xenstore_data(libxl__domain_save_state *dss,
     const uint32_t domid = dss->domid;
     const uint32_t dm_domid = libxl_get_stubdom_id(CTX, domid);
 
-    xs_root = libxl__device_model_xs_path(gc, dm_domid, domid, "");
+    xs_root = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "");
 
     entries = libxl__xs_directory(gc, 0, GCSPRINTF("%s/physmap", xs_root),
                                   &nr_entries);
@@ -482,7 +482,7 @@ int libxl__restore_emulator_xenstore_data(libxl__domain_create_state *dcs,
 
     const uint32_t domid = dcs->guest_domid;
     const uint32_t dm_domid = libxl_get_stubdom_id(CTX, domid);
-    const char *xs_root = libxl__device_model_xs_path(gc, dm_domid, domid, "");
+    const char *xs_root = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "");
 
     while (next < end) {
         key = next;
diff --git a/tools/libxl/libxl_dom_suspend.c b/tools/libxl/libxl_dom_suspend.c
index cc0b217..0648919 100644
--- a/tools/libxl/libxl_dom_suspend.c
+++ b/tools/libxl/libxl_dom_suspend.c
@@ -432,7 +432,7 @@ int libxl__domain_resume_device_model(libxl__gc *gc, uint32_t domid)
     case LIBXL_DEVICE_MODEL_VERSION_QEMU_XEN_TRADITIONAL: {
         uint32_t dm_domid = libxl_get_stubdom_id(CTX, domid);
 
-        path = libxl__device_model_xs_path(gc, dm_domid, domid, "/state");
+        path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "/state");
         state = libxl__xs_read(gc, XBT_NULL, path);
         if (state != NULL && !strcmp(state, "paused")) {
             libxl__qemu_traditional_cmd(gc, domid, "continue");
diff --git a/tools/libxl/libxl_internal.c b/tools/libxl/libxl_internal.c
index e7b765b..3b30f8a 100644
--- a/tools/libxl/libxl_internal.c
+++ b/tools/libxl/libxl_internal.c
@@ -554,22 +554,6 @@ void libxl__update_domain_configuration(libxl__gc *gc,
     dst->b_info.video_memkb = src->b_info.video_memkb;
 }
 
-char *libxl__device_model_xs_path(libxl__gc *gc, uint32_t dm_domid,
-                                  uint32_t domid, const char *format,  ...)
-{
-    char *s, *fmt;
-    va_list ap;
-
-    fmt = GCSPRINTF("/local/domain/%u/device-model/%u%s", dm_domid,
-                    domid, format);
-
-    va_start(ap, format);
-    s = libxl__vsprintf(gc, fmt, ap);
-    va_end(ap);
-
-    return s;
-}
-
 /*
  * Local variables:
  * mode: C
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 662d01a..c791418 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -1995,9 +1995,10 @@ _hidden libxl__json_object *libxl__json_parse(libxl__gc *gc_opt, const char *s);
 _hidden int libxl__device_model_version_running(libxl__gc *gc, uint32_t domid);
   /* Return the system-wide default device model */
 _hidden libxl_device_model_version libxl__default_device_model(libxl__gc *gc);
-_hidden char *libxl__device_model_xs_path(libxl__gc *gc, uint32_t dm_domid,
-                                          uint32_t domid,
-                                          const char *format, ...) PRINTF_ATTRIBUTE(4, 5);
+
+#define DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, fmt, _a...)              \
+    libxl__sprintf(gc, "/local/domain/%u/device-model/%u" fmt, dm_domid,   \
+                   domid, ##_a)
 
 /*
  * Calling context and GC for event-generating functions:
diff --git a/tools/libxl/libxl_pci.c b/tools/libxl/libxl_pci.c
index 300fd4d..ce8d763 100644
--- a/tools/libxl/libxl_pci.c
+++ b/tools/libxl/libxl_pci.c
@@ -970,9 +970,9 @@ static int qemu_pci_add_xenstore(libxl__gc *gc, uint32_t domid,
     uint32_t dm_domid;
 
     dm_domid = libxl_get_stubdom_id(CTX, domid);
-    path = libxl__device_model_xs_path(gc, dm_domid, domid, "/state");
+    path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "/state");
     state = libxl__xs_read(gc, XBT_NULL, path);
-    path = libxl__device_model_xs_path(gc, dm_domid, domid, "/parameter");
+    path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "/parameter");
     if (pcidev->vdevfn) {
         libxl__xs_printf(gc, XBT_NULL, path, PCI_BDF_VDEVFN","PCI_OPTIONS,
                          pcidev->domain, pcidev->bus, pcidev->dev,
@@ -987,9 +987,9 @@ static int qemu_pci_add_xenstore(libxl__gc *gc, uint32_t domid,
     libxl__qemu_traditional_cmd(gc, domid, "pci-ins");
     rc = libxl__wait_for_device_model_deprecated(gc, domid, NULL, NULL,
                                       pci_ins_check, state);
-    path = libxl__device_model_xs_path(gc, dm_domid, domid, "/parameter");
+    path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "/parameter");
     vdevfn = libxl__xs_read(gc, XBT_NULL, path);
-    path = libxl__device_model_xs_path(gc, dm_domid, domid, "/state");
+    path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "/state");
     if ( rc < 0 )
         LOG(ERROR, "qemu refused to add device: %s", vdevfn);
     else if ( sscanf(vdevfn, "0x%x", &pcidev->vdevfn) != 1 ) {
@@ -1310,9 +1310,9 @@ static int qemu_pci_remove_xenstore(libxl__gc *gc, uint32_t domid,
 
     dm_domid = libxl_get_stubdom_id(CTX, domid);
 
-    path = libxl__device_model_xs_path(gc, dm_domid, domid, "/state");
+    path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "/state");
     state = libxl__xs_read(gc, XBT_NULL, path);
-    path = libxl__device_model_xs_path(gc, dm_domid, domid, "/parameter");
+    path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "/parameter");
     libxl__xs_printf(gc, XBT_NULL, path, PCI_BDF, pcidev->domain,
                      pcidev->bus, pcidev->dev, pcidev->func);
 
@@ -1330,7 +1330,7 @@ static int qemu_pci_remove_xenstore(libxl__gc *gc, uint32_t domid,
             return ERROR_FAIL;
         }
     }
-    path = libxl__device_model_xs_path(gc, dm_domid, domid, "/state");
+    path = DEVICE_MODEL_XS_PATH(gc, dm_domid, domid, "/state");
     xs_write(ctx->xsh, XBT_NULL, path, state, strlen(state));
 
     return 0;
-- 
2.6.4 (Apple Git-63)


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

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 for-4.7 12/16] libxl: add explicit casts from yajl_gen_status to yajl_status
  2016-04-27 11:11 [PATCH v3 for-4.7 00/16] Fixes for compiling with clang Roger Pau Monne
                   ` (10 preceding siblings ...)
  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:11 ` Roger Pau Monne
  2016-04-27 11:11 ` [PATCH v3 for-4.7 13/16] libxl: fix passing the type argument to xc_psr_* Roger Pau Monne
                   ` (4 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: Roger Pau Monne @ 2016-04-27 11:11 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Ian Jackson, Roger Pau Monne

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

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 for-4.7 13/16] libxl: fix passing the type argument to xc_psr_*
  2016-04-27 11:11 [PATCH v3 for-4.7 00/16] Fixes for compiling with clang Roger Pau Monne
                   ` (11 preceding siblings ...)
  2016-04-27 11:11 ` [PATCH v3 for-4.7 12/16] libxl: add explicit casts from yajl_gen_status to yajl_status Roger Pau Monne
@ 2016-04-27 11:11 ` 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
                   ` (3 subsequent siblings)
  16 siblings, 0 replies; 27+ messages in thread
From: Roger Pau Monne @ 2016-04-27 11:11 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Ian Jackson, Roger Pau Monne

The xc_psr_* functions expect the type to be xc_psr_cat_type instead of
libxl_psr_cbm_type, so do the 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_psr.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/tools/libxl/libxl_psr.c b/tools/libxl/libxl_psr.c
index 3d0dc61..40f2d5f 100644
--- a/tools/libxl/libxl_psr.c
+++ b/tools/libxl/libxl_psr.c
@@ -298,6 +298,7 @@ int libxl_psr_cat_set_cbm(libxl_ctx *ctx, uint32_t domid,
                           uint64_t cbm)
 {
     GC_INIT(ctx);
+    BUILD_BUG_ON(sizeof(libxl_psr_cbm_type) != sizeof(xc_psr_cat_type));
     int rc;
     int socketid, nr_sockets;
 
@@ -310,7 +311,8 @@ int libxl_psr_cat_set_cbm(libxl_ctx *ctx, uint32_t domid,
     libxl_for_each_set_bit(socketid, *target_map) {
         if (socketid >= nr_sockets)
             break;
-        if (xc_psr_cat_set_domain_data(ctx->xch, domid, type, socketid, cbm)) {
+        if (xc_psr_cat_set_domain_data(ctx->xch, domid, (xc_psr_cat_type)type,
+                                       socketid, cbm)) {
             libxl__psr_cat_log_err_msg(gc, errno);
             rc = ERROR_FAIL;
         }
@@ -328,7 +330,8 @@ int libxl_psr_cat_get_cbm(libxl_ctx *ctx, uint32_t domid,
     GC_INIT(ctx);
     int rc = 0;
 
-    if (xc_psr_cat_get_domain_data(ctx->xch, domid, type, target, cbm_r)) {
+    if (xc_psr_cat_get_domain_data(ctx->xch, domid, (xc_psr_cat_type)type,
+                                   target, cbm_r)) {
         libxl__psr_cat_log_err_msg(gc, errno);
         rc = ERROR_FAIL;
     }
-- 
2.6.4 (Apple Git-63)


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

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 for-4.7 14/16] oxenstored: fix error when shifting negative value
  2016-04-27 11:11 [PATCH v3 for-4.7 00/16] Fixes for compiling with clang Roger Pau Monne
                   ` (12 preceding siblings ...)
  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 ` 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
                   ` (2 subsequent siblings)
  16 siblings, 1 reply; 27+ messages in thread
From: Roger Pau Monne @ 2016-04-27 11:11 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Ian Jackson, Roger Pau Monne

By explicitly casting it to unsigned.

Reasoning on why this is needed, provided by Andrew Cooper:

"Ocaml stores integers shifted left by one, and with the bottom bit set.

Values with the bottom bit clear are pointers into the GC'd heap. Values
with the bottom bit set are integers, and need to be shifted by 1 bit to
have calculations performed."

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
Changes since v2:
 - Expand commit message with Andrew's reasoning.
---
 tools/ocaml/xenstored/systemd_stubs.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/ocaml/xenstored/systemd_stubs.c b/tools/ocaml/xenstored/systemd_stubs.c
index 1bd5dea..a78a72b 100644
--- a/tools/ocaml/xenstored/systemd_stubs.c
+++ b/tools/ocaml/xenstored/systemd_stubs.c
@@ -124,7 +124,7 @@ CAMLprim value ocaml_sd_listen_fds(value connect_to)
 	CAMLparam1(connect_to);
 	CAMLlocal1(sock_ret);
 
-	sock_ret = Val_int(-1);
+	sock_ret = Val_int(-1U);
 
 	CAMLreturn(sock_ret);
 }
@@ -144,7 +144,7 @@ CAMLprim value ocaml_sd_notify_ready(value ignore)
 	CAMLparam1(ignore);
 	CAMLlocal1(ret);
 
-	ret = Val_int(-1);
+	ret = Val_int(-1U);
 
 	CAMLreturn(ret);
 }
-- 
2.6.4 (Apple Git-63)


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

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 for-4.7 15/16] tools/python: corrently use LDFLAGS and CFLAGS
  2016-04-27 11:11 [PATCH v3 for-4.7 00/16] Fixes for compiling with clang Roger Pau Monne
                   ` (13 preceding siblings ...)
  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:11 ` 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 13:23 ` [PATCH v3 for-4.7 00/16] Fixes for compiling with clang Wei Liu
  16 siblings, 0 replies; 27+ messages in thread
From: Roger Pau Monne @ 2016-04-27 11:11 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Ian Jackson, Roger Pau Monne

It is incorrect to add the LDFLAGS to the CFLAGS, and some compilers will
error out if linker flags are passed when creating object files. Fix this by
properly passing CFLAGS and LDFLAGS, instead of putting everything in
CFLAGS.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Doug Goldstein <cardoe@cardoe.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/python/Makefile | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/tools/python/Makefile b/tools/python/Makefile
index 2363537..da08f46 100644
--- a/tools/python/Makefile
+++ b/tools/python/Makefile
@@ -4,7 +4,8 @@ include $(XEN_ROOT)/tools/Rules.mk
 .PHONY: all
 all: build
 
-PY_CFLAGS = $(CFLAGS) $(PY_NOOPT_CFLAGS) $(LDFLAGS) $(APPEND_LDFLAGS)
+PY_CFLAGS = $(CFLAGS) $(PY_NOOPT_CFLAGS)
+PY_LDFLAGS = $(LDFLAGS) $(APPEND_LDFLAGS)
 
 .PHONY: build
 build:
@@ -14,8 +15,9 @@ build:
 install:
 	$(INSTALL_DIR) $(DESTDIR)$(LIBEXEC_BIN)
 
-	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" $(PYTHON) setup.py install \
-		$(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" --force
+	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) \
+		setup.py install $(PYTHON_PREFIX_ARG) --root="$(DESTDIR)"  \
+		--force
 
 	$(INSTALL_PROG) scripts/convert-legacy-stream $(DESTDIR)$(LIBEXEC_BIN)
 	$(INSTALL_PROG) scripts/verify-stream-v2 $(DESTDIR)$(LIBEXEC_BIN)
-- 
2.6.4 (Apple Git-63)


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

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH v3 for-4.7 16/16] tools/pygrub: fix usage of LDFLAGS
  2016-04-27 11:11 [PATCH v3 for-4.7 00/16] Fixes for compiling with clang Roger Pau Monne
                   ` (14 preceding siblings ...)
  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 ` 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
  16 siblings, 1 reply; 27+ messages in thread
From: Roger Pau Monne @ 2016-04-27 11:11 UTC (permalink / raw)
  To: xen-devel; +Cc: Wei Liu, Ian Jackson, Roger Pau Monne

LDFLAGS cannot be appended to CFLAGS, instead pass them down as env
variables.

Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
---
Cc: Ian Jackson <ian.jackson@eu.citrix.com>
Cc: Wei Liu <wei.liu2@citrix.com>
---
 tools/pygrub/Makefile | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/tools/pygrub/Makefile b/tools/pygrub/Makefile
index fe8e03b..a318490 100644
--- a/tools/pygrub/Makefile
+++ b/tools/pygrub/Makefile
@@ -2,7 +2,8 @@
 XEN_ROOT = $(CURDIR)/../..
 include $(XEN_ROOT)/tools/Rules.mk
 
-PY_CFLAGS = $(CFLAGS) $(PY_NOOPT_CFLAGS) $(APPEND_LDFLAGS)
+PY_CFLAGS = $(CFLAGS) $(PY_NOOPT_CFLAGS)
+PY_LDFLAGS = $(LDFLAGS) $(APPEND_LDFLAGS)
 
 .PHONY: all
 all: build
@@ -12,8 +13,8 @@ build:
 
 .PHONY: install
 install: all
-	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" $(PYTHON) setup.py install \
-		$(PYTHON_PREFIX_ARG) --root="$(DESTDIR)" \
+	CC="$(CC)" CFLAGS="$(PY_CFLAGS)" LDFLAGS="$(PY_LDFLAGS)" $(PYTHON) \
+		setup.py install $(PYTHON_PREFIX_ARG) --root="$(DESTDIR)"  \
 		--install-scripts=$(LIBEXEC_BIN) --force
 	set -e; if [ $(bindir) != $(LIBEXEC_BIN) -a \
 	             "`readlink -f $(DESTDIR)/$(bindir)`" != \
-- 
2.6.4 (Apple Git-63)


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

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* Re: [PATCH v3 for-4.7 07/16] libxc: fix usage of uninitialized variable
  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
  1 sibling, 0 replies; 27+ messages in thread
From: Wei Liu @ 2016-04-27 11:22 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel, Ian Jackson, Wei Liu

On Wed, Apr 27, 2016 at 01:11:45PM +0200, Roger Pau Monne wrote:
> *size should be used instead, because it contains the size of the buffer in
> out_buf.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v3 for-4.7 09/16] xl: fix usage of libxl_get_scheduler
  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
  0 siblings, 0 replies; 27+ messages in thread
From: Wei Liu @ 2016-04-27 11:24 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel, Ian Jackson, Wei Liu

On Wed, Apr 27, 2016 at 01:11:47PM +0200, Roger Pau Monne wrote:
> It returns an int, not a libxl_scheduler.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Reviewed-by: Doug Goldstein <cardoe@cardoe.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

> ---
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Wei Liu <wei.liu2@citrix.com>
> ---
> Changes since v2:
>  - s/sched_rc/rc/
> ---
>  tools/libxl/xl_cmdimpl.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/libxl/xl_cmdimpl.c b/tools/libxl/xl_cmdimpl.c
> index 8ff54e1..dfb1b01 100644
> --- a/tools/libxl/xl_cmdimpl.c
> +++ b/tools/libxl/xl_cmdimpl.c
> @@ -5894,16 +5894,19 @@ static void output_xeninfo(void)
>  {
>      const libxl_version_info *info;
>      libxl_scheduler sched;
> +    int rc;
>  
>      if (!(info = libxl_get_version_info(ctx))) {
>          fprintf(stderr, "libxl_get_version_info failed.\n");
>          return;
>      }
>  
> -    if ((sched = libxl_get_scheduler(ctx)) < 0) {
> +    rc = libxl_get_scheduler(ctx);
> +    if (rc < 0) {
>          fprintf(stderr, "get_scheduler sysctl failed.\n");
>          return;
>      }
> +    sched = rc;
>  
>      printf("xen_major              : %d\n", info->xen_version_major);
>      printf("xen_minor              : %d\n", info->xen_version_minor);
> @@ -8084,10 +8087,12 @@ int main_cpupoolcreate(int argc, char **argv)
>              goto out_cfg;
>          }
>      } else {
> -        if ((sched = libxl_get_scheduler(ctx)) < 0) {
> +        rc = libxl_get_scheduler(ctx);
> +        if (rc < 0) {
>              fprintf(stderr, "get_scheduler sysctl failed.\n");
>              goto out_cfg;
>          }
> +        sched = rc;
>      }
>  
>      if (libxl_get_freecpus(ctx, &freemap)) {
> -- 
> 2.6.4 (Apple Git-63)
> 

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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v3 for-4.7 10/16] libxl: add the printf-like attributes to a couple of functions
  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
  0 siblings, 0 replies; 27+ messages in thread
From: Wei Liu @ 2016-04-27 11:25 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel, Ian Jackson, Wei Liu

On Wed, Apr 27, 2016 at 01:11:48PM +0200, Roger Pau Monne wrote:
> Or else clang complains with:
> 
> error: format string is not a string literal
> 
> 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_internal.h    | 4 ++--
>  tools/libxl/libxl_save_helper.c | 1 +
>  2 files changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
> index 8e2cf3e..662d01a 100644
> --- a/tools/libxl/libxl_internal.h
> +++ b/tools/libxl/libxl_internal.h
> @@ -636,7 +636,7 @@ _hidden void *libxl__realloc(libxl__gc *gc_opt, void *ptr, size_t new_size) NN1;
>  /* print @fmt into an allocated string large enoughto contain the result.
>   * (similar to gc'd asprintf(3)). */
>  _hidden char *libxl__sprintf(libxl__gc *gc_opt, const char *fmt, ...) PRINTF_ATTRIBUTE(2, 3) NN1;
> -_hidden char *libxl__vsprintf(libxl__gc *gc, const char *format, va_list ap);
> +_hidden char *libxl__vsprintf(libxl__gc *gc, const char *format, va_list ap) PRINTF_ATTRIBUTE(2, 0);
>  /* duplicate the string @c (similar to a gc'd strdup(3)). */
>  _hidden char *libxl__strdup(libxl__gc *gc_opt,
>                              const char *c /* may be NULL */) NN1;
> @@ -709,7 +709,7 @@ _hidden char *libxl__xs_libxl_path(libxl__gc *gc, uint32_t domid);
>   */
>  
>  int libxl__xs_vprintf(libxl__gc *gc, xs_transaction_t t,
> -                      const char *path, const char *fmt, va_list ap);
> +                      const char *path, const char *fmt, va_list ap) PRINTF_ATTRIBUTE(4, 0);
>  int libxl__xs_printf(libxl__gc *gc, xs_transaction_t t,
>                       const char *path, const char *fmt, ...) PRINTF_ATTRIBUTE(4, 5);
>  
> diff --git a/tools/libxl/libxl_save_helper.c b/tools/libxl/libxl_save_helper.c
> index 5fe642a..d3def6b 100644
> --- a/tools/libxl/libxl_save_helper.c
> +++ b/tools/libxl/libxl_save_helper.c
> @@ -52,6 +52,7 @@
>  
>  /*----- logger -----*/
>  
> +__attribute__((format(printf, 5, 0)))
>  static void tellparent_vmessage(xentoollog_logger *logger_in,
>                                  xentoollog_level level,
>                                  int errnoval,
> -- 
> 2.6.4 (Apple Git-63)
> 

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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v3 for-4.7 11/16] libxl: convert libxl__device_model_xs_path to a macro
  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
  0 siblings, 0 replies; 27+ messages in thread
From: Wei Liu @ 2016-04-27 11:26 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel, Wei Liu, Ian Jackson

On Wed, Apr 27, 2016 at 01:11:49PM +0200, Roger Pau Monne wrote:
> Since it's unsafe to code it as a function because it would end up passing a
> non literal string to a printf like function.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v3 for-4.7 14/16] oxenstored: fix error when shifting negative value
  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
  0 siblings, 0 replies; 27+ messages in thread
From: Wei Liu @ 2016-04-27 11:26 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel, Ian Jackson, Wei Liu

On Wed, Apr 27, 2016 at 01:11:52PM +0200, Roger Pau Monne wrote:
> By explicitly casting it to unsigned.
> 
> Reasoning on why this is needed, provided by Andrew Cooper:
> 
> "Ocaml stores integers shifted left by one, and with the bottom bit set.
> 
> Values with the bottom bit clear are pointers into the GC'd heap. Values
> with the bottom bit set are integers, and need to be shifted by 1 bit to
> have calculations performed."
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v3 for-4.7 16/16] tools/pygrub: fix usage of LDFLAGS
  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
  0 siblings, 0 replies; 27+ messages in thread
From: Wei Liu @ 2016-04-27 11:27 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel, Ian Jackson, Wei Liu

On Wed, Apr 27, 2016 at 01:11:54PM +0200, Roger Pau Monne wrote:
> LDFLAGS cannot be appended to CFLAGS, instead pass them down as env
> variables.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>

Acked-by: Wei Liu <wei.liu2@citrix.com>

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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v3 for-4.7 07/16] libxc: fix usage of uninitialized variable
  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
  1 sibling, 1 reply; 27+ messages in thread
From: Wei Liu @ 2016-04-27 13:18 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel, Ian Jackson, Wei Liu

On Wed, Apr 27, 2016 at 01:11:45PM +0200, Roger Pau Monne wrote:
> *size should be used instead, because it contains the size of the buffer in
> out_buf.
> 
> Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> ---
> Cc: Ian Jackson <ian.jackson@eu.citrix.com>
> Cc: Wei Liu <wei.liu2@citrix.com>
> ---
> Changes since v2:
>  - Use *size instead of 0, because it will contain the actual size of the
>    out_buf buffer.

Ian, this is a backport candidate.

Note that the code still functions without this fix because the third
parameter to xc_dom_register_external is only for accounting purpose.

Wei.

> ---
>  tools/libxc/xc_dom_bzimageloader.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/tools/libxc/xc_dom_bzimageloader.c b/tools/libxc/xc_dom_bzimageloader.c
> index 7fde42a..33ba06b 100644
> --- a/tools/libxc/xc_dom_bzimageloader.c
> +++ b/tools/libxc/xc_dom_bzimageloader.c
> @@ -482,7 +482,7 @@ static int xc_try_lzo1x_decode(
>          if ( !dst_len )
>          {
>              msg = "Error registering stream output";
> -            if ( xc_dom_register_external(dom, out_buf, out_len) )
> +            if ( xc_dom_register_external(dom, out_buf, *size) )
>                  break;
>  
>              return 0;
> -- 
> 2.6.4 (Apple Git-63)
> 

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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v3 for-4.7 00/16] Fixes for compiling with clang
  2016-04-27 11:11 [PATCH v3 for-4.7 00/16] Fixes for compiling with clang Roger Pau Monne
                   ` (15 preceding siblings ...)
  2016-04-27 11:11 ` [PATCH v3 for-4.7 16/16] tools/pygrub: fix usage of LDFLAGS Roger Pau Monne
@ 2016-04-27 13:23 ` Wei Liu
  16 siblings, 0 replies; 27+ messages in thread
From: Wei Liu @ 2016-04-27 13:23 UTC (permalink / raw)
  To: Roger Pau Monne; +Cc: xen-devel, Wei Liu

On Wed, Apr 27, 2016 at 01:11:38PM +0200, Roger Pau Monne wrote:
> Hello,
> 
> This is a set of bug fixes for compiling both the hypervisor and the 
> toolstack with clang. I've only tested it with clang 3.8.0 from base 
> FreeBSD, so I'm not sure if it's going to work with _all_ clang versions, 
> but should be better than nothing.
> 
> AFAICT, most of the issues that clang found on the toolstack are actual 
> bugs, so it's worth trying to fix them before the release.
> 
> Patches 1-4 are for the hypervisor, while patches 5-16 are for the 
> toolstack.
> 
> FWIW, I've also pushed the series to my git repo:
> 
> git://xenbits.xen.org/people/royger/xen.git clang_v3

I've release-acked this series and pushed it to staging.

Thanks for your work!

Wei.

> 
> Thanks, Roger.
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@lists.xen.org
> http://lists.xen.org/xen-devel

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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v3 for-4.7 07/16] libxc: fix usage of uninitialized variable
  2016-04-27 13:18   ` Wei Liu
@ 2016-04-28 17:43     ` Ian Jackson
  2016-05-09 17:10       ` Ian Jackson
  0 siblings, 1 reply; 27+ messages in thread
From: Ian Jackson @ 2016-04-28 17:43 UTC (permalink / raw)
  To: Wei Liu; +Cc: xen-devel, Roger Pau Monne

Wei Liu writes ("Re: [PATCH v3 for-4.7 07/16] libxc: fix usage of uninitialized variable"):
> Ian, this is a backport candidate.

Noted, thanks.

Ian.

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

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH v3 for-4.7 07/16] libxc: fix usage of uninitialized variable
  2016-04-28 17:43     ` Ian Jackson
@ 2016-05-09 17:10       ` Ian Jackson
  0 siblings, 0 replies; 27+ messages in thread
From: Ian Jackson @ 2016-05-09 17:10 UTC (permalink / raw)
  To: Wei Liu, Roger Pau Monne, xen-devel

Ian Jackson writes ("Re: [PATCH v3 for-4.7 07/16] libxc: fix usage of uninitialized variable"):
> Wei Liu writes ("Re: [PATCH v3 for-4.7 07/16] libxc: fix usage of uninitialized variable"):
> > Ian, this is a backport candidate.
> 
> Noted, thanks.

Backported to 4.6 and 4.5.

Ian.

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

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2016-05-09 17:10 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [PATCH v3 for-4.7 12/16] libxl: add explicit casts from yajl_gen_status to yajl_status Roger Pau Monne
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

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).