commonlib/coreboot_tables.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: I495605190b2c6cd11c7f78727ab4611e10b4d9d3
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/76785
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Arthur Heymans <arthur@aheymans.xyz>
This commit is contained in:
Elyes Haouas
2023-07-28 06:19:21 +02:00
parent 19b534d5fd
commit 8c0168ab86

View File

@@ -146,7 +146,7 @@ struct lb_memory_range {
struct lb_memory { struct lb_memory {
uint32_t tag; uint32_t tag;
uint32_t size; uint32_t size;
struct lb_memory_range map[0]; struct lb_memory_range map[];
}; };
struct lb_pcie { struct lb_pcie {
@@ -168,13 +168,13 @@ struct lb_mainboard {
uint32_t size; uint32_t size;
uint8_t vendor_idx; uint8_t vendor_idx;
uint8_t part_number_idx; uint8_t part_number_idx;
uint8_t strings[0]; uint8_t strings[];
}; };
struct lb_string { struct lb_string {
uint32_t tag; uint32_t tag;
uint32_t size; uint32_t size;
uint8_t string[0]; uint8_t string[];
}; };
struct lb_timestamp { struct lb_timestamp {
@@ -311,7 +311,7 @@ struct lb_gpios {
uint32_t size; uint32_t size;
uint32_t count; uint32_t count;
struct lb_gpio gpios[0]; struct lb_gpio gpios[];
}; };
struct lb_range { struct lb_range {
@@ -357,7 +357,7 @@ struct lb_spi_flash {
*/ */
uint32_t mmap_count; uint32_t mmap_count;
struct flash_mmap_window mmap_table[0]; struct flash_mmap_window mmap_table[];
}; };
struct lb_boot_media_params { struct lb_boot_media_params {
@@ -432,14 +432,14 @@ struct type_c_port_info {
struct type_c_info { struct type_c_info {
uint32_t port_count; uint32_t port_count;
struct type_c_port_info port_info[0]; struct type_c_port_info port_info[];
}; };
struct lb_macs { struct lb_macs {
uint32_t tag; uint32_t tag;
uint32_t size; uint32_t size;
uint32_t count; uint32_t count;
struct mac_address mac_addrs[0]; struct mac_address mac_addrs[];
}; };
struct lb_board_config { struct lb_board_config {