summaryrefslogtreecommitdiff
path: root/tinyusb/common
diff options
context:
space:
mode:
authorhathach <[email protected]>2018-03-28 14:16:14 +0700
committerhathach <[email protected]>2018-03-28 14:23:38 +0700
commit43ac71179564fc021c2b77408b7f6ba594626007 (patch)
tree562ea32e78e5af065a823786f57d6326c2c9b97a /tinyusb/common
parent9cacb93bd829bfd3bca0cf7668e0c63053261fe7 (diff)
rename STATIC_ASSERT to VERIFY_STATIC to avoid name conflict with other codes
Diffstat (limited to 'tinyusb/common')
-rw-r--r--tinyusb/common/tusb_common.h2
-rw-r--r--tinyusb/common/tusb_compiler.h4
-rw-r--r--tinyusb/common/tusb_types.h2
-rw-r--r--tinyusb/common/verify.h28
4 files changed, 20 insertions, 16 deletions
diff --git a/tinyusb/common/tusb_common.h b/tinyusb/common/tusb_common.h
index 15b36ab52..2aefdc540 100644
--- a/tinyusb/common/tusb_common.h
+++ b/tinyusb/common/tusb_common.h
@@ -1,6 +1,6 @@
/**************************************************************************/
/*!
- @file common.h
+ @file tusb_common.h
@author hathach (tinyusb.org)
@section LICENSE
diff --git a/tinyusb/common/tusb_compiler.h b/tinyusb/common/tusb_compiler.h
index 7a686079e..62a343449 100644
--- a/tinyusb/common/tusb_compiler.h
+++ b/tinyusb/common/tusb_compiler.h
@@ -53,7 +53,7 @@
// Compile-time Assert
//--------------------------------------------------------------------+
#ifdef __ICCARM__
- #define STATIC_ASSERT static_assert
+ #define VERIFY_STATIC static_assert
#else
#if defined __COUNTER__ && __COUNTER__ != __COUNTER__
#define _ASSERT_COUNTER __COUNTER__
@@ -61,7 +61,7 @@
#define _ASSERT_COUNTER __LINE__
#endif
- #define STATIC_ASSERT(const_expr, message) enum { XSTRING_CONCAT_(static_assert_, _ASSERT_COUNTER) = 1/(!!(const_expr)) }
+ #define VERIFY_STATIC(const_expr, message) enum { XSTRING_CONCAT_(static_assert_, _ASSERT_COUNTER) = 1/(!!(const_expr)) }
#endif
// allow debugger to watch any module-wide variables anywhere
diff --git a/tinyusb/common/tusb_types.h b/tinyusb/common/tusb_types.h
index 6c61699b1..f3fc856c3 100644
--- a/tinyusb/common/tusb_types.h
+++ b/tinyusb/common/tusb_types.h
@@ -380,7 +380,7 @@ typedef struct ATTR_PACKED{
uint16_t wLength;
} tusb_control_request_t;
-STATIC_ASSERT( sizeof(tusb_control_request_t) == 8, "mostly compiler option issue");
+VERIFY_STATIC( sizeof(tusb_control_request_t) == 8, "mostly compiler option issue");
// TODO move to somewhere suitable
static inline uint8_t bm_request_type(uint8_t direction, uint8_t type, uint8_t recipient)
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