From 8d5d2e362e96119a0faffb6eec2dd041e7cc4609 Mon Sep 17 00:00:00 2001 From: marcel Date: Fri, 31 May 2002 01:07:13 +0000 Subject: 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 --- sys/sys/gpt.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/sys/gpt.h b/sys/sys/gpt.h index 95a6cda..e952534 100644 --- a/sys/sys/gpt.h +++ b/sys/sys/gpt.h @@ -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 { -- cgit v1.1