summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKees Cook <kees@outflux.net>2022-11-18 09:48:08 -0800
committerKees Cook <kees@outflux.net>2022-11-18 09:50:48 -0800
commit7b5a01c90b240d126efc86f9f99100db918d452e (patch)
tree28ade50d26e76b9c45b7432444109792440387b9
parentd9a0d78fb737445fd69ecf752ea219eda86ce6b9 (diff)
downloadacpica-7b5a01c90b240d126efc86f9f99100db918d452e.tar.gz
Introduce ACPI_FLEX_ARRAY
Add helper to work around the pointless C99 requirement that flex array members not be allowed in unions (nor alone in structs), which is not actually a real-world problem.
-rw-r--r--source/include/platform/acenv.h11
1 files changed, 11 insertions, 0 deletions
diff --git a/source/include/platform/acenv.h b/source/include/platform/acenv.h
index 674c4c7d0..1cae95fd6 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)