From 1c884abeded1fee3680a3f1db655bf70d3b49e97 Mon Sep 17 00:00:00 2001 From: "Dr. David Alan Gilbert" Date: Wed, 12 Feb 2014 17:14:33 +0000 Subject: include/qemu/host-utils.h: Trivial typo: ctz->cto Signed-off-by: Dr. David Alan Gilbert Signed-off-by: Michael Tokarev --- include/qemu/host-utils.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/qemu/host-utils.h b/include/qemu/host-utils.h index de85d28..285c5fb 100644 --- a/include/qemu/host-utils.h +++ b/include/qemu/host-utils.h @@ -217,7 +217,7 @@ static inline int ctz64(uint64_t val) } /** - * ctz64 - count trailing ones in a 64-bit value. + * cto64 - count trailing ones in a 64-bit value. * @val: The value to search * * Returns 64 if the value is -1. -- cgit v1.1 From de580dafade551cf67607f114ff9b5eeb881cc42 Mon Sep 17 00:00:00 2001 From: Hani Benhabiles Date: Tue, 18 Feb 2014 23:42:36 +0100 Subject: object: Report type in error when not user creatable. Signed-off-by: Hani Benhabiles Reviewed-by: Hu Tao Acked-by: Paolo Bonzini Signed-off-by: Michael Tokarev --- qmp.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qmp.c b/qmp.c index d0d98e7..f556a04 100644 --- a/qmp.c +++ b/qmp.c @@ -556,8 +556,8 @@ void object_add(const char *type, const char *id, const QDict *qdict, } if (!object_dynamic_cast(obj, TYPE_USER_CREATABLE)) { - error_setg(&local_err, "object '%s' isn't supported by object-add", - id); + error_setg(&local_err, "object type '%s' isn't supported by object-add", + type); goto out; } -- cgit v1.1 From 0064aceb29faea018dfb7cf0bca5d9644272a295 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 19 Feb 2014 06:11:44 +0100 Subject: bswap: Modify prototype of stb_p (avoid type conversions) The function uses an uint8_t value, so show this in the function prototype. Non-optimizing compilers will avoid unnecessary type conversions from (u)int8_t to int and back to uint8_t when generating calls of this inline function. stw_p, stl_p and stq_p already use similar prototypes. Signed-off-by: Stefan Weil Reviewed-by: Laszlo Ersek Signed-off-by: Michael Tokarev --- include/qemu/bswap.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index 437b8e0..0cc11a5 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -228,7 +228,7 @@ static inline int ldsb_p(const void *ptr) return *(int8_t *)ptr; } -static inline void stb_p(void *ptr, int v) +static inline void stb_p(void *ptr, uint8_t v) { *(uint8_t *)ptr = v; } -- cgit v1.1 From 55e7c29e46f845f503fda3e8cac3f5e0e8b3d984 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Wed, 19 Feb 2014 06:11:45 +0100 Subject: bswap: Modify prototypes of st[wl]_{le, be}_p (avoid type conversions) The functions use uint16_t or uint32_t values, so show this in the function prototypes. Non-optimizing compilers will avoid unnecessary type conversions when generating calls of these inline functions. stq_le_p, stq_be_p already use similar prototypes. Signed-off-by: Stefan Weil Reviewed-by: Laszlo Ersek Signed-off-by: Michael Tokarev --- include/qemu/bswap.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/qemu/bswap.h b/include/qemu/bswap.h index 0cc11a5..0cb7c05 100644 --- a/include/qemu/bswap.h +++ b/include/qemu/bswap.h @@ -300,12 +300,12 @@ static inline uint64_t ldq_le_p(const void *ptr) return le_bswap(ldq_p(ptr), 64); } -static inline void stw_le_p(void *ptr, int v) +static inline void stw_le_p(void *ptr, uint16_t v) { stw_p(ptr, le_bswap(v, 16)); } -static inline void stl_le_p(void *ptr, int v) +static inline void stl_le_p(void *ptr, uint32_t v) { stl_p(ptr, le_bswap(v, 32)); } @@ -365,12 +365,12 @@ static inline uint64_t ldq_be_p(const void *ptr) return be_bswap(ldq_p(ptr), 64); } -static inline void stw_be_p(void *ptr, int v) +static inline void stw_be_p(void *ptr, uint16_t v) { stw_p(ptr, be_bswap(v, 16)); } -static inline void stl_be_p(void *ptr, int v) +static inline void stl_be_p(void *ptr, uint32_t v) { stl_p(ptr, be_bswap(v, 32)); } -- cgit v1.1 From c5d3c49896582bb338e19149b23d3613510059fb Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Fri, 21 Feb 2014 20:52:39 +0100 Subject: tcg: Fix typo in comment (dependancies -> dependencies) Signed-off-by: Stefan Weil Signed-off-by: Michael Tokarev --- tcg/tcg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tcg/tcg.c b/tcg/tcg.c index ffc851e..f1e0763 100644 --- a/tcg/tcg.c +++ b/tcg/tcg.c @@ -41,7 +41,7 @@ #include "qemu/host-utils.h" #include "qemu/timer.h" -/* Note: the long term plan is to reduce the dependancies on the QEMU +/* Note: the long term plan is to reduce the dependencies on the QEMU CPU definitions. Currently they are used for qemu_ld/st instructions */ #define NO_CPU_IO_DEFS -- cgit v1.1 From 8ead6018837f13f1ef4a40c3eb5054512c160577 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Thu, 20 Feb 2014 20:08:31 +0100 Subject: stubs: Optimize dependencies for gdbstub.c It does not need qemu-common.h. Including exec/gdbstub.h fixes a warning from static code analyzers and avoids mismatching declarations for xml_builtin. Signed-off-by: Stefan Weil Signed-off-by: Michael Tokarev --- stubs/gdbstub.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/stubs/gdbstub.c b/stubs/gdbstub.c index c1dbfe7..f6a4553 100644 --- a/stubs/gdbstub.c +++ b/stubs/gdbstub.c @@ -1,4 +1,6 @@ -#include "qemu-common.h" +#include "stdbool.h" /* bool (in exec/gdbstub.h) */ +#include "stddef.h" /* NULL */ +#include "exec/gdbstub.h" /* xml_builtin */ const char *const xml_builtin[][2] = { { NULL, NULL } -- cgit v1.1 From 7edd9ddc979f112287ff5184590830c67ea991bf Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Wed, 26 Feb 2014 23:39:46 +0000 Subject: tests/test-int128: Don't use __noclone__ attribute on clang clang doesn't support the __noclone__ attribute and emits a warning about it. Fortunately clang also implements a mechanism for asking if a particular attribute is implemented; use it. We assume that if the compiler doesn't support __has_attribute() then it must be GCC and must support __noclone__. Signed-off-by: Peter Maydell Signed-off-by: Michael Tokarev --- tests/test-int128.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/tests/test-int128.c b/tests/test-int128.c index 5aca032..0772ef7 100644 --- a/tests/test-int128.c +++ b/tests/test-int128.c @@ -11,6 +11,19 @@ #include "qemu/int128.h" #include "qemu/osdep.h" +/* clang doesn't support __noclone__ but it does have a mechanism for + * telling us this. We assume that if we don't have __has_attribute() + * then this is GCC and that GCC always supports __noclone__. + */ +#if defined(__has_attribute) +#if !__has_attribute(__noclone__) +#define ATTRIBUTE_NOCLONE +#endif +#endif +#ifndef ATTRIBUTE_NOCLONE +#define ATTRIBUTE_NOCLONE __attribute__((__noclone__)) +#endif + static uint32_t tests[8] = { 0x00000000, 0x00000001, 0x7FFFFFFE, 0x7FFFFFFF, 0x80000000, 0x80000001, 0xFFFFFFFE, 0xFFFFFFFF, @@ -164,7 +177,7 @@ static void test_gt(void) /* Make sure to test undefined behavior at runtime! */ -static void __attribute__((__noinline__, __noclone__)) +static void __attribute__((__noinline__)) ATTRIBUTE_NOCLONE test_rshift_one(uint32_t x, int n, uint64_t h, uint64_t l) { Int128 a = expand(x); -- cgit v1.1 From aa830cdc28edb69c1fe81c8fd9471ab288ad0926 Mon Sep 17 00:00:00 2001 From: Peter Maydell Date: Wed, 26 Feb 2014 23:51:46 +0000 Subject: qjson.h: Remove spurious GCC_FMT_ATTR markup from qobject_from_json() declaration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The function qobject_from_json() doesn't actually allow its argument to be a format string -- it passes a NULL va_list* to qobject_from_jsonv(), and the parser code will then never actually interpret %-escape sequences (it tests whether the va_list pointer is NULL and will stop with a parse error). The spurious attribute markup causes clang warnings in some of the test cases where we programmatically construct JSON to feed to qobject_from_json(): tests/test-qmp-input-visitor.c:76:35: warning: format string is not a string literal (potentially insecure) [-Wformat-security] data->obj = qobject_from_json(json_string); ^~~~~~~~~~~ Remove the incorrect attribute. Signed-off-by: Peter Maydell Suggested-by: Paolo Bonzini Reviewed-by: Eric Blake Reviewed-by: Andreas Färber Signed-off-by: Michael Tokarev --- include/qapi/qmp/qjson.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/qapi/qmp/qjson.h b/include/qapi/qmp/qjson.h index 73351ed..ee4d31a 100644 --- a/include/qapi/qmp/qjson.h +++ b/include/qapi/qmp/qjson.h @@ -19,7 +19,7 @@ #include "qapi/qmp/qobject.h" #include "qapi/qmp/qstring.h" -QObject *qobject_from_json(const char *string) GCC_FMT_ATTR(1, 0); +QObject *qobject_from_json(const char *string); QObject *qobject_from_jsonf(const char *string, ...) GCC_FMT_ATTR(1, 2); QObject *qobject_from_jsonv(const char *string, va_list *ap) GCC_FMT_ATTR(1, 0); -- cgit v1.1 From cc99c6f5ff3fb2acfa52764a539e129cada104e4 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sun, 23 Feb 2014 18:02:07 +0100 Subject: util/iov: Use qemu/sockets.h instead of conditional code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stefan Weil Reviewed-by: Paolo Bonzini Reviewed-by: Andreas Färber Signed-off-by: Michael Tokarev --- util/iov.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/util/iov.c b/util/iov.c index 03934da..6569b5a 100644 --- a/util/iov.c +++ b/util/iov.c @@ -17,14 +17,7 @@ */ #include "qemu/iov.h" - -#ifdef _WIN32 -# include -# include -#else -# include -# include -#endif +#include "qemu/sockets.h" size_t iov_from_buf(const struct iovec *iov, unsigned int iov_cnt, size_t offset, const void *buf, size_t bytes) -- cgit v1.1 From 777872e5c65dabb1d80b8c13427c6a3e58dafe40 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sun, 23 Feb 2014 18:02:08 +0100 Subject: exec: Remove unneeded include files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This file does not depend on windows.h. Signed-off-by: Stefan Weil Reviewed-by: Paolo Bonzini Reviewed-by: Andreas Färber Signed-off-by: Michael Tokarev --- exec.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/exec.c b/exec.c index b69fd29..680268a 100644 --- a/exec.c +++ b/exec.c @@ -17,9 +17,7 @@ * License along with this library; if not, see . */ #include "config.h" -#ifdef _WIN32 -#include -#else +#ifndef _WIN32 #include #include #endif -- cgit v1.1 From 67d065c3db489882dce1502246d5fcca10396ea4 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sun, 23 Feb 2014 18:02:09 +0100 Subject: qemu-img: Remove unneeded include files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit There is no dependency on windows.h, and the standard include files are already included by qemu-common.h. Signed-off-by: Stefan Weil Reviewed-by: Paolo Bonzini Reviewed-by: Andreas Färber Signed-off-by: Michael Tokarev --- qemu-img.c | 6 ------ 1 file changed, 6 deletions(-) diff --git a/qemu-img.c b/qemu-img.c index 78fc868..886db88 100644 --- a/qemu-img.c +++ b/qemu-img.c @@ -32,12 +32,6 @@ #include "block/block_int.h" #include "block/qapi.h" #include -#include -#include - -#ifdef _WIN32 -#include -#endif typedef struct img_cmd_t { const char *name; -- cgit v1.1 From cae8a9289b9ee874bc8711c2629037661061b9c1 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sun, 23 Feb 2014 18:02:10 +0100 Subject: qga: Remove unneeded include file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This file does not depend on windows.h. Signed-off-by: Stefan Weil Reviewed-by: Paolo Bonzini Reviewed-by: Andreas Färber Signed-off-by: Michael Tokarev --- qga/main.c | 1 - 1 file changed, 1 deletion(-) diff --git a/qga/main.c b/qga/main.c index cfca291..d838c3e 100644 --- a/qga/main.c +++ b/qga/main.c @@ -35,7 +35,6 @@ #ifdef _WIN32 #include "qga/service-win32.h" #include "qga/vss-win32.h" -#include #endif #ifdef __linux__ #include -- cgit v1.1 From 25254a7191cdaa6cc10edb7bdbbfd0a6d02b9905 Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Sun, 23 Feb 2014 18:02:11 +0100 Subject: vl: Remove unneeded include file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This file does not depend on windows.h. Cc: Anthony Liguori Signed-off-by: Stefan Weil Reviewed-by: Paolo Bonzini Reviewed-by: Andreas Färber Signed-off-by: Michael Tokarev --- vl.c | 4 ---- 1 file changed, 4 deletions(-) diff --git a/vl.c b/vl.c index 1d27b34..bf61910 100644 --- a/vl.c +++ b/vl.c @@ -38,10 +38,6 @@ #include #endif -#ifdef _WIN32 -#include -#endif - #ifdef CONFIG_SDL #if defined(__APPLE__) || defined(main) #include -- cgit v1.1