From: Blue Swirl <blauwirbel@gmail.com>
To: qemu-devel <qemu-devel@nongnu.org>, Kevin Wolf <kwolf@redhat.com>
Subject: [Qemu-devel] [PATCH 01/11] block: avoid a write only variable
Date: Wed, 6 Oct 2010 21:31:32 +0000 [thread overview]
Message-ID: <AANLkTimZGXaYE7rvVOBFUmdyn4sQVApY7SS3+3vseap-@mail.gmail.com> (raw)
Compiling with GCC 4.6.0 20100925 produced a warning:
/src/qemu/block/qcow2-refcount.c: In function 'update_refcount':
/src/qemu/block/qcow2-refcount.c:552:13: error: variable 'dummy' set
but not used [-Werror=unused-but-set-variable]
Fix by adding a function that does not generate a warning when
the result is unused.
Signed-off-by: Blue Swirl <blauwirbel@gmail.com>
---
block/qcow2-refcount.c | 18 +++++++++++-------
1 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/block/qcow2-refcount.c b/block/qcow2-refcount.c
index 7082601..dc0851f 100644
--- a/block/qcow2-refcount.c
+++ b/block/qcow2-refcount.c
@@ -27,10 +27,15 @@
#include "block/qcow2.h"
static int64_t alloc_clusters_noref(BlockDriverState *bs, int64_t size);
-static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
- int64_t offset, int64_t length,
- int addend);
+static int update_refcount_nowarn(BlockDriverState *bs,
+ int64_t offset, int64_t length, int addend);
+static inline int QEMU_WARN_UNUSED_RESULT
+update_refcount(BlockDriverState *bs, int64_t offset, int64_t length,
+ int addend)
+{
+ return update_refcount_nowarn(bs, offset, length, addend);
+}
static int cache_refcount_updates = 0;
@@ -457,8 +462,8 @@ static int
write_refcount_block_entries(BlockDriverState *bs,
}
/* XXX: cache several refcount block clusters ? */
-static int QEMU_WARN_UNUSED_RESULT update_refcount(BlockDriverState *bs,
- int64_t offset, int64_t length, int addend)
+static int update_refcount_nowarn(BlockDriverState *bs,
+ int64_t offset, int64_t length, int addend)
{
BDRVQcowState *s = bs->opaque;
int64_t start, last, cluster_offset;
@@ -549,8 +554,7 @@ fail:
* some cases like ENOSPC for allocating a new refcount block)
*/
if (ret < 0) {
- int dummy;
- dummy = update_refcount(bs, offset, cluster_offset - offset, -addend);
+ update_refcount_nowarn(bs, offset, cluster_offset - offset, -addend);
}
return ret;
--
1.6.2.4
next reply other threads:[~2010-10-06 21:31 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-06 21:31 Blue Swirl [this message]
2010-10-07 9:37 ` [Qemu-devel] [PATCH 01/11] block: avoid a write only variable Markus Armbruster
2010-10-07 11:55 ` Kevin Wolf
2010-10-07 18:27 ` Blue Swirl
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=AANLkTimZGXaYE7rvVOBFUmdyn4sQVApY7SS3+3vseap-@mail.gmail.com \
--to=blauwirbel@gmail.com \
--cc=kwolf@redhat.com \
--cc=qemu-devel@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).