From: Stefan Weil <weil@mail.berlios.de>
To: QEMU Developers <qemu-devel@nongnu.org>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
Wayne Xia <xiawenc@linux.vnet.ibm.com>
Subject: [Qemu-devel] [PATCH] Fix gcc-4.6 compiler error
Date: Fri, 29 Jul 2011 21:30:24 +0200 [thread overview]
Message-ID: <1311967824-5218-1-git-send-email-weil@mail.berlios.de> (raw)
Commit 3d3b8303c6f83b9b245bc774af530a6403cc4ce6
breaks builds with gcc-4.6:
hw/fw_cfg.c: In function ‘probe_splashfile’:
hw/fw_cfg.c:66:9: error: variable ‘fop_ret’ set but not used [-Werror=unused-but-set-variable]
hw/fw_cfg.c: In function ‘fw_cfg_bootsplash’:
hw/fw_cfg.c:130:9: error: variable ‘fop_ret’ set but not used [-Werror=unused-but-set-variable]
Remove fop_ret. Testing the result of fread() is normally
a good idea, but I don't think it is needed here.
Cc: Wayne Xia <xiawenc@linux.vnet.ibm.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
hw/fw_cfg.c | 8 +++-----
1 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/hw/fw_cfg.c b/hw/fw_cfg.c
index a29db90..d906b83 100644
--- a/hw/fw_cfg.c
+++ b/hw/fw_cfg.c
@@ -63,7 +63,6 @@ struct FWCfgState {
static FILE *probe_splashfile(char *filename, int *file_sizep, int *file_typep)
{
FILE *fp = NULL;
- int fop_ret;
int file_size;
int file_type = -1;
unsigned char buf[2] = {0, 0};
@@ -86,7 +85,7 @@ static FILE *probe_splashfile(char *filename, int *file_sizep, int *file_typep)
}
/* check magic ID */
fseek(fp, 0L, SEEK_SET);
- fop_ret = fread(buf, 1, 2, fp);
+ (void)fread(buf, 1, 2, fp);
filehead_value = (buf[0] + (buf[1] << 8)) & 0xffff;
if (filehead_value == 0xd8ff) {
file_type = JPG_FILE;
@@ -105,7 +104,7 @@ static FILE *probe_splashfile(char *filename, int *file_sizep, int *file_typep)
/* check BMP bpp */
if (file_type == BMP_FILE) {
fseek(fp, 28, SEEK_SET);
- fop_ret = fread(buf, 1, 2, fp);
+ (void)fread(buf, 1, 2, fp);
bmp_bpp = (buf[0] + (buf[1] << 8)) & 0xffff;
if (bmp_bpp != 24) {
error_report("only 24bpp bmp file is supported.");
@@ -127,7 +126,6 @@ static void fw_cfg_bootsplash(FWCfgState *s)
char *p;
char *filename;
FILE *fp;
- int fop_ret;
int file_size;
int file_type = -1;
const char *temp;
@@ -180,7 +178,7 @@ static void fw_cfg_bootsplash(FWCfgState *s)
boot_splash_filedata = qemu_malloc(file_size);
boot_splash_filedata_size = file_size;
fseek(fp, 0L, SEEK_SET);
- fop_ret = fread(boot_splash_filedata, 1, file_size, fp);
+ (void)fread(boot_splash_filedata, 1, file_size, fp);
fclose(fp);
/* insert data */
if (file_type == JPG_FILE) {
--
1.7.2.5
next reply other threads:[~2011-07-29 19:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-07-29 19:30 Stefan Weil [this message]
2011-07-30 0:18 ` [Qemu-devel] [PATCH] Fix gcc-4.6 compiler error Peter Maydell
2011-08-01 0:30 ` Anthony Liguori
2011-08-18 4:16 ` Zhi Yong Wu
2011-08-18 4:28 ` Peter Maydell
2011-08-19 2:48 ` Zhi Yong Wu
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=1311967824-5218-1-git-send-email-weil@mail.berlios.de \
--to=weil@mail.berlios.de \
--cc=aliguori@us.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=xiawenc@linux.vnet.ibm.com \
/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).