Changed MBED_PACKED to a macro

Supports both __packed and __attribute__((packed)) styles of attriubtes

MBED_PACKED(struct) foo {
    blablabla
};
pull/1784/head
Christopher Haster 2016-06-01 16:10:19 -05:00
parent a08d04c751
commit 5cdb151193
1 changed files with 5 additions and 10 deletions

View File

@ -34,17 +34,17 @@
* @code
* #include "toolchain.h"
*
* typedef struct {
* MBED_PACKED(struct) foo {
* char x;
* int y;
* } MBED_PACKED foo;
* };
* @endcode
*/
#ifndef MBED_PACKED
#if defined(__ICCARM__)
#define MBED_PACKED __packed
#define MBED_PACKED(struct) __packed struct
#else
#define MBED_PACKED __attribute__((packed))
#define MBED_PACKED(struct) struct __attribute__((packed))
#endif
#endif
@ -238,16 +238,11 @@ typedef int FILEHANDLE;
#endif
#ifndef PACKED
#define PACKED MBED_PACKED
#define PACKED MBED_PACKED()
#endif
#ifndef EXTERN
#define EXTERN extern
#endif
// Backwards compatibility
#ifndef EXTERN
#define EXTERN extern
#endif
#endif