diff options
author | Robert Moore <Robert.Moore@intel.com> | 2023-02-07 10:09:04 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-07 10:09:04 -0800 |
commit | cf3220db5f8ad11268b6e3c4a272bfc4b22d23d0 (patch) | |
tree | 73f0144d429e6c9752d20f3b42361f53da5d8517 | |
parent | 5156a72859990072392a3f913cb37fe90f393c22 (diff) | |
parent | b1c7901e102cec378d08643d88683ff9536a69bc (diff) | |
download | acpica-cf3220db5f8ad11268b6e3c4a272bfc4b22d23d0.tar.gz |
Merge pull request #813 from kees/flex-array
Replace fake flexible arrays with actual flexible array members
-rw-r--r-- | source/include/acrestyp.h | 8 | ||||
-rw-r--r-- | source/include/actbl2.h | 2 | ||||
-rw-r--r-- | source/include/platform/acenv.h | 11 |
3 files changed, 17 insertions, 4 deletions
diff --git a/source/include/acrestyp.h b/source/include/acrestyp.h index a8299fbc0..f48ae7614 100644 --- a/source/include/acrestyp.h +++ b/source/include/acrestyp.h @@ -538,7 +538,7 @@ typedef struct acpi_resource_extended_irq UINT8 WakeCapable; UINT8 InterruptCount; ACPI_RESOURCE_SOURCE ResourceSource; - UINT32 Interrupts[1]; + UINT32 Interrupts[]; } ACPI_RESOURCE_EXTENDED_IRQ; @@ -927,8 +927,10 @@ typedef struct acpi_pci_routing_table UINT32 Pin; UINT64 Address; /* here for 64-bit alignment */ UINT32 SourceIndex; - char Source[4]; /* pad to 64 bits so sizeof() works in all cases */ - + union { + char Pad[4]; /* pad to 64 bits so sizeof() works in all cases */ + ACPI_FLEX_ARRAY(char, Source); + }; } ACPI_PCI_ROUTING_TABLE; #endif /* __ACRESTYP_H__ */ diff --git a/source/include/actbl2.h b/source/include/actbl2.h index a14622a1e..7517cdd51 100644 --- a/source/include/actbl2.h +++ b/source/include/actbl2.h @@ -1550,7 +1550,7 @@ enum AcpiMadtLpcPicVersion { typedef struct acpi_madt_oem_data { - UINT8 OemData[]; + ACPI_FLEX_ARRAY(UINT8, OemData); } ACPI_MADT_OEM_DATA; diff --git a/source/include/platform/acenv.h b/source/include/platform/acenv.h index a08311ddc..4867eb02f 100644 --- a/source/include/platform/acenv.h +++ b/source/include/platform/acenv.h @@ -419,6 +419,17 @@ #endif /* + * Flexible array members are not allowed to be part of a union under + * C99, but this is not for any technical reason. Work around the + * limitation. + */ +#define ACPI_FLEX_ARRAY(TYPE, NAME) \ + struct { \ + struct { } __Empty_ ## NAME; \ + TYPE NAME[]; \ + } + +/* * Configurable calling conventions: * * ACPI_SYSTEM_XFACE - Interfaces to host OS (handlers, threads) |