commonlib/bsd/cbfs_serialized.h: Use C99 flexible arrays

Use C99 flexible arrays instead of older style of one-element or
zero-length arrays.
It allows the compiler to generate errors when the flexible array does
not occur at the end in the structure.

Change-Id: I00807a435a21e078c89f797cfd0b00d03604ea0e
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/76786
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Elyes Haouas 2023-07-28 06:20:48 +02:00 committed by Felix Singer
parent bfdb7551b1
commit 242bac0e16
1 changed files with 3 additions and 3 deletions

View File

@ -60,7 +60,7 @@ struct cbfs_header {
uint32_t align; /* fixed to 64 bytes */
uint32_t offset;
uint32_t architecture;
uint32_t pad[1];
uint32_t pad[];
} __packed;
/* this used to be flexible, but wasn't ever set to something different. */
@ -103,7 +103,7 @@ struct cbfs_file {
uint32_t type;
uint32_t attributes_offset;
uint32_t offset;
char filename[0];
char filename[];
} __packed;
#if defined __GNUC__ && (__GNUC__ * 100 + __GNUC_MINOR__) >= 406
@ -117,7 +117,7 @@ struct cbfs_file_attribute {
uint32_t tag;
/* len covers the whole structure, incl. tag and len */
uint32_t len;
uint8_t data[0];
uint8_t data[];
} __packed;
/* All attribute sizes must be divisible by this! */