On 04/02/16 00:08 +0100, Kevin Kofler wrote:
Jonathan Wakely wrote:
A workaround would be to make it too hard for the compiler to see the
problem:
void* ptr = page->data;
_root = new (ptr) impl::xml_document_struct(page);
This way GCC doesn't see that the address refers to a 1-byte array.
Why not simply:
char data[
#ifndef __GNUC__
1
#endif
];
or:
#ifdef __GNUC__
char data[];
#else
char data[1];
#endif
or if you want GCC to accept this even in strict standards-compliant modes:
#ifdef __GNUC__
__extension__ char data[];
#else
char data[1];
#endif
?
Changing from a 1-byte array to the flexible array member potentially
changes the object's size, which would be an ABI change. I didn't look
at the rest of the code to know if that would be safe, or if it would
break something.
Suppressing the warning with the void* kluge won't break things, it
will just allow the build to proceeed and generate the same code as
before.
--
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxxx
http://lists.fedoraproject.org/admin/lists/devel@xxxxxxxxxxxxxxxxxxxxxxx