From: Andre Naujoks <nautsch2@googlemail.com>
To: linux-mtd@lists.infradead.org
Subject: gcc 4.5 and copy_flag in libubigen.c
Date: Mon, 14 Mar 2011 17:37:11 +0100 [thread overview]
Message-ID: <4D7E4437.70300@googlemail.com> (raw)
Hi all.
I am compiling a board support package with mtd-utils-1.3.1.
After a gcc update to version 4.5 on my host the build fails and it
tells me that:
./src/libubigen.c: In function 'ubigen_write_leb':
./src/libubigen.c:204:19: error: operation on 'u->v->copy_flag' may be
undefined.
This seems like a recently introduced warning by the new gcc version,
but because of the -Werror halts my build.
I had a look into the source at ubi-utils/old-utils/src/libubigen.c and
it says:
int
ubigen_write_leb(ubi_info_t u, ubigen_action_t action)
{
int rc = 0;
size_t read = 0;
clear_buf(u);
write_ec_hdr(u);
rc = fill_data_buffer_from_file(u, &read);
if (rc != 0)
return rc;
if (u->v->vol_type == UBI_VID_STATIC) {
add_static_info(u, read, action);
}
u->v->lnum = cpu_to_be32(u->blks_written);
// This is the part gcc 4.5 complains about
// ---------------------
if (action & MARK_AS_UPDATE) {
u->v->copy_flag = (u->v->copy_flag)++;
}
// --------------------
write_vid_hdr(u, action);
rc = write_to_output_stream(u);
if (rc != 0)
return rc;
/* Update current handle */
u->bytes_read += read;
u->blks_written++;
return 0;
}
My question is this. If this is indeed just a flag, can I just set
copy_flag to 1 instead of incrementing it? Witout breaking anything?
I found no other references to the copy_flag ecxept in this file and in
the struct definition in include/mtd/ubi-media.h. So the warning may be
right, but I really have no idea about the whole ubifs thing.
I think the -Werror in the build is intentional, so I would rather not
disable it without knowing that this is not a bug or anything.
I would really be grateful for any advice on this.
Regards and thanks in advance.
Andre
next reply other threads:[~2011-03-14 16:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-14 16:37 Andre Naujoks [this message]
2011-03-14 17:53 ` gcc 4.5 and copy_flag in libubigen.c Matthieu CASTET
2011-03-15 7:55 ` Andre Naujoks
2011-03-15 8:06 ` Artem Bityutskiy
2011-03-15 9:21 ` Andre Naujoks
2011-03-15 8:04 ` Artem Bityutskiy
2011-03-15 8:45 ` Ricard Wanderlof
2011-03-15 9:29 ` Andre Naujoks
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=4D7E4437.70300@googlemail.com \
--to=nautsch2@googlemail.com \
--cc=linux-mtd@lists.infradead.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