ABI: named bitfield structs in pldm_types.h
Change the bitfield structs in pldm_types.h to be named structs.
This fixes an issue with the abi-dumper mistakenly seeing those as
1 byte wide when compiling with the C++ binding.
Change-Id: Ifecc4d62355e9233e88b75baffb4fcf89efe1c06
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
diff --git a/CHANGELOG.md b/CHANGELOG.md
index cf51303..8fe6cb1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -234,6 +234,10 @@
- pdr: Indicates success or failure depending on the outcome of the entity
association PDR creation
+- Changed the bitfield structs in pldm_types.h to be named structs. This fixes
+ an issue with the abi-dumper mistakenly seeing those as 1 byte wide when
+ compiling with the C++ binding.
+
- Register allocation changed for the following APIs:
- `encode_get_downstream_firmware_parameters_req()`
- `encode_get_state_effecter_states_resp()`
diff --git a/include/libpldm/pldm_types.h b/include/libpldm/pldm_types.h
index a32e0ba..e3a9893 100644
--- a/include/libpldm/pldm_types.h
+++ b/include/libpldm/pldm_types.h
@@ -2,11 +2,15 @@
#ifndef PLDM_TYPES_H
#define PLDM_TYPES_H
+#ifdef __cplusplus
+#include <cstdint>
+#else
#include <stdint.h>
+#endif
typedef union {
uint8_t byte;
- struct {
+ struct bits8 {
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
@@ -33,7 +37,7 @@
typedef union {
uint16_t value;
- struct {
+ struct bits16 {
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
@@ -55,7 +59,7 @@
typedef union {
uint32_t value;
- struct {
+ struct bits32 {
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;
@@ -93,7 +97,7 @@
typedef union {
uint64_t value;
- struct {
+ struct bits64 {
uint8_t bit0 : 1;
uint8_t bit1 : 1;
uint8_t bit2 : 1;