Skip to contentSkip to conversation

wxx: Last minute fixes for 2.5

GIT PULL Applied Stefan Weil 3 participants 6 messages Nov 30, 2015

lore
Share & tools
lore
#0 lore raw

The following changes since commit 714487515dbe0c65d5904251e796cd3a5b3579fb:

Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging (2015-11-27 10:44:42 +0000)

are available in the git repository at:

git://qemu.weilnetz.de/qemu.git tags/pull-wxx-20151130

for you to fetch changes up to 78e9d4ad11e7116376328860a58b96765ade7b62:

w32: Use gcc option -mthreads (2015-11-30 06:47:02 +0100)

----------------------------------------------------------------
wxx patch queue

----------------------------------------------------------------
Stefan Weil (3):
trace/simple: Fix warning and wrong trace file name for MinGW
oslib-win32: Change return type of function getpagesize
w32: Use gcc option -mthreads

 configure                 | 2 ++
 include/sysemu/os-win32.h | 2 +-
 trace/simple.c            | 3 ++-
 util/oslib-win32.c        | 2 +-
 4 files changed, 6 insertions(+), 3 deletions(-)
#1 lore raw

[Qemu-devel] [PULL 1/3] trace/simple: Fix warning and wrong trace file name for MinGW

On Windows, getpid() always returns an int value, but pid_t (which is expected by the format string) is either a 32 bit or a 64 bit value.

Without a type cast (or a modified format string), the compiler prints a warning when building for 64 bit Windows and the resulting trace_file_name will include a wrong pid:

trace/simple.c:332:9: warning:
format ‘%lld’ expects argument of type ‘long long int’, but argument 2 has type ‘int’ [-Wformat=]

---
 trace/simple.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
trace/simple.c +2 -1
index 11ad030..56a624c 100644
@@ -329,7 +329,8 @@ bool st_set_trace_file(const char *file)
     g_free(trace_file_name);
 
     if (!file) {
-        trace_file_name = g_strdup_printf(CONFIG_TRACE_FILE, getpid());
+        /* Type cast needed for Windows where getpid() returns an int. */
+        trace_file_name = g_strdup_printf(CONFIG_TRACE_FILE, (pid_t)getpid());
     } else {
         trace_file_name = g_strdup_printf("%s", file);
     }
Signature · 1 line
2.1.4
#2 lore raw

[Qemu-devel] [PULL 2/3] oslib-win32: Change return type of function getpagesize

In reply to Stefan Weil

getpagesize on Linux returns an int. Fix QEMU's implementation for Windows to return an int (instead of size_t), too.

This fixes a compiler warning which was introduced recently (commit 093e3c42).

---
 include/sysemu/os-win32.h | 2 +-
 util/oslib-win32.c        | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
include/sysemu/os-win32.h +1 -1
index 13dcef6..400e098 100644
@@ -87,7 +87,7 @@ static inline void os_setup_post(void) {}
 void os_set_line_buffering(void);
 static inline void os_set_proc_name(const char *dummy) {}
 
-size_t getpagesize(void);
+int getpagesize(void);
 
 #if !defined(EPROTONOSUPPORT)
 # define EPROTONOSUPPORT EINVAL
util/oslib-win32.c +1 -1
index 09f9e98..6a47019 100644
@@ -454,7 +454,7 @@ gint g_poll(GPollFD *fds, guint nfds, gint timeout)
     return retval;
 }
 
-size_t getpagesize(void)
+int getpagesize(void)
 {
     SYSTEM_INFO system_info;
 
Signature · 1 line
2.1.4
Reviewed-by
#3 lore raw

Re: [Qemu-devel] [PULL 2/3] oslib-win32: Change return type of function getpagesize

Quoted 7 lines · Stefan Weil

getpagesize on Linux returns an int. Fix QEMU's implementation for Windows to return an int (instead of size_t), too.

This fixes a compiler warning which was introduced recently (commit 093e3c42).

This makes -Werror + cross mingw64 cross-compiler for win64 work for me.

Thanks, Juan.

#4 lore raw

[Qemu-devel] [PULL 3/3] w32: Use gcc option -mthreads

In reply to Stefan Weil

QEMU uses threads / coroutines, therefore support for thread local storage and thread safe libraries (-D_MT) must be enabled by using -mthreads.

---
 configure | 2 ++
 1 file changed, 2 insertions(+)
configure +2 -0
index 979bc55..67801b0 100755
@@ -727,6 +727,8 @@ if test "$mingw32" = "yes" ; then
   QEMU_CFLAGS="-DWIN32_LEAN_AND_MEAN -DWINVER=0x501 $QEMU_CFLAGS"
   # enable C99/POSIX format strings (needs mingw32-runtime 3.15 or later)
   QEMU_CFLAGS="-D__USE_MINGW_ANSI_STDIO=1 $QEMU_CFLAGS"
+  # MinGW needs -mthreads for TLS and macro _MT.
+  QEMU_CFLAGS="-mthreads $QEMU_CFLAGS"
   LIBS="-lwinmm -lws2_32 -liphlpapi $LIBS"
   write_c_skeleton;
   if compile_prog "" "-liberty" ; then
Signature · 1 line
2.1.4
#5 lore raw
In reply to Stefan Weil
Quoted 21 lines · Stefan Weil

The following changes since commit 714487515dbe0c65d5904251e796cd3a5b3579fb:

Merge remote-tracking branch 'remotes/jasowang/tags/net-pull-request' into staging (2015-11-27 10:44:42 +0000)

are available in the git repository at:

git://qemu.weilnetz.de/qemu.git tags/pull-wxx-20151130

for you to fetch changes up to 78e9d4ad11e7116376328860a58b96765ade7b62:

w32: Use gcc option -mthreads (2015-11-30 06:47:02 +0100)

----------------------------------------------------------------
wxx patch queue

----------------------------------------------------------------
Stefan Weil (3):
trace/simple: Fix warning and wrong trace file name for MinGW
oslib-win32: Change return type of function getpagesize
w32: Use gcc option -mthreads

Quoted 5 lines
 configure                 | 2 ++
 include/sysemu/os-win32.h | 2 +-
 trace/simple.c            | 3 ++-
 util/oslib-win32.c        | 2 +-
 4 files changed, 6 insertions(+), 3 deletions(-)

Applied, thanks.

-- PMM