All of lore.kernel.org
 help / color / mirror / Atom feed
From: Stefan Weil <sw@weilnetz.de>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org,
	Anthony Liguori <anthony@codemonkey.ws>
Subject: Re: [Qemu-trivial] [PULL 05/15] translate-all: Fix formatting of dump output
Date: Tue, 17 Sep 2013 19:59:43 +0200	[thread overview]
Message-ID: <5238988F.8050807@weilnetz.de> (raw)
In-Reply-To: <1379188061-7634-6-git-send-email-mjt@msgid.tls.msk.ru>

Am 14.09.2013 21:47, schrieb Michael Tokarev:
> From: Stefan Weil <sw@weilnetz.de>
>
> The page dump writes a table with 3 abi_ulong values in each row.
> These values take 8 or 16 characters (depending on sizeof abi_ulong).
>
> Fix the table headings to be aligned with the table columns.
>
> old:
> start    end      size     prot
> 0000000120000000-000000012021e000 000000000021e000 rwx
> 0000004000000000-0000004000002000 0000000000002000 ---
> 0000004000002000-0000004000802000 0000000000800000 rw-
>
> new:
> start            end              size             prot
> 0000000120000000-000000012021e000 000000000021e000 rwx
> 0000004000000000-0000004000002000 0000000000002000 ---
> 0000004000002000-0000004000802000 0000000000800000 rw-
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
> ---
>  translate-all.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/translate-all.c b/translate-all.c
> index 2c923c6..3b97c66 100644
> --- a/translate-all.c
> +++ b/translate-all.c
> @@ -1679,8 +1679,9 @@ static int dump_region(void *priv, abi_ulong start,
>  /* dump memory mappings */
>  void page_dump(FILE *f)
>  {
> -    (void) fprintf(f, "%-8s %-8s %-8s %s\n",
> -            "start", "end", "size", "prot");
> +    const size_t length = sizeof(abi_ulong) * 2;
> +    (void) fprintf(f, "%-*s %-*s %-*s %s\n",
> +            length, "start", length, "end", length, "size", "prot");
>      walk_memory_regions(f, dump_region);
>  }
>  

Sorry, I just noticed that this patch causes compiler warnings on some
systems:

translate-all.c:1684:13: error: field width specifier ‘*’ expects
argument of type ‘int’, but argument 3 has type ‘size_t’ [-Werror=format]
translate-all.c:1684:13: error: field width specifier ‘*’ expects
argument of type ‘int’, but argument 5 has type ‘size_t’ [-Werror=format]
translate-all.c:1684:13: error: field width specifier ‘*’ expects
argument of type ‘int’, but argument 7 has type ‘size_t’ [-Werror=format]

Changing the type of variable 'length' to int fixes this:

+    const int length = sizeof(abi_ulong) * 2;


Regards,
Stefan



WARNING: multiple messages have this Message-ID (diff)
From: Stefan Weil <sw@weilnetz.de>
To: Michael Tokarev <mjt@tls.msk.ru>
Cc: qemu-trivial@nongnu.org, qemu-devel@nongnu.org,
	Anthony Liguori <anthony@codemonkey.ws>
Subject: Re: [Qemu-devel] [PULL 05/15] translate-all: Fix formatting of dump output
Date: Tue, 17 Sep 2013 19:59:43 +0200	[thread overview]
Message-ID: <5238988F.8050807@weilnetz.de> (raw)
In-Reply-To: <1379188061-7634-6-git-send-email-mjt@msgid.tls.msk.ru>

Am 14.09.2013 21:47, schrieb Michael Tokarev:
> From: Stefan Weil <sw@weilnetz.de>
>
> The page dump writes a table with 3 abi_ulong values in each row.
> These values take 8 or 16 characters (depending on sizeof abi_ulong).
>
> Fix the table headings to be aligned with the table columns.
>
> old:
> start    end      size     prot
> 0000000120000000-000000012021e000 000000000021e000 rwx
> 0000004000000000-0000004000002000 0000000000002000 ---
> 0000004000002000-0000004000802000 0000000000800000 rw-
>
> new:
> start            end              size             prot
> 0000000120000000-000000012021e000 000000000021e000 rwx
> 0000004000000000-0000004000002000 0000000000002000 ---
> 0000004000002000-0000004000802000 0000000000800000 rw-
>
> Signed-off-by: Stefan Weil <sw@weilnetz.de>
> Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
> ---
>  translate-all.c |    5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/translate-all.c b/translate-all.c
> index 2c923c6..3b97c66 100644
> --- a/translate-all.c
> +++ b/translate-all.c
> @@ -1679,8 +1679,9 @@ static int dump_region(void *priv, abi_ulong start,
>  /* dump memory mappings */
>  void page_dump(FILE *f)
>  {
> -    (void) fprintf(f, "%-8s %-8s %-8s %s\n",
> -            "start", "end", "size", "prot");
> +    const size_t length = sizeof(abi_ulong) * 2;
> +    (void) fprintf(f, "%-*s %-*s %-*s %s\n",
> +            length, "start", length, "end", length, "size", "prot");
>      walk_memory_regions(f, dump_region);
>  }
>  

Sorry, I just noticed that this patch causes compiler warnings on some
systems:

translate-all.c:1684:13: error: field width specifier ‘*’ expects
argument of type ‘int’, but argument 3 has type ‘size_t’ [-Werror=format]
translate-all.c:1684:13: error: field width specifier ‘*’ expects
argument of type ‘int’, but argument 5 has type ‘size_t’ [-Werror=format]
translate-all.c:1684:13: error: field width specifier ‘*’ expects
argument of type ‘int’, but argument 7 has type ‘size_t’ [-Werror=format]

Changing the type of variable 'length' to int fixes this:

+    const int length = sizeof(abi_ulong) * 2;


Regards,
Stefan

  reply	other threads:[~2013-09-17 18:00 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-14 19:47 [Qemu-trivial] [PULL 00/15] trivial patches for 2013-09-14 Michael Tokarev
2013-09-14 19:47 ` [Qemu-devel] " Michael Tokarev
2013-09-14 19:47 ` [Qemu-trivial] [PULL 01/15] configure: Undefine _FORTIFY_SOURCE prior using it Michael Tokarev
2013-09-14 19:47   ` [Qemu-devel] " Michael Tokarev
2013-09-14 19:47 ` [Qemu-trivial] [PULL 02/15] q35: Fix typo in constant DEFUALT -> DEFAULT Michael Tokarev
2013-09-14 19:47   ` [Qemu-devel] " Michael Tokarev
2013-09-14 19:47 ` [Qemu-trivial] [PULL 03/15] docs: Fix IO port number for CPU present bitmap Michael Tokarev
2013-09-14 19:47   ` [Qemu-devel] " Michael Tokarev
2013-09-14 19:47 ` [Qemu-trivial] [PULL 04/15] *-user: Fix typo in comment (ulocking -> unlocking) Michael Tokarev
2013-09-14 19:47   ` [Qemu-devel] " Michael Tokarev
2013-09-14 19:47 ` [Qemu-trivial] [PULL 05/15] translate-all: Fix formatting of dump output Michael Tokarev
2013-09-14 19:47   ` [Qemu-devel] " Michael Tokarev
2013-09-17 17:59   ` Stefan Weil [this message]
2013-09-17 17:59     ` Stefan Weil
2013-09-14 19:47 ` [Qemu-trivial] [PULL 06/15] MAINTAINERS: Add missing entry to filelist for TCI target Michael Tokarev
2013-09-14 19:47   ` [Qemu-devel] " Michael Tokarev
2013-09-14 19:47 ` [Qemu-trivial] [PULL 07/15] *-user: Improve documentation for lock_user function Michael Tokarev
2013-09-14 19:47   ` [Qemu-devel] " Michael Tokarev
2013-09-14 19:47 ` [Qemu-trivial] [PULL 08/15] tci: Fix qemu-alpha on 32 bit hosts (wrong assertions) Michael Tokarev
2013-09-14 19:47   ` [Qemu-devel] " Michael Tokarev
2013-09-14 19:47 ` [Qemu-trivial] [PULL 09/15] trace-events: Clean up with scripts/cleanup-trace-events.pl again Michael Tokarev
2013-09-14 19:47   ` [Qemu-devel] " Michael Tokarev
2013-09-14 19:47 ` [Qemu-trivial] [PULL 10/15] vscclient: remove unnecessary use of uninitialized variable Michael Tokarev
2013-09-14 19:47   ` [Qemu-devel] " Michael Tokarev
2013-09-14 19:47 ` [Qemu-trivial] [PULL 11/15] iov: avoid "orig_len may be used unitialized" warning Michael Tokarev
2013-09-14 19:47   ` [Qemu-devel] " Michael Tokarev
2013-09-14 19:47 ` [Qemu-trivial] [PULL 12/15] target-i386: Fix segment cache dump Michael Tokarev
2013-09-14 19:47   ` [Qemu-devel] " Michael Tokarev
2013-09-14 19:47 ` [Qemu-trivial] [PULL 13/15] Makefile: Remove some more files when cleaning Michael Tokarev
2013-09-14 19:47   ` [Qemu-devel] " Michael Tokarev
2013-09-14 19:47 ` [Qemu-trivial] [PULL 14/15] tcg-sparc: Fix parenthesis warning Michael Tokarev
2013-09-14 19:47   ` [Qemu-devel] " Michael Tokarev
2013-09-14 19:47 ` [Qemu-trivial] [PULL 15/15] configure: Enable extra compiler warnings Michael Tokarev
2013-09-14 19:47   ` [Qemu-devel] " Michael Tokarev
2013-09-17 15:06 ` [Qemu-trivial] [Qemu-devel] [PULL 00/15] trivial patches for 2013-09-14 Anthony Liguori
2013-09-17 15:06   ` Anthony Liguori
2013-09-17 16:38   ` [Qemu-trivial] " Stefan Weil
2013-09-17 16:38     ` Stefan Weil
2013-09-18  8:19   ` [Qemu-trivial] " Michael Tokarev
2013-09-18  8:19     ` Michael Tokarev

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5238988F.8050807@weilnetz.de \
    --to=sw@weilnetz.de \
    --cc=anthony@codemonkey.ws \
    --cc=mjt@tls.msk.ru \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.