Skip to content

Commit 5cdb151

Browse files
committed
Changed MBED_PACKED to a macro
Supports both __packed and __attribute__((packed)) styles of attriubtes MBED_PACKED(struct) foo { blablabla };
1 parent a08d04c commit 5cdb151

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

hal/api/toolchain.h

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -34,17 +34,17 @@
3434
* @code
3535
* #include "toolchain.h"
3636
*
37-
* typedef struct {
37+
* MBED_PACKED(struct) foo {
3838
* char x;
3939
* int y;
40-
* } MBED_PACKED foo;
40+
* };
4141
* @endcode
4242
*/
4343
#ifndef MBED_PACKED
4444
#if defined(__ICCARM__)
45-
#define MBED_PACKED __packed
45+
#define MBED_PACKED(struct) __packed struct
4646
#else
47-
#define MBED_PACKED __attribute__((packed))
47+
#define MBED_PACKED(struct) struct __attribute__((packed))
4848
#endif
4949
#endif
5050

@@ -238,16 +238,11 @@ typedef int FILEHANDLE;
238238
#endif
239239

240240
#ifndef PACKED
241-
#define PACKED MBED_PACKED
241+
#define PACKED MBED_PACKED()
242242
#endif
243243

244244
#ifndef EXTERN
245245
#define EXTERN extern
246246
#endif
247247

248-
// Backwards compatibility
249-
#ifndef EXTERN
250-
#define EXTERN extern
251-
#endif
252-
253248
#endif

0 commit comments

Comments
 (0)