gcc 4.5 and copy_flag in libubigen.c
Andre Naujoks
nautsch2 at googlemail.com
Mon Mar 14 12:37:11 EDT 2011
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
More information about the linux-mtd
mailing list