-
Notifications
You must be signed in to change notification settings - Fork 28
/
attribute.h
20 lines (19 loc) · 1.12 KB
/
attribute.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#ifndef attribute_h
#define attribute_h
#define iram __attribute__((section(".iram.text"))) __attribute__ ((optimize("Os")))
#define roflash __attribute__((section(".flash.rodata")))
#define attr_flash_align __attribute__((aligned(4)))
#define attr_align_int __attribute__((aligned(sizeof(int))))
#define attr_inline inline __attribute__((always_inline)) __attribute__((flatten)) static
#define attr_unused __attribute__ ((unused))
#define attr_used __attribute__ ((used))
#define attr_pure __attribute__ ((pure))
#define attr_const __attribute__ ((const))
#define attr_packed __attribute__ ((__packed__))
#define attr_nonnull __attribute__ ((nonnull))
#define attr_result_used __attribute__ ((warn_unused_result))
#define assert_size(type, size) _Static_assert(sizeof(type) == size, "sizeof(" #type ") != " #size)
#define assert_size_le(type1, type2) _Static_assert(sizeof(type1) <= sizeof(type2), "sizeof(" #type1 ") > sizeof(" #type2 ")")
#define assert_enum(name, value) _Static_assert((name) == (value), "enum value for " #name " != " #value)
#define assert_field(name, field, offset) _Static_assert(offsetof(name, field) == offset)
#endif