vendorcode/intel/edk2: 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: If093dc08c70c521cbef96ac5b5a7a46b37169bcd
Signed-off-by: Elyes Haouas <ehaouas@noos.fr>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/76810
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Jan Samek <jan.samek@siemens.com>
Reviewed-by: Felix Singer <service+coreboot-gerrit@felixsinger.de>
This commit is contained in:
Elyes Haouas 2023-07-30 12:53:47 +02:00 committed by Martin L Roth
parent 0c602b614d
commit ce655f5bd5
13 changed files with 33 additions and 33 deletions

View File

@ -39,7 +39,7 @@ typedef struct {
UINT32 OutstandingDataBE;
UINT32 MinTransferBE;
UINT32 LengthBE;
UINT8 Payload[0];
UINT8 Payload[];
} TCG_COM_PACKET;
typedef struct {
@ -50,7 +50,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
@ -59,7 +59,7 @@ typedef struct {
UINT8 ReservedBE[6];
UINT16 KindBE;
UINT32 LengthBE;
UINT8 Payload[0];
UINT8 Payload[];
} TCG_SUB_PACKET;
#define SUBPACKET_KIND_DATA 0x0000

View File

@ -250,7 +250,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;
/**

View File

@ -432,7 +432,7 @@ typedef union {
typedef struct {
UINT8 CompletionCode;
IPMI_GET_MESSAGE_CHANNEL_NUMBER ChannelNumber;
UINT8 MessageData[0];
UINT8 MessageData[];
} IPMI_GET_MESSAGE_RESPONSE;
//
@ -456,7 +456,7 @@ typedef union {
typedef struct {
UINT8 CompletionCode;
IPMI_SEND_MESSAGE_CHANNEL_NUMBER ChannelNumber;
UINT8 MessageData[0];
UINT8 MessageData[];
} IPMI_SEND_MESSAGE_REQUEST;
typedef struct {

View File

@ -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;
//

View File

@ -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 {

View File

@ -281,7 +281,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;
//
@ -311,7 +311,7 @@ typedef struct {
typedef struct {
UINT8 CompletionCode;
UINT8 ParameterRevision;
UINT8 ParameterData[0];
UINT8 ParameterData[];
} IPMI_GET_LAN_CONFIGURATION_PARAMETERS_RESPONSE;
//
@ -848,7 +848,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;
//
@ -878,7 +878,7 @@ typedef struct {
typedef struct {
UINT8 CompletionCode;
UINT8 ParameterRevision;
UINT8 ParameterData[0];
UINT8 ParameterData[];
} IPMI_GET_SOL_CONFIGURATION_PARAMETERS_RESPONSE;
#pragma pack()

View File

@ -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

View File

@ -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;
/**

View File

@ -432,7 +432,7 @@ typedef union {
typedef struct {
UINT8 CompletionCode;
IPMI_GET_MESSAGE_CHANNEL_NUMBER ChannelNumber;
UINT8 MessageData[0];
UINT8 MessageData[];
} IPMI_GET_MESSAGE_RESPONSE;
//
@ -456,12 +456,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;
//
@ -905,7 +905,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;
//

View File

@ -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;
//

View File

@ -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 {

View File

@ -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()

View File

@ -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