Bluetooth: common: Add build asserts for address struct sizes
In some HCI packed structures we place non-packed structs inside (in particular the address structs). Alignment is not an issue for those because all their members are just byte-aligned, but size is. If the compiler ever packs those it would become a real problem, and so detect this at build time. See the link below for more info: https://stackoverflow.com/a/66389167 Signed-off-by: Carles Cufi <carles.cufi@nordicsemi.no>
This commit is contained in:
parent
da31a33905
commit
301a7103a0
2 changed files with 19 additions and 1 deletions
|
@ -30,10 +30,17 @@ extern "C" {
|
|||
#define BT_ADDR_LE_PUBLIC_ID 0x02
|
||||
#define BT_ADDR_LE_RANDOM_ID 0x03
|
||||
|
||||
/** Length in bytes of a standard Bluetooth address */
|
||||
#define BT_ADDR_SIZE 6
|
||||
|
||||
/** Bluetooth Device Address */
|
||||
typedef struct {
|
||||
uint8_t val[6];
|
||||
uint8_t val[BT_ADDR_SIZE];
|
||||
} bt_addr_t;
|
||||
/**/
|
||||
|
||||
/** Length in bytes of an LE Bluetooth address. Not packed, so no sizeof() */
|
||||
#define BT_ADDR_LE_SIZE 7
|
||||
|
||||
/** Bluetooth LE Device Address */
|
||||
typedef struct {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue