1
0
Fork 0
mirror of https://github.com/betaflight/betaflight.git synced 2025-07-23 08:15:30 +03:00

Fix pointer alignment to 8 bytes for MacOS unit tests (#13564)

This commit is contained in:
Steve Evans 2024-04-22 23:26:59 +01:00 committed by GitHub
parent e0c0b64a4b
commit 407ca40cbc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 15 additions and 3 deletions

View file

@ -224,6 +224,12 @@ typedef union {
int32_t d32Max; // used for MODE_DIRECT with VAR_INT32
} cliValueConfig_t;
#ifdef __APPLE__
#define PTR_PACKING
#else
#define PTR_PACKING __attribute__((packed))
#endif
typedef struct clivalue_s {
const char *name;
const uint8_t type; // see cliValueFlag_e
@ -231,7 +237,7 @@ typedef struct clivalue_s {
pgn_t pgn;
uint16_t offset;
} __attribute__((packed)) clivalue_t;
} PTR_PACKING clivalue_t;
extern const lookupTableEntry_t lookupTables[];

View file

@ -58,6 +58,12 @@ typedef enum
typedef const void *(*CMSEntryFuncPtr)(displayPort_t *displayPort, const void *ptr);
#ifdef __APPLE__
#define PTR_PACKING
#else
#define PTR_PACKING __attribute__((packed))
#endif
typedef struct
{
const char * text;
@ -65,7 +71,7 @@ typedef struct
uint16_t flags;
CMSEntryFuncPtr func;
void *data;
} __attribute__((packed)) OSD_Entry;
} PTR_PACKING OSD_Entry;
// Bits in flags
#define OSD_MENU_ELEMENT_MASK 0x001f

View file

@ -67,7 +67,7 @@ static inline uint16_t pgElementSize(const pgRegistry_t* reg) {return (reg->size
#ifdef __APPLE__
extern const pgRegistry_t __pg_registry_start[] __asm("section$start$__DATA$__pg_registry");
extern const pgRegistry_t __pg_registry_end[] __asm("section$end$__DATA$__pg_registry");
#define PG_REGISTER_ATTRIBUTES __attribute__ ((section("__DATA,__pg_registry"), used, aligned(4)))
#define PG_REGISTER_ATTRIBUTES __attribute__ ((section("__DATA,__pg_registry"), used, aligned(8)))
extern const uint8_t __pg_resetdata_start[] __asm("section$start$__DATA$__pg_resetdata");
extern const uint8_t __pg_resetdata_end[] __asm("section$end$__DATA$__pg_resetdata");