[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 2/2] replay: Ignore the return value of fwrite()
From: |
Felipe Franciosi |
Subject: |
[Qemu-devel] [PATCH 2/2] replay: Ignore the return value of fwrite() |
Date: |
Wed, 21 Sep 2016 16:27:02 +0100 |
If building with GCC 3.4 or newer (and using -Werror=unused-result),
replay-internal.c will fail to compile due to a call to fwrite() where
the return value is not used. Since fwrite() is declared with WUR in
glibc, callers should check the return value or find other ways to
ignore it. The error message in this specific case is:
replay/replay-internal.c: In function ‘replay_put_array’:
replay/replay-internal.c:68:15: error: ignoring return value of
‘fwrite’, declared with attribute warn_unused_result [-Werror=unused-result]
fwrite(buf, 1, size, replay_file);
^
This commit wraps the fwrite() call with the ignore_value() macro, which
currently suppresses the error for existing GCC versions.
Signed-off-by: Felipe Franciosi <address@hidden>
---
replay/replay-internal. | 0
replay/replay-internal.c | 2 +-
2 files changed, 1 insertion(+), 1 deletion(-)
create mode 100644 replay/replay-internal.
diff --git a/replay/replay-internal. b/replay/replay-internal.
new file mode 100644
index 0000000..e69de29
diff --git a/replay/replay-internal.c b/replay/replay-internal.c
index 5835e8d..61de8f9 100644
--- a/replay/replay-internal.c
+++ b/replay/replay-internal.c
@@ -65,7 +65,7 @@ void replay_put_array(const uint8_t *buf, size_t size)
{
if (replay_file) {
replay_put_dword(size);
- fwrite(buf, 1, size, replay_file);
+ ignore_value(fwrite(buf, 1, size, replay_file));
}
}
--
1.9.5