From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48392) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3HRZ-0002V3-OQ for qemu-devel@nongnu.org; Mon, 30 Nov 2015 00:56:10 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1a3HRY-0001nz-Ru for qemu-devel@nongnu.org; Mon, 30 Nov 2015 00:56:09 -0500 Received: from qemu.weilnetz.de ([2a03:4000:2:362::1]:57091) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1a3HRY-0001ne-LG for qemu-devel@nongnu.org; Mon, 30 Nov 2015 00:56:08 -0500 From: Stefan Weil Date: Mon, 30 Nov 2015 06:55:53 +0100 Message-Id: <1448862955-22955-2-git-send-email-sw@weilnetz.de> In-Reply-To: <1448862955-22955-1-git-send-email-sw@weilnetz.de> References: <1448862955-22955-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] [PULL 1/3] 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: Peter Maydell , Stefan Weil 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