diff options
Diffstat (limited to 'tinyusb/common/verify.h')
| -rw-r--r-- | tinyusb/common/verify.h | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/tinyusb/common/verify.h b/tinyusb/common/verify.h index c472c293e..5ee80627f 100644 --- a/tinyusb/common/verify.h +++ b/tinyusb/common/verify.h @@ -45,16 +45,26 @@ extern "C" { #endif +/** + * Helper to implement optional parameter for VERIFY Macro family + */ +#define GET_3RD_ARG(arg1, arg2, arg3, ...) arg3 +#define GET_4TH_ARG(arg1, arg2, arg3, arg4, ...) arg4 + //--------------------------------------------------------------------+ -// Compile-time Verify +// Compile-time Verify (like assert static) //--------------------------------------------------------------------+ -#if defined __COUNTER__ && __COUNTER__ != __COUNTER__ - #define _VERIFY_COUNTER __COUNTER__ +#ifdef __ICCARM__ + #define VERIFY_STATIC static_assert #else - #define _VERIFY_COUNTER __LINE__ -#endif + #if defined __COUNTER__ && __COUNTER__ != __COUNTER__ + #define _VERIFY_COUNTER __COUNTER__ + #else + #define _VERIFY_COUNTER __LINE__ + #endif -#define VERIFY_STATIC(const_expr) enum { XSTRING_CONCAT_(static_verify_, _VERIFY_COUNTER) = 1/(!!(const_expr)) } + #define VERIFY_STATIC(const_expr, _mess) enum { XSTRING_CONCAT_(_verify_static_, _VERIFY_COUNTER) = 1/(!!(const_expr)) } +#endif //--------------------------------------------------------------------+ // VERIFY Helper @@ -68,12 +78,6 @@ #define _ASSERT_MESS() #endif -/** - * Helper to implement optional parameter for VERIFY Macro family - */ -#define GET_3RD_ARG(arg1, arg2, arg3, ...) arg3 -#define GET_4TH_ARG(arg1, arg2, arg3, arg4, ...) arg4 - /*------------------------------------------------------------------*/ /* VERIFY STATUS * - VERIFY_STS_1ARGS : return status of condition if failed |
