From 03582f74b8ac7fd83c9bb695777713f781e8f1a1 Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 28 Mar 2018 13:25:14 +0700 Subject: more rename --- tinyusb/common/assertion.h | 2 +- tinyusb/common/binary.h | 2 +- tinyusb/common/compiler/compiler.h | 83 --------------------------------- tinyusb/common/compiler/compiler_gcc.h | 2 - tinyusb/common/compiler/tusb_compiler.h | 83 +++++++++++++++++++++++++++++++++ tinyusb/common/timeout_timer.h | 2 +- tinyusb/common/tusb_common.h | 2 +- tinyusb/common/tusb_types.h | 2 +- tinyusb/common/verify.h | 2 +- tinyusb/tusb_option.h | 2 +- 10 files changed, 90 insertions(+), 92 deletions(-) delete mode 100644 tinyusb/common/compiler/compiler.h create mode 100644 tinyusb/common/compiler/tusb_compiler.h diff --git a/tinyusb/common/assertion.h b/tinyusb/common/assertion.h index f91f00301..edb3f69f7 100644 --- a/tinyusb/common/assertion.h +++ b/tinyusb/common/assertion.h @@ -52,7 +52,7 @@ extern "C" #include "tusb_option.h" #include #include -#include "compiler/compiler.h" +#include "compiler/tusb_compiler.h" #include "tusb_hal.h" // TODO find a way to break hal dependency diff --git a/tinyusb/common/binary.h b/tinyusb/common/binary.h index ed7eecb27..4f2c81786 100644 --- a/tinyusb/common/binary.h +++ b/tinyusb/common/binary.h @@ -49,7 +49,7 @@ #include #include -#include "compiler/compiler.h" +#include "compiler/tusb_compiler.h" //------------- Bit manipulation -------------// #define BIT_(n) (1U << (n)) ///< n-th Bit diff --git a/tinyusb/common/compiler/compiler.h b/tinyusb/common/compiler/compiler.h deleted file mode 100644 index bbdd6e50e..000000000 --- a/tinyusb/common/compiler/compiler.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************/ -/*! - @file compiler.h - @author hathach (tinyusb.org) - - @section LICENSE - - Software License Agreement (BSD License) - - Copyright (c) 2013, hathach (tinyusb.org) - All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions are met: - 1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - 2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - 3. Neither the name of the copyright holders nor the - names of its contributors may be used to endorse or promote products - derived from this software without specific prior written permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY - EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY - DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND - ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS - SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - - This file is part of the tinyusb stack. -*/ -/**************************************************************************/ - -/** \ingroup Group_Common - * \defgroup Group_Compiler Compiler - * \brief Group_Compiler brief - * @{ */ - -#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 - -// allow debugger to watch any module-wide variables anywhere -#if TUSB_CFG_DEBUG -#define STATIC_VAR -#else -#define STATIC_VAR static -#endif - - -#if defined(__GNUC__) - #include "compiler_gcc.h" -#elif defined __ICCARM__ // IAR compiler - #include "compiler_iar.h" -#endif - -#endif /* _TUSB_COMPILER_H_ */ - -/// @} diff --git a/tinyusb/common/compiler/compiler_gcc.h b/tinyusb/common/compiler/compiler_gcc.h index 681940afd..c9f716d48 100644 --- a/tinyusb/common/compiler/compiler_gcc.h +++ b/tinyusb/common/compiler/compiler_gcc.h @@ -75,10 +75,8 @@ /** \defgroup Group_FuncAttr Function Attributes * @{ */ -#ifndef ATTR_ALWAYS_INLINE /// Generally, functions are not inlined unless optimization is specified. For functions declared inline, this attribute inlines the function even if no optimization level is specified #define ATTR_ALWAYS_INLINE __attribute__ ((always_inline)) -#endif /// The nonnull attribute specifies that some function parameters should be non-null pointers. f the compiler determines that a null pointer is passed in an argument slot marked as non-null, and the -Wnonnull option is enabled, a warning is issued. All pointer arguments are marked as non-null #define ATTR_NON_NULL __attribute__ ((nonull)) diff --git a/tinyusb/common/compiler/tusb_compiler.h b/tinyusb/common/compiler/tusb_compiler.h new file mode 100644 index 000000000..40cd5ea66 --- /dev/null +++ b/tinyusb/common/compiler/tusb_compiler.h @@ -0,0 +1,83 @@ +/**************************************************************************/ +/*! + @file compiler.h + @author hathach (tinyusb.org) + + @section LICENSE + + Software License Agreement (BSD License) + + Copyright (c) 2013, hathach (tinyusb.org) + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + 1. Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + 3. Neither the name of the copyright holders nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY + EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY + DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION HOWEVER CAUSED AND + ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + INCLUDING NEGLIGENCE OR OTHERWISE ARISING IN ANY WAY OUT OF THE USE OF THIS + SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + This file is part of the tinyusb stack. +*/ +/**************************************************************************/ + +/** \ingroup Group_Common + * \defgroup Group_Compiler Compiler + * \brief Group_Compiler brief + * @{ */ + +#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 + +// allow debugger to watch any module-wide variables anywhere +#if TUSB_CFG_DEBUG +#define STATIC_VAR +#else +#define STATIC_VAR static +#endif + + +#if defined(__GNUC__) + #include "compiler_gcc.h" +#elif defined __ICCARM__ + #include "compiler_iar.h" +#endif + +#endif /* _TUSB_COMPILER_H_ */ + +/// @} diff --git a/tinyusb/common/timeout_timer.h b/tinyusb/common/timeout_timer.h index 885b3901c..d8dcc87ed 100644 --- a/tinyusb/common/timeout_timer.h +++ b/tinyusb/common/timeout_timer.h @@ -44,7 +44,7 @@ #ifndef _TUSB_TIMEOUT_TTIMER_H_ #define _TUSB_TIMEOUT_TTIMER_H_ -#include "compiler/compiler.h" +#include "compiler/tusb_compiler.h" #ifdef __cplusplus extern "C" { diff --git a/tinyusb/common/tusb_common.h b/tinyusb/common/tusb_common.h index bde0ffa91..0b39621ea 100644 --- a/tinyusb/common/tusb_common.h +++ b/tinyusb/common/tusb_common.h @@ -62,7 +62,7 @@ #include "tusb_option.h" //------------- General Header -------------// -#include "compiler/compiler.h" +#include "compiler/tusb_compiler.h" #include "assertion.h" #include "verify.h" #include "binary.h" diff --git a/tinyusb/common/tusb_types.h b/tinyusb/common/tusb_types.h index 96daccdd8..a74b5876b 100644 --- a/tinyusb/common/tusb_types.h +++ b/tinyusb/common/tusb_types.h @@ -43,9 +43,9 @@ #ifndef _TUSB_TYPES_H_ #define _TUSB_TYPES_H_ +#include "compiler/tusb_compiler.h" #include #include -#include "compiler/compiler.h" #ifdef __cplusplus extern "C" { diff --git a/tinyusb/common/verify.h b/tinyusb/common/verify.h index 69c2a8053..7d71c255f 100644 --- a/tinyusb/common/verify.h +++ b/tinyusb/common/verify.h @@ -39,7 +39,7 @@ #include "tusb_option.h" #include #include -#include "compiler/compiler.h" +#include "compiler/tusb_compiler.h" #ifdef __cplusplus extern "C" { diff --git a/tinyusb/tusb_option.h b/tinyusb/tusb_option.h index 77e56e352..4ddc288a4 100644 --- a/tinyusb/tusb_option.h +++ b/tinyusb/tusb_option.h @@ -106,7 +106,7 @@ /** determines the debug level for the stack - Level 3: TBD - - Level 2: ATTR_ALWAYS_INLINE is null --> no function is inline + - Level 2: TBD - Level 1: Print out if Assert failed. STATIC_VAR is NULL --> accessible when debugging - Level 0: no debug information is generated */ -- cgit v1.3.1