qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org,
	"Andreas Färber" <andreas.faerber@web.de>,
	patches@linaro.org
Subject: [Qemu-devel] [PATCH] disas/i386.c: Add explicit braces round empty for-loop body
Date: Sat,  2 Feb 2013 17:17:54 +0000	[thread overview]
Message-ID: <1359825474-26661-1-git-send-email-peter.maydell@linaro.org> (raw)

Add explicit braces round an empty for-loop body; this fits
QEMU style and is easier to read than an inconspicuous semicolon
at the end of the line. It also silences a clang warning:

disas/i386.c:4723:49: warning: for loop has empty body [-Wempty-body]
          for (i = 0; tmp[i] == '0' && tmp[i + 1]; i++);
                                                       ^
disas/i386.c:4723:49: note: put the semicolon on a separate line to silence this warning [-Wempty-body]

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
---
This is the only clang warning on MacOSX apart from the ones about
deprecated features in audio/coreaudio.c and ui/cocoa.m, which is why
I think it's worth zapping despite it being a style issue in one of the
bits of disassembler code we got from binutils and which aren't generally
in QEMU style.

checkpatch complains about the non-multiple-of-4 indent:
WARNING: suspect code indent for conditional statements (10, 10)
#27: FILE: disas/i386.c:4723:
+          for (i = 0; tmp[i] == '0' && tmp[i + 1]; i++) {
+          }

but I didn't see any value in reindenting the whole function just to
shut it up.

At some point in the 1.5 cycle maybe we could update the code to avoid
the deprecated MacOS functions and then we could enable warnings-are-errors
on MacOS too.

 disas/i386.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/disas/i386.c b/disas/i386.c
index 3b006b1..dbecf1f 100644
--- a/disas/i386.c
+++ b/disas/i386.c
@@ -4720,7 +4720,8 @@ print_operand_value (char *buf, size_t bufsize, int hex, bfd_vma disp)
 	  buf[0] = '0';
 	  buf[1] = 'x';
           snprintf_vma (tmp, sizeof(tmp), disp);
-	  for (i = 0; tmp[i] == '0' && tmp[i + 1]; i++);
+          for (i = 0; tmp[i] == '0' && tmp[i + 1]; i++) {
+          }
           pstrcpy (buf + 2, bufsize - 2, tmp + i);
 	}
       else
-- 
1.7.11.4

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

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-02 17:17 Peter Maydell [this message]
2013-02-02 18:34 ` [Qemu-devel] [PATCH] disas/i386.c: Add explicit braces round empty for-loop body Andreas Färber
2013-02-02 20:46   ` Peter Maydell

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=1359825474-26661-1-git-send-email-peter.maydell@linaro.org \
    --to=peter.maydell@linaro.org \
    --cc=andreas.faerber@web.de \
    --cc=patches@linaro.org \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).