public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* Re: [edk2-devel] [PATCH] Use C99 flexible arrays
@ 2023-08-21 16:56 ehaouas
  2023-08-22 15:28 ` Andrew Fish via groups.io
  0 siblings, 1 reply; 9+ messages in thread
From: ehaouas @ 2023-08-21 16:56 UTC (permalink / raw)
  To: Yao, Jiewen, devel@edk2.groups.io; +Cc: Yao, Jiewen

[-- Attachment #1: Type: text/plain, Size: 12742 bytes --]

‌
Hi,

No, I didn't.
 
De : "Yao, Jiewen"
A : "devel@edk2.groups.io" ,"ehaouas@noos.fr" ,"Yao, Jiewen"
Envoyé: lundi 21 Août 2023 16:35
Objet : RE: [edk2-devel] [PATCH] Use C99 flexible arrays
 
Hi
This fix breaks the compatibility.

Have you tested all features that depends on this data structure?

Thank you
Yao, Jiewen

> -----Original Message-----
> From: devel@edk2.groups.io On Behalf Of Elyes Haouas
> Sent: Sunday, August 20, 2023 8:07 PM
> To: devel@edk2.groups.io
> Cc: Elyes Haouas
> Subject: [edk2-devel] [PATCH] 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.
>
> Signed-off-by: Elyes Haouas
> ---
> EmbeddedPkg/Include/fdt.h | 4 ++--
> .../Library/FrameBufferBltLib/FrameBufferBltLib.c | 2 +-
> MdePkg/Include/IndustryStandard/IpmiNetFnApp.h | 8 ++++----
> MdePkg/Include/IndustryStandard/IpmiNetFnChassis.h | 4 ++--
> MdePkg/Include/IndustryStandard/IpmiNetFnStorage.h | 6 +++---
> MdePkg/Include/IndustryStandard/IpmiNetFnTransport.h | 8 ++++----
> MdePkg/Include/IndustryStandard/PldmSmbiosTransfer.h | 8 ++++----
> MdePkg/Include/IndustryStandard/TcgStorageCore.h | 6 +++---
> MdePkg/Include/Protocol/NetworkInterfaceIdentifier.h | 2 +-
> MdePkg/Include/Protocol/NvdimmLabel.h | 2 +-
> UefiPayloadPkg/Include/Coreboot.h | 10 +++++-----
> 11 files changed, 30 insertions(+), 30 deletions(-)
>
> diff --git a/EmbeddedPkg/Include/fdt.h b/EmbeddedPkg/Include/fdt.h
> index 120dbc8bc6..f64695da5c 100644
> --- a/EmbeddedPkg/Include/fdt.h
> +++ b/EmbeddedPkg/Include/fdt.h
> @@ -81,14 +81,14 @@ struct fdt_reserve_entry {
>
>
> struct fdt_node_header {
>
> fdt32_t tag;
>
> - char name[0];
>
> + char name[];
>
> };
>
>
>
> struct fdt_property {
>
> fdt32_t tag;
>
> fdt32_t len;
>
> fdt32_t nameoff;
>
> - char data[0];
>
> + char data[];
>
> };
>
>
>
> #endif /* !__ASSEMBLY */
>
> diff --git a/MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.c
> b/MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.c
> index 432577bcfd..5fc5779e16 100644
> --- a/MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.c
> +++ b/MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.c
> @@ -24,7 +24,7 @@ struct FRAME_BUFFER_CONFIGURE {
> EFI_PIXEL_BITMASK PixelMasks;
>
> INT8 PixelShl[4]; // R-G-B-Rsvd
>
> INT8 PixelShr[4]; // R-G-B-Rsvd
>
> - UINT8 LineBuffer[0];
>
> + UINT8 LineBuffer[];
>
> };
>
>
>
> CONST EFI_PIXEL_BITMASK mRgbPixelMasks = {
>
> diff --git a/MdePkg/Include/IndustryStandard/IpmiNetFnApp.h
> b/MdePkg/Include/IndustryStandard/IpmiNetFnApp.h
> index b6bc91f46c..b5174a5042 100644
> --- a/MdePkg/Include/IndustryStandard/IpmiNetFnApp.h
> +++ b/MdePkg/Include/IndustryStandard/IpmiNetFnApp.h
> @@ -433,7 +433,7 @@ typedef union {
> typedef struct {
>
> UINT8 CompletionCode;
>
> IPMI_GET_MESSAGE_CHANNEL_NUMBER ChannelNumber;
>
> - UINT8 MessageData[0];
>
> + UINT8 MessageData[];
>
> } IPMI_GET_MESSAGE_RESPONSE;
>
>
>
> //
>
> @@ -457,12 +457,12 @@ typedef union {
> typedef struct {
>
> UINT8 CompletionCode;
>
> IPMI_SEND_MESSAGE_CHANNEL_NUMBER ChannelNumber;
>
> - UINT8 MessageData[0];
>
> + UINT8 MessageData[];
>
> } IPMI_SEND_MESSAGE_REQUEST;
>
>
>
> typedef struct {
>
> UINT8 CompletionCode;
>
> - UINT8 ResponseData[0];
>
> + UINT8 ResponseData[];
>
> } IPMI_SEND_MESSAGE_RESPONSE;
>
>
>
> //
>
> @@ -906,7 +906,7 @@ typedef union {
> typedef struct {
>
> IPMI_SET_USER_PASSWORD_USER_ID UserId;
>
> IPMI_SET_USER_PASSWORD_OPERATION Operation;
>
> - UINT8 PasswordData[0]; // 16 or 20 bytes, depending on the
> 'PasswordSize' field
>
> + UINT8 PasswordData[]; // 16 or 20 bytes, depending on the
> 'PasswordSize' field
>
> } IPMI_SET_USER_PASSWORD_REQUEST;
>
>
>
> //
>
> diff --git a/MdePkg/Include/IndustryStandard/IpmiNetFnChassis.h
> b/MdePkg/Include/IndustryStandard/IpmiNetFnChassis.h
> index e3b8a62105..44024da69c 100644
> --- a/MdePkg/Include/IndustryStandard/IpmiNetFnChassis.h
> +++ b/MdePkg/Include/IndustryStandard/IpmiNetFnChassis.h
> @@ -183,7 +183,7 @@ typedef union {
>
>
> typedef struct {
>
> IPMI_SET_BOOT_OPTIONS_PARAMETER_VALID ParameterValid;
>
> - UINT8 ParameterData[0];
>
> + UINT8 ParameterData[];
>
> } IPMI_SET_BOOT_OPTIONS_REQUEST;
>
>
>
> typedef struct {
>
> @@ -415,7 +415,7 @@ typedef struct {
> UINT8 CompletionCode;
>
> IPMI_GET_BOOT_OPTIONS_PARAMETER_VERSION ParameterVersion;
>
> IPMI_GET_BOOT_OPTIONS_PARAMETER_VALID ParameterValid;
>
> - UINT8 ParameterData[0];
>
> + UINT8 ParameterData[];
>
> } IPMI_GET_BOOT_OPTIONS_RESPONSE;
>
>
>
> //
>
> diff --git a/MdePkg/Include/IndustryStandard/IpmiNetFnStorage.h
> b/MdePkg/Include/IndustryStandard/IpmiNetFnStorage.h
> index 553a69a472..755bcb67e5 100644
> --- a/MdePkg/Include/IndustryStandard/IpmiNetFnStorage.h
> +++ b/MdePkg/Include/IndustryStandard/IpmiNetFnStorage.h
> @@ -76,7 +76,7 @@ typedef struct {
> typedef struct {
>
> UINT8 CompletionCode;
>
> UINT8 CountReturned;
>
> - UINT8 Data[0];
>
> + UINT8 Data[];
>
> } IPMI_READ_FRU_DATA_RESPONSE;
>
>
>
> //
>
> @@ -95,7 +95,7 @@ typedef struct {
> typedef struct {
>
> UINT8 DeviceId;
>
> UINT16 InventoryOffset;
>
> - UINT8 Data[0];
>
> + UINT8 Data[];
>
> } IPMI_WRITE_FRU_DATA_REQUEST;
>
>
>
> typedef struct {
>
> @@ -594,7 +594,7 @@ typedef struct {
> UINT16 RecordId;
>
> UINT8 OffsetIntoRecord;
>
> UINT8 InProgress;
>
> - UINT8 RecordData[0];
>
> + UINT8 RecordData[];
>
> } IPMI_PARTIAL_ADD_SEL_ENTRY_REQUEST;
>
>
>
> typedef struct {
>
> diff --git a/MdePkg/Include/IndustryStandard/IpmiNetFnTransport.h
> b/MdePkg/Include/IndustryStandard/IpmiNetFnTransport.h
> index 2024c35f7f..273a162552 100644
> --- a/MdePkg/Include/IndustryStandard/IpmiNetFnTransport.h
> +++ b/MdePkg/Include/IndustryStandard/IpmiNetFnTransport.h
> @@ -313,7 +313,7 @@ typedef union {
> typedef struct {
>
> IPMI_SET_LAN_CONFIG_CHANNEL_NUM ChannelNumber;
>
> UINT8 ParameterSelector;
>
> - UINT8 ParameterData[0];
>
> + UINT8 ParameterData[];
>
> } IPMI_SET_LAN_CONFIGURATION_PARAMETERS_COMMAND_REQUEST;
>
>
>
> //
>
> @@ -343,7 +343,7 @@ typedef struct {
> typedef struct {
>
> UINT8 CompletionCode;
>
> UINT8 ParameterRevision;
>
> - UINT8 ParameterData[0];
>
> + UINT8 ParameterData[];
>
> } IPMI_GET_LAN_CONFIGURATION_PARAMETERS_RESPONSE;
>
>
>
> //
>
> @@ -879,7 +879,7 @@ typedef union {
> typedef struct {
>
> IPMI_SET_SOL_CONFIG_PARAM_CHANNEL_NUM ChannelNumber;
>
> UINT8 ParameterSelector;
>
> - UINT8 ParameterData[0];
>
> + UINT8 ParameterData[];
>
> } IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST;
>
>
>
> //
>
> @@ -909,7 +909,7 @@ typedef struct {
> typedef struct {
>
> UINT8 CompletionCode;
>
> UINT8 ParameterRevision;
>
> - UINT8 ParameterData[0];
>
> + UINT8 ParameterData[];
>
> } IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE;
>
>
>
> #pragma pack()
>
> diff --git a/MdePkg/Include/IndustryStandard/PldmSmbiosTransfer.h
> b/MdePkg/Include/IndustryStandard/PldmSmbiosTransfer.h
> index 9b7a5e838e..3e72812ea7 100644
> --- a/MdePkg/Include/IndustryStandard/PldmSmbiosTransfer.h
> +++ b/MdePkg/Include/IndustryStandard/PldmSmbiosTransfer.h
> @@ -92,7 +92,7 @@ typedef struct {
> typedef struct {
>
> UINT32 NextDataTransferHandle;
>
> UINT8 TransferFlag;
>
> - UINT8 Table[0];
>
> + UINT8 Table[];
>
> } PLDM_GET_SMBIOS_STRUCTURE_TABLE_RESPONSE;
>
>
>
> typedef struct {
>
> @@ -106,7 +106,7 @@ typedef struct {
> typedef struct {
>
> UINT32 DataTransferHandle;
>
> UINT8 TransferFlag;
>
> - UINT8 Table[0];
>
> + UINT8 Table[];
>
> } PLDM_SET_SMBIOS_STRUCTURE_TABLE_REQUEST;
>
>
>
> typedef struct {
>
> @@ -143,7 +143,7 @@ typedef struct {
> typedef struct {
>
> UINT32 NextDataTransferHandle;
>
> UINT8 TransferFlag;
>
> - UINT8 Table[0];
>
> + UINT8 Table[];
>
> } PLDM_GET_SMBIOS_STRUCTURE_BY_TYPE_RESPONSE;
>
>
>
> typedef struct {
>
> @@ -171,7 +171,7 @@ typedef struct {
> typedef struct {
>
> UINT32 NextDataTransferHandle;
>
> UINT8 TransferFlag;
>
> - UINT8 Table[0];
>
> + UINT8 Table[];
>
> } PLDM_GET_SMBIOS_STRUCTURE_BY_HANDLE_RESPONSE;
>
>
>
> typedef struct {
>
> diff --git a/MdePkg/Include/IndustryStandard/TcgStorageCore.h
> b/MdePkg/Include/IndustryStandard/TcgStorageCore.h
> index 1fae7b6e84..7502e3d46c 100644
> --- a/MdePkg/Include/IndustryStandard/TcgStorageCore.h
> +++ b/MdePkg/Include/IndustryStandard/TcgStorageCore.h
> @@ -38,7 +38,7 @@ typedef struct {
> UINT32 OutstandingDataBE;
>
> UINT32 MinTransferBE;
>
> UINT32 LengthBE;
>
> - UINT8 Payload[0];
>
> + UINT8 Payload[];
>
> } TCG_COM_PACKET;
>
>
>
> typedef struct {
>
> @@ -49,7 +49,7 @@ typedef struct {
> UINT16 AckTypeBE;
>
> UINT32 AcknowledgementBE;
>
> UINT32 LengthBE;
>
> - UINT8 Payload[0];
>
> + UINT8 Payload[];
>
> } TCG_PACKET;
>
>
>
> #define TCG_SUBPACKET_ALIGNMENT 4// 4-byte alignment per spec
>
> @@ -58,7 +58,7 @@ typedef struct {
> UINT8 ReservedBE[6];
>
> UINT16 KindBE;
>
> UINT32 LengthBE;
>
> - UINT8 Payload[0];
>
> + UINT8 Payload[];
>
> } TCG_SUB_PACKET;
>
>
>
> #define SUBPACKET_KIND_DATA 0x0000
>
> diff --git a/MdePkg/Include/Protocol/NetworkInterfaceIdentifier.h
> b/MdePkg/Include/Protocol/NetworkInterfaceIdentifier.h
> index 78acb4ddae..85d904ca9c 100644
> --- a/MdePkg/Include/Protocol/NetworkInterfaceIdentifier.h
> +++ b/MdePkg/Include/Protocol/NetworkInterfaceIdentifier.h
> @@ -101,7 +101,7 @@ struct undiconfig_table {
> struct {
>
> VOID *NII_InterfacePointer; ///< Pointer to the NII interface structure.
>
> VOID *DevicePathPointer; ///< Pointer to the device path for this NIC.
>
> - } NII_entry[1];
>
> + } NII_entry[];
>
> };
>
>
>
> extern EFI_GUID gEfiNetworkInterfaceIdentifierProtocolGuid;
>
> diff --git a/MdePkg/Include/Protocol/NvdimmLabel.h
> b/MdePkg/Include/Protocol/NvdimmLabel.h
> index e46999a3ab..91a9b675f9 100644
> --- a/MdePkg/Include/Protocol/NvdimmLabel.h
> +++ b/MdePkg/Include/Protocol/NvdimmLabel.h
> @@ -244,7 +244,7 @@ typedef struct {
> ///
>
> /// Array size is 1 if EFI_NVDIMM_LABEL_FLAGS_LOCAL is set indicating a Local
> Namespaces.
>
> ///
>
> - EFI_NVDIMM_LABEL_SET_COOKIE_MAP Mapping[0];
>
> + EFI_NVDIMM_LABEL_SET_COOKIE_MAP Mapping[];
>
> } EFI_NVDIMM_LABEL_SET_COOKIE_INFO;
>
>
>
> /**
>
> diff --git a/UefiPayloadPkg/Include/Coreboot.h
> b/UefiPayloadPkg/Include/Coreboot.h
> index 2d454f7c89..a53ede390c 100644
> --- a/UefiPayloadPkg/Include/Coreboot.h
> +++ b/UefiPayloadPkg/Include/Coreboot.h
> @@ -59,7 +59,7 @@ struct cbmem_root {
> UINT32 num_entries;
>
> UINT32 locked;
>
> UINT32 size;
>
> - struct cbmem_entry entries[0];
>
> + struct cbmem_entry entries[];
>
> };
>
>
>
> struct imd_entry {
>
> @@ -75,7 +75,7 @@ struct imd_root {
> UINT32 flags;
>
> UINT32 entry_align;
>
> UINT32 max_offset;
>
> - struct imd_entry entries[0];
>
> + struct imd_entry entries[];
>
> };
>
>
>
> struct cbuint64 {
>
> @@ -119,7 +119,7 @@ struct cb_memory_range {
> struct cb_memory {
>
> UINT32 tag;
>
> UINT32 size;
>
> - struct cb_memory_range map[0];
>
> + struct cb_memory_range map[];
>
> };
>
>
>
> #define CB_TAG_MAINBOARD 0x0003
>
> @@ -129,7 +129,7 @@ struct cb_mainboard {
> UINT32 size;
>
> UINT8 vendor_idx;
>
> UINT8 part_number_idx;
>
> - UINT8 strings[0];
>
> + UINT8 strings[];
>
> };
>
>
>
> #define CB_TAG_VERSION 0x0004
>
> @@ -146,7 +146,7 @@ struct cb_mainboard {
> struct cb_string {
>
> UINT32 tag;
>
> UINT32 size;
>
> - UINT8 string[0];
>
> + UINT8 string[];
>
> };
>
>
>
> #define CB_TAG_SERIAL 0x000f
>
> --
> 2.40.1
>
>
>
> -=-=-=-=-=-=
> Groups.io Links: You receive all messages sent to this group.
> View/Reply Online (#107898): https://edk2.groups.io/g/devel/message/107898
> Mute This Topic: https://groups.io/mt/100861513/1772286
> Group Owner: devel+owner@edk2.groups.io
> Unsubscribe: https://edk2.groups.io/g/devel/unsub [jiewen.yao@intel.com]
> -=-=-=-=-=-=
>
 



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107929): https://edk2.groups.io/g/devel/message/107929
Mute This Topic: https://groups.io/mt/100861513/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



[-- Attachment #2: Type: text/html, Size: 17631 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread
* [edk2-devel] [PATCH] Use C99 flexible arrays
@ 2023-08-20 11:07 Elyes Haouas
  2023-08-21 14:32 ` Yao, Jiewen
  0 siblings, 1 reply; 9+ messages in thread
