move STRING & XSTRING & STATIC_ASSERT to compiler.h

disable test for a class of cdc host
temporarily disable test for test_osal_none.c
change include in some core files
remove osal.h from common.h
This commit is contained in:
hathach
2014-04-17 22:57:11 +07:00
parent 69c46b2f9a
commit 06bb9ad7a7
20 changed files with 89 additions and 78 deletions

View File

@@ -44,6 +44,26 @@
#ifndef _TUSB_COMPILER_H_
#define _TUSB_COMPILER_H_
#define STRING_(x) #x ///< stringify without expand
#define XSTRING_(x) STRING_(x) ///< expand then stringify
#define STRING_CONCAT_(a, b) a##b ///< concat without expand
#define XSTRING_CONCAT_(a, b) STRING_CONCAT_(a, b) ///< expand then concat
//--------------------------------------------------------------------+
// Compile-time Assert
//--------------------------------------------------------------------+
#ifdef __ICCARM__
#define STATIC_ASSERT static_assert
#else
#if defined __COUNTER__ && __COUNTER__ != __COUNTER__
#define _ASSERT_COUNTER __COUNTER__
#else
#define _ASSERT_COUNTER __LINE__
#endif
#define STATIC_ASSERT(const_expr, message) enum { XSTRING_CONCAT_(static_assert_, _ASSERT_COUNTER) = 1/(!!(const_expr)) }
#endif
#ifndef _TEST_
// TODO move some to tusb_option.h
#define STATIC_ static