From a4aa169aab5a621edaabb6b40d1b761bdb92b1f2 Mon Sep 17 00:00:00 2001 From: Elyes Haouas Date: Sun, 30 Jul 2023 12:59:50 +0200 Subject: include/acpi: 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: I3d5838b825c6ac2a2959388381004993024081c3 Signed-off-by: Elyes Haouas Reviewed-on: https://review.coreboot.org/c/coreboot/+/76813 Reviewed-by: Felix Singer Tested-by: build bot (Jenkins) --- src/include/acpi/acpi.h | 10 +++++----- src/include/acpi/acpi_ivrs.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src/include/acpi') diff --git a/src/include/acpi/acpi.h b/src/include/acpi/acpi.h index f1c52d1560..0aa8026651 100644 --- a/src/include/acpi/acpi.h +++ b/src/include/acpi/acpi.h @@ -506,7 +506,7 @@ typedef struct acpi_ivrs_ivhd { uint16_t pci_segment_group; uint16_t iommu_info; uint32_t iommu_feature_info; - uint8_t entry[0]; + uint8_t entry[]; } __packed acpi_ivrs_ivhd_t; /* IVRS (I/O Virtualization Reporting Structure) Type 10h */ @@ -549,7 +549,7 @@ typedef struct acpi_ivrs_ivhd_11 { uint32_t efr_reg_image_low; uint32_t efr_reg_image_high; uint32_t reserved[2]; - uint8_t entry[0]; + uint8_t entry[]; } __packed acpi_ivrs_ivhd11_t; enum dev_scope_type { @@ -569,7 +569,7 @@ typedef struct dev_scope { struct { u8 dev; u8 fn; - } __packed path[0]; + } __packed path[]; } __packed dev_scope_t; enum dmar_type { @@ -651,7 +651,7 @@ typedef struct acpi_dmar { u8 host_address_width; u8 flags; u8 reserved[10]; - dmar_entry_t structure[0]; + dmar_entry_t structure[]; } __packed acpi_dmar_t; /* MADT: APIC Structure Types */ @@ -1246,7 +1246,7 @@ typedef struct acpi_einj_trigger_table { u32 revision; u32 table_size; u32 entry_count; - acpi_einj_action_table_t trigger_action[1]; + acpi_einj_action_table_t trigger_action[]; } __packed acpi_einj_trigger_table_t; typedef struct set_error_type { diff --git a/src/include/acpi/acpi_ivrs.h b/src/include/acpi/acpi_ivrs.h index fe0aa408fd..ad86e6a2f3 100644 --- a/src/include/acpi/acpi_ivrs.h +++ b/src/include/acpi/acpi_ivrs.h @@ -201,7 +201,7 @@ typedef struct acpi_ivrs_ivhd_40 { uint32_t efr_reg_image_low; uint32_t efr_reg_image_high; uint32_t reserved[2]; - uint8_t entry[0]; + uint8_t entry[]; } __packed acpi_ivrs_ivhd40_t; typedef struct ivrs_ivhd_extended { -- cgit v1.2.3