-
Notifications
You must be signed in to change notification settings - Fork 0
Home
#define BUILD_BUG_ON(condition) ((void)sizeof(char[1 - 2*!!(condition)]))
//#if BUILD_BUG_ON(Lib_Init_List) // #error "you screwed up struct mystruct again!" //#endif
#define ASSERT_CONCAT_(a, b) a##b
#define ASSERT_CONCAT(a, b) ASSERT_CONCAT_(a, b)
/* These can't be used after statements in c89. /
#ifdef COUNTER
#define STATIC_ASSERT(e,m)
;enum { ASSERT_CONCAT(static_assert_, COUNTER) = 1/(int)(!!(e)) }
#else
/ This can't be used twice on the same line so ensure if using in headers
- that the headers are not included twice (by wrapping in #ifndef...#endif)
- Note it doesn't cause an issue when used on same line of separate modules
- compiled with gcc -combine -fwhole-program. */
#define STATIC_ASSERT(e,m)
;enum { ASSERT_CONCAT(assert_line_, LINE) = 1/(int)(!!(e)) } #endif
STATIC_ASSERT(sizeof(Lib_Init_List)==8,"Hata var!");
#define compile_time_assert(cond)
extern char assertion[(cond) ? 1 : -1]
#define offsetof(TYPE, MEMBER)
((size_t) &((TYPE *)0)->MEMBER)
typedef struct { int field1; char field2; char field3; char field4; char field5; } SOME_STRUCT;
compile_time_assert(offsetof(SOME_STRUCT, field1) == 0); compile_time_assert(offsetof(SOME_STRUCT, field2) == 4); compile_time_assert(offsetof(SOME_STRUCT, field3) == 5); compile_time_assert(offsetof(SOME_STRUCT, field4) == 6); compile_time_assert(offsetof(SOME_STRUCT, field5) == 7); compile_time_assert(sizeof(SOME_STRUCT) == 8);
#define RAM_STRINGS_EXPORT(key, value, id) attribute((used, section("__DATA,__ram.data")))
static const struct RAM_String __S##id= (struct RAM_String){key, value};
#define RAM_BLOCKS_EXPORT(key, block) attribute((used, section("TEXT," ""#key ".block")))
static const struct RAM_Block __B##key = (struct RAM_Block){((char *)&#key), block};
#define RAM_FUNCTION_EXPORT(key)
static void _ram##key(void);
attribute((used, section("TEXT," ""#key ".func")))
static const struct RAM_Function __F##key = (struct RAM_Function){(char *)(&#key), (void *)(&_ram##key)};
static void _ram##key \
// void *(fptr)(); // // fptr=lib_func; // // fptr(); // // (((uint32_t **)(&fptr)))++; // // fptr();