|
136 | 136 | /*! Assertion. */
|
137 | 137 | #define SASI_ASSERT_CONCAT_(a, b) a##b
|
138 | 138 | #define SASI_ASSERT_CONCAT(a, b) SASI_ASSERT_CONCAT_(a, b)
|
| 139 | +#define SASI_PAL_COMPILER_ASSERT(cond, message) \ |
| 140 | + enum { SASI_ASSERT_CONCAT(assert_line_, __LINE__) = 1/(!!(cond)) } |
| 141 | +#elif defined(__ICCARM__) |
| 142 | + |
| 143 | +/************************ Defines ******************************/ |
| 144 | + |
| 145 | +/*! Associate a symbol with a link section. */ |
| 146 | +#define SASI_PAL_COMPILER_SECTION(sectionName) __attribute__((section(sectionName))) |
| 147 | + |
| 148 | +/*! Mark symbol as used, i.e., prevent garbage collector from dropping it. */ |
| 149 | +#define SASI_PAL_COMPILER_KEEP_SYMBOL __attribute__((used)) |
| 150 | + |
| 151 | + |
| 152 | +#define STRING_PRAGMA(x) _Pragma(#x) |
| 153 | +/*! Make given data item aligned (alignment in bytes). Not implemented */ |
| 154 | +/* Used in crys_rsa_types.h. This is telling the compiler about buffer alignment. */ |
| 155 | +/* IAR treats alignment a bit different. Nonetheless, this is used only for RSA, which was not ported yet. */ |
| 156 | +#define SASI_PAL_COMPILER_ALIGN(n) |
| 157 | + |
| 158 | +/*! Mark function that never returns. Not implemented. */ |
| 159 | +/* Not used anywhere, and probably located due to legacy reasons.*/ |
| 160 | +#define SASI_PAL_COMPILER_FUNC_NEVER_RETURNS |
| 161 | + |
| 162 | +/* Prevent function from being inlined */ |
| 163 | +#define SASI_PAL_COMPILER_FUNC_DONT_INLINE STRING_PRAGMA(optimize = no_inline) |
| 164 | + |
| 165 | +/*! Given data type may cast (alias) another data type pointer. */ |
| 166 | +/* (this is used for "superclass" struct casting). Not implemented */ |
| 167 | +/* Used in crys_rsa_local.h. for some compilers it translates to __may_alias__. */ |
| 168 | +/* For IAR, there is probably no need for this attribute, as the typedef */ |
| 169 | +/* is equivalent. Nonetheless, this is RSA code, which was not yet ported to Mbed TLS.*/ |
| 170 | +#define SASI_PAL_COMPILER_TYPE_MAY_ALIAS |
| 171 | + |
| 172 | +/*! Get sizeof for a structure type member. */ |
| 173 | +#define SASI_PAL_COMPILER_SIZEOF_STRUCT_MEMBER(type_name, member_name) \ |
| 174 | + sizeof(((type_name *)0)->member_name) |
| 175 | + |
| 176 | +/*! Assertion. */ |
| 177 | +#define SASI_ASSERT_CONCAT_(a, b) a##b |
| 178 | +#define SASI_ASSERT_CONCAT(a, b) SASI_ASSERT_CONCAT_(a, b) |
| 179 | + |
139 | 180 | #define SASI_PAL_COMPILER_ASSERT(cond, message) \
|
140 | 181 | enum { SASI_ASSERT_CONCAT(assert_line_, __LINE__) = 1/(!!(cond)) }
|
141 | 182 | #else
|
|
0 commit comments