From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33236) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZfZMM-0000vC-Nm for qemu-devel@nongnu.org; Fri, 25 Sep 2015 16:12:47 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZfZMI-0002vz-Od for qemu-devel@nongnu.org; Fri, 25 Sep 2015 16:12:46 -0400 From: Stefan Weil Date: Fri, 25 Sep 2015 22:12:30 +0200 Message-Id: <1443211950-8207-1-git-send-email-sw@weilnetz.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: [Qemu-devel] [PATCH] trace/simple: Fix warning and wrong trace file name for MinGW List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: QEMU Developer Cc: QEMU Trivial , Stefan Weil , Stefan Hajnoczi 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_n= ame will include a wrong pid: trace/simple.c:332:9: warning: format =E2=80=98%lld=E2=80=99 expects argument of type =E2=80=98long lon= g int=E2=80=99, but argument 2 has type =E2=80=98int=E2=80=99 [-Wformat=3D] Signed-off-by: Stefan Weil --- trace/simple.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/trace/simple.c b/trace/simple.c index 11ad030..56a624c 100644 --- a/trace/simple.c +++ b/trace/simple.c @@ -329,7 +329,8 @@ bool st_set_trace_file(const char *file) g_free(trace_file_name); =20 if (!file) { - trace_file_name =3D g_strdup_printf(CONFIG_TRACE_FILE, getpid())= ; + /* Type cast needed for Windows where getpid() returns an int. *= / + trace_file_name =3D g_strdup_printf(CONFIG_TRACE_FILE, (pid_t)ge= tpid()); } else { trace_file_name =3D g_strdup_printf("%s", file); } --=20 2.1.4