Patchwork trace: Adapt trace file name for Haiku

login
register
mail settings
Submitter Andreas Färber
Date Oct. 9, 2010, 7:55 p.m.
Message ID <1286654117-16193-1-git-send-email-andreas.faerber@web.de>
Download mbox | patch
Permalink /patch/67329/
State New
Headers show

Comments

Andreas Färber - Oct. 9, 2010, 7:55 p.m.
Resolves the following warning:

  CC    simpletrace.o
/Data/QEMU/qemu/simpletrace.c: In function 'st_set_trace_file':
/Data/QEMU/qemu/simpletrace.c:77: warning: format '%u' expects type 'unsigned int', but argument 3 has type 'pid_t'

Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Andreas Färber <andreas.faerber@web.de>
---
 configure |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
Ingo Weinhold - Oct. 9, 2010, 9:18 p.m.
On 2010-10-09 at 21:55:17 [+0200], Andreas Färber <andreas.faerber@web.de> wrote:
> Resolves the following warning:
> 
>   CC    simpletrace.o
> /Data/QEMU/qemu/simpletrace.c: In function 'st_set_trace_file':
> /Data/QEMU/qemu/simpletrace.c:77: warning: format '%u' expects type 
> 'unsigned int', but argument 3 has type 'pid_t'
> 
> Cc: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
> Cc: Blue Swirl <blauwirbel@gmail.com>
> Signed-off-by: Andreas Färber <andreas.faerber@web.de>
> ---
>  configure |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/configure b/configure
> index d303061..3e694a2 100755
> --- a/configure
> +++ b/configure
> @@ -2609,7 +2609,11 @@ if test "$trace_backend" = "simple"; then
>  fi
>  # Set the appropriate trace file.
>  if test "$trace_backend" = "simple"; then
> -  trace_file="\"$trace_file-%u\""
> +  if test "$haiku" = "yes"; then
> +    trace_file="\"$trace_file-%lu\""
> +  else
> +    trace_file="\"$trace_file-%u\""
> +  fi
>  fi
>  echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak
>  
> --
> 1.7.3

Please don't apply. The patch doesn't work for 64 bit Haiku.

According to POSIX:

  "blksize_t, pid_t, and ssize_t shall be signed integer types."

and

  "... the widths of blksize_t, pid_t, size_t, ssize_t, and suseconds_t are no greater 
than the width of type long"

So a safe and portable solution would be to use "%ld" and cast the pid_t to long.

CU, Ingo

Patch

diff --git a/configure b/configure
index d303061..3e694a2 100755
--- a/configure
+++ b/configure
@@ -2609,7 +2609,11 @@  if test "$trace_backend" = "simple"; then
 fi
 # Set the appropriate trace file.
 if test "$trace_backend" = "simple"; then
-  trace_file="\"$trace_file-%u\""
+  if test "$haiku" = "yes"; then
+    trace_file="\"$trace_file-%lu\""
+  else
+    trace_file="\"$trace_file-%u\""
+  fi
 fi
 echo "CONFIG_TRACE_FILE=$trace_file" >> $config_host_mak