diff options
| author | hathach <[email protected]> | 2018-03-28 14:16:14 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2018-03-28 14:23:38 +0700 |
| commit | 43ac71179564fc021c2b77408b7f6ba594626007 (patch) | |
| tree | 562ea32e78e5af065a823786f57d6326c2c9b97a /tinyusb/common/verify.h | |
| parent | 9cacb93bd829bfd3bca0cf7668e0c63053261fe7 (diff) | |
rename STATIC_ASSERT to VERIFY_STATIC to avoid name conflict with other codes
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 |
