add alignof to compilier specific
add static_assert support for IAR (built-in support)
This commit is contained in:
@@ -61,13 +61,17 @@ extern "C"
|
||||
//--------------------------------------------------------------------+
|
||||
// Compile-time Assert
|
||||
//--------------------------------------------------------------------+
|
||||
#if defined __COUNTER__ && __COUNTER__ != __COUNTER__
|
||||
#define _ASSERT_COUNTER __COUNTER__
|
||||
#ifdef __ICCARM__
|
||||
#define STATIC_ASSERT static_assert
|
||||
#else
|
||||
#define _ASSERT_COUNTER __LINE__
|
||||
#endif
|
||||
#if defined __COUNTER__ && __COUNTER__ != __COUNTER__
|
||||
#define _ASSERT_COUNTER __COUNTER__
|
||||
#else
|
||||
#define _ASSERT_COUNTER __LINE__
|
||||
#endif
|
||||
|
||||
#define STATIC_ASSSERT(const_expr) enum { XSTRING_CONCAT(static_assert_, _ASSERT_COUNTER) = 1/(!!(const_expr)) }
|
||||
#define STATIC_ASSERT(const_expr, message) enum { XSTRING_CONCAT_(static_assert_, _ASSERT_COUNTER) = 1/(!!(const_expr)) }
|
||||
#endif
|
||||
|
||||
//#if ( defined CFG_PRINTF_UART || defined CFG_PRINTF_USBCDC || defined CFG_PRINTF_DEBUG )
|
||||
#if TUSB_CFG_DEBUG == 3
|
||||
|
||||
@@ -51,6 +51,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ALIGN_OF(x) __alignof__(x)
|
||||
|
||||
/// Normally, the compiler places the objects it generates in sections like data or bss & function in text. Sometimes, however, you need additional sections, or you need certain particular variables to appear in special sections, for example to map to special hardware. The section attribute specifies that a variable (or function) lives in a particular section
|
||||
#define ATTR_SECTION(section) __attribute__ ((#section))
|
||||
|
||||
|
||||
@@ -51,6 +51,8 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define ALIGN_OF(x) __ALIGNOF__(x)
|
||||
|
||||
#define ATTR_PREPACKED __packed
|
||||
#define ATTR_PACKED
|
||||
|
||||
|
||||
Reference in New Issue
Block a user