Don't use an incomplete array type to mark the start of the padding

because the padding should be inserted before the array and not after
it, as is done by GCC 3.1. Instead use an explicit uint32_t field
to get what was intended and on top of that make the size of the
padding explicit. This also doesn't depend on a C99 feature.
While here, expand the comment. Just to make a point.

Pointed out by: fanf
This commit is contained in:
marcel 2002-05-31 01:07:13 +00:00
parent 2040c65feb
commit 8d5d2e362e

View File

@ -46,7 +46,14 @@ struct gpt_hdr {
uint32_t hdr_entries;
uint32_t hdr_entsz;
uint32_t hdr_crc_table;
char padding[]; /* XXX: struct not a multiple of 8. */
/*
* The header as defined in the EFI spec is not a multiple of 8 bytes
* and given that the alignment requirement is on an 8 byte boundary,
* padding will happen. We make the padding explicit so that we can
* correct the value returned by sizeof() when we put the size of the
* header in field hdr_size, or otherwise use offsetof().
*/
uint32_t padding;
};
struct gpt_ent {