From: Elyes Haouas @ 2023-08-20 11:07 UTC (permalink / raw)
  To: devel; +Cc: Elyes Haouas

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.

Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
---
 EmbeddedPkg/Include/fdt.h                              |  4 ++--
 .../Library/FrameBufferBltLib/FrameBufferBltLib.c      |  2 +-
 MdePkg/Include/IndustryStandard/IpmiNetFnApp.h         |  8 ++++----
 MdePkg/Include/IndustryStandard/IpmiNetFnChassis.h     |  4 ++--
 MdePkg/Include/IndustryStandard/IpmiNetFnStorage.h     |  6 +++---
 MdePkg/Include/IndustryStandard/IpmiNetFnTransport.h   |  8 ++++----
 MdePkg/Include/IndustryStandard/PldmSmbiosTransfer.h   |  8 ++++----
 MdePkg/Include/IndustryStandard/TcgStorageCore.h       |  6 +++---
 MdePkg/Include/Protocol/NetworkInterfaceIdentifier.h   |  2 +-
 MdePkg/Include/Protocol/NvdimmLabel.h                  |  2 +-
 UefiPayloadPkg/Include/Coreboot.h                      | 10 +++++-----
 11 files changed, 30 insertions(+), 30 deletions(-)

diff --git a/EmbeddedPkg/Include/fdt.h b/EmbeddedPkg/Include/fdt.h
index 120dbc8bc6..f64695da5c 100644
--- a/EmbeddedPkg/Include/fdt.h
+++ b/EmbeddedPkg/Include/fdt.h
@@ -81,14 +81,14 @@ struct fdt_reserve_entry {
 
 struct fdt_node_header {
   fdt32_t    tag;
-  char       name[0];
+  char       name[];
 };
 
 struct fdt_property {
   fdt32_t    tag;
   fdt32_t    len;
   fdt32_t    nameoff;
-  char       data[0];
+  char       data[];
 };
 
 #endif /* !__ASSEMBLY */
diff --git a/MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.c b/MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.c
index 432577bcfd..5fc5779e16 100644
--- a/MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.c
+++ b/MdeModulePkg/Library/FrameBufferBltLib/FrameBufferBltLib.c
@@ -24,7 +24,7 @@ struct FRAME_BUFFER_CONFIGURE {
   EFI_PIXEL_BITMASK            PixelMasks;
   INT8                         PixelShl[4];    // R-G-B-Rsvd
   INT8                         PixelShr[4];    // R-G-B-Rsvd
-  UINT8                        LineBuffer[0];
+  UINT8                        LineBuffer[];
 };
 
 CONST EFI_PIXEL_BITMASK  mRgbPixelMasks = {
diff --git a/MdePkg/Include/IndustryStandard/IpmiNetFnApp.h b/MdePkg/Include/IndustryStandard/IpmiNetFnApp.h
index b6bc91f46c..b5174a5042 100644
--- a/MdePkg/Include/IndustryStandard/IpmiNetFnApp.h
+++ b/MdePkg/Include/IndustryStandard/IpmiNetFnApp.h
@@ -433,7 +433,7 @@ typedef union {
 typedef struct {
   UINT8                              CompletionCode;
   IPMI_GET_MESSAGE_CHANNEL_NUMBER    ChannelNumber;
-  UINT8                              MessageData[0];
+  UINT8                              MessageData[];
 } IPMI_GET_MESSAGE_RESPONSE;
 
 //
@@ -457,12 +457,12 @@ typedef union {
 typedef struct {
   UINT8                               CompletionCode;
   IPMI_SEND_MESSAGE_CHANNEL_NUMBER    ChannelNumber;
-  UINT8                               MessageData[0];
+  UINT8                               MessageData[];
 } IPMI_SEND_MESSAGE_REQUEST;
 
 typedef struct {
   UINT8    CompletionCode;
-  UINT8    ResponseData[0];
+  UINT8    ResponseData[];
 } IPMI_SEND_MESSAGE_RESPONSE;
 
 //
@@ -906,7 +906,7 @@ typedef union {
 typedef struct {
   IPMI_SET_USER_PASSWORD_USER_ID      UserId;
   IPMI_SET_USER_PASSWORD_OPERATION    Operation;
-  UINT8                               PasswordData[0]; // 16 or 20 bytes, depending on the 'PasswordSize' field
+  UINT8                               PasswordData[]; // 16 or 20 bytes, depending on the 'PasswordSize' field
 } IPMI_SET_USER_PASSWORD_REQUEST;
 
 //
diff --git a/MdePkg/Include/IndustryStandard/IpmiNetFnChassis.h b/MdePkg/Include/IndustryStandard/IpmiNetFnChassis.h
index e3b8a62105..44024da69c 100644
--- a/MdePkg/Include/IndustryStandard/IpmiNetFnChassis.h
+++ b/MdePkg/Include/IndustryStandard/IpmiNetFnChassis.h
@@ -183,7 +183,7 @@ typedef union {
 
 typedef struct {
   IPMI_SET_BOOT_OPTIONS_PARAMETER_VALID    ParameterValid;
-  UINT8                                    ParameterData[0];
+  UINT8                                    ParameterData[];
 } IPMI_SET_BOOT_OPTIONS_REQUEST;
 
 typedef struct {
@@ -415,7 +415,7 @@ typedef struct {
   UINT8                                      CompletionCode;
   IPMI_GET_BOOT_OPTIONS_PARAMETER_VERSION    ParameterVersion;
   IPMI_GET_BOOT_OPTIONS_PARAMETER_VALID      ParameterValid;
-  UINT8                                      ParameterData[0];
+  UINT8                                      ParameterData[];
 } IPMI_GET_BOOT_OPTIONS_RESPONSE;
 
 //
diff --git a/MdePkg/Include/IndustryStandard/IpmiNetFnStorage.h b/MdePkg/Include/IndustryStandard/IpmiNetFnStorage.h
index 553a69a472..755bcb67e5 100644
--- a/MdePkg/Include/IndustryStandard/IpmiNetFnStorage.h
+++ b/MdePkg/Include/IndustryStandard/IpmiNetFnStorage.h
@@ -76,7 +76,7 @@ typedef struct {
 typedef struct {
   UINT8    CompletionCode;
   UINT8    CountReturned;
-  UINT8    Data[0];
+  UINT8    Data[];
 } IPMI_READ_FRU_DATA_RESPONSE;
 
 //
@@ -95,7 +95,7 @@ typedef struct {
 typedef struct {
   UINT8     DeviceId;
   UINT16    InventoryOffset;
-  UINT8     Data[0];
+  UINT8     Data[];
 } IPMI_WRITE_FRU_DATA_REQUEST;
 
 typedef struct {
@@ -594,7 +594,7 @@ typedef struct {
   UINT16    RecordId;
   UINT8     OffsetIntoRecord;
   UINT8     InProgress;
-  UINT8     RecordData[0];
+  UINT8     RecordData[];
 } IPMI_PARTIAL_ADD_SEL_ENTRY_REQUEST;
 
 typedef struct {
diff --git a/MdePkg/Include/IndustryStandard/IpmiNetFnTransport.h b/MdePkg/Include/IndustryStandard/IpmiNetFnTransport.h
index 2024c35f7f..273a162552 100644
--- a/MdePkg/Include/IndustryStandard/IpmiNetFnTransport.h
+++ b/MdePkg/Include/IndustryStandard/IpmiNetFnTransport.h
@@ -313,7 +313,7 @@ typedef union {
 typedef struct {
   IPMI_SET_LAN_CONFIG_CHANNEL_NUM    ChannelNumber;
   UINT8                              ParameterSelector;
-  UINT8                              ParameterData[0];
+  UINT8                              ParameterData[];
 } IPMI_SET_LAN_CONFIGURATION_PARAMETERS_COMMAND_REQUEST;
 
 //
@@ -343,7 +343,7 @@ typedef struct {
 typedef struct {
   UINT8    CompletionCode;
   UINT8    ParameterRevision;
-  UINT8    ParameterData[0];
+  UINT8    ParameterData[];
 } IPMI_GET_LAN_CONFIGURATION_PARAMETERS_RESPONSE;
 
 //
@@ -879,7 +879,7 @@ typedef union {
 typedef struct {
   IPMI_SET_SOL_CONFIG_PARAM_CHANNEL_NUM    ChannelNumber;
   UINT8                                    ParameterSelector;
-  UINT8                                    ParameterData[0];
+  UINT8                                    ParameterData[];
 } IPMI_SET_SOL_CONFIGURATION_PARAMETERS_REQUEST;
 
 //
@@ -909,7 +909,7 @@ typedef struct {
 typedef struct {
   UINT8    CompletionCode;
   UINT8    ParameterRevision;
-  UINT8    ParameterData[0];
+  UINT8    ParameterData[];
 } IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE;
 
 #pragma pack()
diff --git a/MdePkg/Include/IndustryStandard/PldmSmbiosTransfer.h b/MdePkg/Include/IndustryStandard/PldmSmbiosTransfer.h
index 9b7a5e838e..3e72812ea7 100644
--- a/MdePkg/Include/IndustryStandard/PldmSmbiosTransfer.h
+++ b/MdePkg/Include/IndustryStandard/PldmSmbiosTransfer.h
@@ -92,7 +92,7 @@ typedef struct {
 typedef struct {
   UINT32    NextDataTransferHandle;
   UINT8     TransferFlag;
-  UINT8     Table[0];
+  UINT8     Table[];
 } PLDM_GET_SMBIOS_STRUCTURE_TABLE_RESPONSE;
 
 typedef struct {
@@ -106,7 +106,7 @@ typedef struct {
 typedef struct {
   UINT32    DataTransferHandle;
   UINT8     TransferFlag;
-  UINT8     Table[0];
+  UINT8     Table[];
 } PLDM_SET_SMBIOS_STRUCTURE_TABLE_REQUEST;
 
 typedef struct {
@@ -143,7 +143,7 @@ typedef struct {
 typedef struct {
   UINT32    NextDataTransferHandle;
   UINT8     TransferFlag;
-  UINT8     Table[0];
+  UINT8     Table[];
 } PLDM_GET_SMBIOS_STRUCTURE_BY_TYPE_RESPONSE;
 
 typedef struct {
@@ -171,7 +171,7 @@ typedef struct {
 typedef struct {
   UINT32    NextDataTransferHandle;
   UINT8     TransferFlag;
-  UINT8     Table[0];
+  UINT8     Table[];
 } PLDM_GET_SMBIOS_STRUCTURE_BY_HANDLE_RESPONSE;
 
 typedef struct {
diff --git a/MdePkg/Include/IndustryStandard/TcgStorageCore.h b/MdePkg/Include/IndustryStandard/TcgStorageCore.h
index 1fae7b6e84..7502e3d46c 100644
--- a/MdePkg/Include/IndustryStandard/TcgStorageCore.h
+++ b/MdePkg/Include/IndustryStandard/TcgStorageCore.h
@@ -38,7 +38,7 @@ typedef struct {
   UINT32    OutstandingDataBE;
   UINT32    MinTransferBE;
   UINT32    LengthBE;
-  UINT8     Payload[0];
+  UINT8     Payload[];
 } TCG_COM_PACKET;
 
 typedef struct {
@@ -49,7 +49,7 @@ typedef struct {
   UINT16    AckTypeBE;
   UINT32    AcknowledgementBE;
   UINT32    LengthBE;
-  UINT8     Payload[0];
+  UINT8     Payload[];
 } TCG_PACKET;
 
 #define TCG_SUBPACKET_ALIGNMENT  4// 4-byte alignment per spec
@@ -58,7 +58,7 @@ typedef struct {
   UINT8     ReservedBE[6];
   UINT16    KindBE;
   UINT32    LengthBE;
-  UINT8     Payload[0];
+  UINT8     Payload[];
 } TCG_SUB_PACKET;
 
 #define SUBPACKET_KIND_DATA            0x0000
diff --git a/MdePkg/Include/Protocol/NetworkInterfaceIdentifier.h b/MdePkg/Include/Protocol/NetworkInterfaceIdentifier.h
index 78acb4ddae..85d904ca9c 100644
--- a/MdePkg/Include/Protocol/NetworkInterfaceIdentifier.h
+++ b/MdePkg/Include/Protocol/NetworkInterfaceIdentifier.h
@@ -101,7 +101,7 @@ struct undiconfig_table {
   struct {
     VOID    *NII_InterfacePointer;          ///< Pointer to the NII interface structure.
     VOID    *DevicePathPointer;             ///< Pointer to the device path for this NIC.
-  } NII_entry[1];
+  } NII_entry[];
 };
 
 extern EFI_GUID  gEfiNetworkInterfaceIdentifierProtocolGuid;
diff --git a/MdePkg/Include/Protocol/NvdimmLabel.h b/MdePkg/Include/Protocol/NvdimmLabel.h
index e46999a3ab..91a9b675f9 100644
--- a/MdePkg/Include/Protocol/NvdimmLabel.h
+++ b/MdePkg/Include/Protocol/NvdimmLabel.h
@@ -244,7 +244,7 @@ typedef struct {
   ///
   /// Array size is 1 if EFI_NVDIMM_LABEL_FLAGS_LOCAL is set indicating a Local Namespaces.
   ///
-  EFI_NVDIMM_LABEL_SET_COOKIE_MAP    Mapping[0];
+  EFI_NVDIMM_LABEL_SET_COOKIE_MAP    Mapping[];
 } EFI_NVDIMM_LABEL_SET_COOKIE_INFO;
 
 /**
diff --git a/UefiPayloadPkg/Include/Coreboot.h b/UefiPayloadPkg/Include/Coreboot.h
index 2d454f7c89..a53ede390c 100644
--- a/UefiPayloadPkg/Include/Coreboot.h
+++ b/UefiPayloadPkg/Include/Coreboot.h
@@ -59,7 +59,7 @@ struct cbmem_root {
   UINT32                num_entries;
   UINT32                locked;
   UINT32                size;
-  struct cbmem_entry    entries[0];
+  struct cbmem_entry    entries[];
 };
 
 struct imd_entry {
@@ -75,7 +75,7 @@ struct imd_root {
   UINT32              flags;
   UINT32              entry_align;
   UINT32              max_offset;
-  struct imd_entry    entries[0];
+  struct imd_entry    entries[];
 };
 
 struct cbuint64 {
@@ -119,7 +119,7 @@ struct cb_memory_range {
 struct cb_memory {
   UINT32                    tag;
   UINT32                    size;
-  struct cb_memory_range    map[0];
+  struct cb_memory_range    map[];
 };
 
 #define CB_TAG_MAINBOARD  0x0003
@@ -129,7 +129,7 @@ struct cb_mainboard {
   UINT32    size;
   UINT8     vendor_idx;
   UINT8     part_number_idx;
-  UINT8     strings[0];
+  UINT8     strings[];
 };
 
 #define CB_TAG_VERSION         0x0004
@@ -146,7 +146,7 @@ struct cb_mainboard {
 struct cb_string {
   UINT32    tag;
   UINT32    size;
-  UINT8     string[0];
+  UINT8     string[];
 };
 
 #define CB_TAG_SERIAL  0x000f
-- 
2.40.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#107898): https://edk2.groups.io/g/devel/message/107898
Mute This Topic: https://groups.io/mt/100861513/7686176
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [rebecca@openfw.io]
-=-=-=-=-=-=-=-=-=-=-=-



^ permalink raw reply related	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-08-24 21:03 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-08-21 16:56 [edk2-devel] [PATCH] Use C99 flexible arrays ehaouas
2023-08-22 15:28 ` Andrew Fish via groups.io
2023-08-23 21:41   ` Rebecca Cran
2023-08-24  0:36     ` Pedro Falcato
2023-08-24 21:03       ` Rebecca Cran
2023-08-24 15:19     ` Oliver Smith-Denny
2023-08-24 21:01       ` Rebecca Cran
  -- strict thread matches above, loose matches on Subject: below --
2023-08-20 11:07 Elyes Haouas
2023-08-21 14:32 ` Yao, Jiewen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox