Skip to contentSkip to conversation

Trivial patches for 2014-03-04

GIT PULL Applied Michael Tokarev 2 participants 15 messages Mar 4, 2014

lore
Share & tools
lore
#0 lore raw

Here's another pull request for trivial-patches tree. There's nothing exciting in there, small things here and there. Please consider pulling/applying.

Thanks,

/mjt

The following changes since commit d844a7b6569fb2b5252773444b18841426e5b906:

  modules: Fix building with --enable-modules (2014-02-28 12:30:13 +0000)

are available in the git repository at:

git://git.corpit.ru/qemu.git tags/trivial-patches-2014-03-04

for you to fetch changes up to 25254a7191cdaa6cc10edb7bdbbfd0a6d02b9905:

vl: Remove unneeded include file (2014-03-03 09:46:27 +0400)

----------------------------------------------------------------
trivial patches for 2014-03-04

----------------------------------------------------------------
Dr. David Alan Gilbert (1):

      include/qemu/host-utils.h: Trivial typo: ctz->cto

Hani Benhabiles (1):
object: Report type in error when not user creatable.

Peter Maydell (2):
tests/test-int128: Don't use __noclone__ attribute on clang qjson.h: Remove spurious GCC_FMT_ATTR markup from qobject_from_json() declaration

Stefan Weil (9):
bswap: Modify prototype of stb_p (avoid type conversions)
bswap: Modify prototypes of st[wl]_{le, be}_p (avoid type conversions)
tcg: Fix typo in comment (dependancies -> dependencies)
stubs: Optimize dependencies for gdbstub.c
util/iov: Use qemu/sockets.h instead of conditional code
exec: Remove unneeded include files
qemu-img: Remove unneeded include files
qga: Remove unneeded include file
vl: Remove unneeded include file

 exec.c                    |    4 +---
 include/qapi/qmp/qjson.h  |    2 +-
 include/qemu/bswap.h      |   10 +++++-----
 include/qemu/host-utils.h |    2 +-
 qemu-img.c                |    6 ------
 qga/main.c                |    1 -
 qmp.c                     |    4 ++--
 stubs/gdbstub.c           |    4 +++-
 tcg/tcg.c                 |    2 +-
 tests/test-int128.c       |   15 ++++++++++++++-
 util/iov.c                |    9 +--------
 vl.c                      |    4 ----
 12 files changed, 29 insertions(+), 34 deletions(-)
#1 lore raw

[Qemu-devel] [PULL 05/13] tcg: Fix typo in comment (dependancies -> dependencies)

From: Stefan Weil <[email protected]>

---
 tcg/tcg.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tcg/tcg.c +1 -1
index ffc851e..f1e0763 100644
@@ -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
Signature · 1 line
1.7.10.4
#2 lore raw

[Qemu-devel] [PULL 01/13] include/qemu/host-utils.h: Trivial typo: ctz->cto

In reply to Michael Tokarev

From: "Dr. David Alan Gilbert" <[email protected]>

---
 include/qemu/host-utils.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/qemu/host-utils.h +1 -1
index de85d28..285c5fb 100644
@@ -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.
Signature · 1 line
1.7.10.4
#3 lore raw

[Qemu-devel] [PULL 02/13] object: Report type in error when not user creatable.

In reply to Michael Tokarev

From: Hani Benhabiles <[email protected]>

---
 qmp.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
qmp.c +2 -2
index d0d98e7..f556a04 100644
@@ -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;
     }
 
Signature · 1 line
1.7.10.4
#4 lore raw

[Qemu-devel] [PULL 13/13] vl: Remove unneeded include file

In reply to Michael Tokarev

From: Stefan Weil <[email protected]>

This file does not depend on windows.h.

---
 vl.c |    4 ----
 1 file changed, 4 deletions(-)
vl.c +0 -4
index 1d27b34..bf61910 100644
@@ -38,10 +38,6 @@
 #include <libvdeplug.h>
 #endif
 
-#ifdef _WIN32
-#include <windows.h>
-#endif
-
 #ifdef CONFIG_SDL
 #if defined(__APPLE__) || defined(main)
 #include <SDL.h>
Signature · 1 line
1.7.10.4
#5 lore raw

[Qemu-devel] [PULL 06/13] stubs: Optimize dependencies for gdbstub.c

In reply to Michael Tokarev

From: Stefan Weil <[email protected]>

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.

---
 stubs/gdbstub.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
stubs/gdbstub.c +3 -1
index c1dbfe7..f6a4553 100644
@@ -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 }
Signature · 1 line
1.7.10.4
#6 lore raw

[Qemu-devel] [PULL 09/13] util/iov: Use qemu/sockets.h instead of conditional code

In reply to Michael Tokarev

From: Stefan Weil <[email protected]>

---
 util/iov.c |    9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
util/iov.c +1 -8
index 03934da..6569b5a 100644
@@ -17,14 +17,7 @@
  */
 
 #include "qemu/iov.h"
-
-#ifdef _WIN32
-# include <windows.h>
-# include <winsock2.h>
-#else
-# include <sys/types.h>
-# include <sys/socket.h>
-#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)
Signature · 1 line
1.7.10.4
#7 lore raw

[Qemu-devel] [PULL 11/13] qemu-img: Remove unneeded include files

In reply to Michael Tokarev

From: Stefan Weil <[email protected]>

There is no dependency on windows.h, and the standard include files are already included by qemu-common.h.

---
 qemu-img.c |    6 ------
 1 file changed, 6 deletions(-)
qemu-img.c +0 -6
index 78fc868..886db88 100644
@@ -32,12 +32,6 @@
 #include "block/block_int.h"
 #include "block/qapi.h"
 #include <getopt.h>
-#include <stdio.h>
-#include <stdarg.h>
-
-#ifdef _WIN32
-#include <windows.h>
-#endif
 
 typedef struct img_cmd_t {
     const char *name;
Signature · 1 line
1.7.10.4
#8 lore raw

[Qemu-devel] [PULL 03/13] bswap: Modify prototype of stb_p (avoid type conversions)

In reply to Michael Tokarev

From: Stefan Weil <[email protected]>

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.

---
 include/qemu/bswap.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/qemu/bswap.h +1 -1
index 437b8e0..0cc11a5 100644
@@ -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;
 }
Signature · 1 line
1.7.10.4
#9 lore raw

[Qemu-devel] [PULL 07/13] tests/test-int128: Don't use __noclone__ attribute on clang

In reply to Michael Tokarev

From: Peter Maydell <[email protected]>

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

---
 tests/test-int128.c |   15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)
tests/test-int128.c +14 -1
index 5aca032..0772ef7 100644
@@ -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);
Signature · 1 line
1.7.10.4
#10 lore raw

[Qemu-devel] [PULL 08/13] qjson.h: Remove spurious GCC_FMT_ATTR markup from qobject_from_json() declaration

In reply to Michael Tokarev

From: Peter Maydell <[email protected]>

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.

---
 include/qapi/qmp/qjson.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/qapi/qmp/qjson.h +1 -1
index 73351ed..ee4d31a 100644
@@ -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);
 
Signature · 1 line
1.7.10.4
#11 lore raw

[Qemu-devel] [PULL 12/13] qga: Remove unneeded include file

In reply to Michael Tokarev

From: Stefan Weil <[email protected]>

This file does not depend on windows.h.

---
 qga/main.c |    1 -
 1 file changed, 1 deletion(-)
qga/main.c +0 -1
index cfca291..d838c3e 100644
@@ -35,7 +35,6 @@
 #ifdef _WIN32
 #include "qga/service-win32.h"
 #include "qga/vss-win32.h"
-#include <windows.h>
 #endif
 #ifdef __linux__
 #include <linux/fs.h>
Signature · 1 line
1.7.10.4
#12 lore raw

[Qemu-devel] [PULL 10/13] exec: Remove unneeded include files

In reply to Michael Tokarev

From: Stefan Weil <[email protected]>

This file does not depend on windows.h.

---
 exec.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
exec.c +1 -3
index b69fd29..680268a 100644
@@ -17,9 +17,7 @@
  * License along with this library; if not, see <http://www.gnu.org/licenses/>.
  */
 #include "config.h"
-#ifdef _WIN32
-#include <windows.h>
-#else
+#ifndef _WIN32
 #include <sys/types.h>
 #include <sys/mman.h>
 #endif
Signature · 1 line
1.7.10.4
#13 lore raw

[Qemu-devel] [PULL 04/13] bswap: Modify prototypes of st[wl]_{le, be}_p (avoid type conversions)

In reply to Michael Tokarev

From: Stefan Weil <[email protected]>

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.

---
 include/qemu/bswap.h |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
include/qemu/bswap.h +4 -4
index 0cc11a5..0cb7c05 100644
@@ -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));
 }
Signature · 1 line
1.7.10.4
#14 lore raw
In reply to Michael Tokarev
Quoted 12 lines · Michael Tokarev

Here's another pull request for trivial-patches tree. There's nothing exciting in there, small things here and there. Please consider pulling/applying.

Thanks,

/mjt

The following changes since commit d844a7b6569fb2b5252773444b18841426e5b906:

  modules: Fix building with --enable-modules (2014-02-28 12:30:13 +0000)
Quoted 7 lines

are available in the git repository at:

git://git.corpit.ru/qemu.git tags/trivial-patches-2014-03-04

for you to fetch changes up to 25254a7191cdaa6cc10edb7bdbbfd0a6d02b9905:

vl: Remove unneeded include file (2014-03-03 09:46:27 +0400)

Applied, thanks.

-- PMM