mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-11-16 12:34:33 +00:00
[rtdef] use lower-case to define attributes (#6728)
* [rtdef] rename RT_WEAK attribute as rt_weak * [rtdef] rename RT_USED attribute as rt_used * [rtdef] rename RT_SECTION attribute as rt_section * [rtdef] rename ALIGN attribute as rt_align * [legacy] add RT_USED ALIGN RT_SECTION RT_WEAK as legacy support
This commit is contained in:
committed by
GitHub
parent
a4b8762d85
commit
99bdf978d7
@@ -159,10 +159,10 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
|
||||
|
||||
/* Compiler Related Definitions */
|
||||
#if defined(__ARMCC_VERSION) /* ARM Compiler */
|
||||
#define RT_SECTION(x) __attribute__((section(x)))
|
||||
#define RT_USED __attribute__((used))
|
||||
#define ALIGN(n) __attribute__((aligned(n)))
|
||||
#define RT_WEAK __attribute__((weak))
|
||||
#define rt_section(x) __attribute__((section(x)))
|
||||
#define rt_used __attribute__((used))
|
||||
#define rt_align(n) __attribute__((aligned(n)))
|
||||
#define rt_weak __attribute__((weak))
|
||||
#define rt_inline static __inline
|
||||
/* module compiling */
|
||||
#ifdef RT_USING_MODULE
|
||||
@@ -171,11 +171,11 @@ typedef rt_base_t rt_off_t; /**< Type for offset */
|
||||
#define RTT_API __declspec(dllexport)
|
||||
#endif /* RT_USING_MODULE */
|
||||
#elif defined (__IAR_SYSTEMS_ICC__) /* for IAR Compiler */
|
||||
#define RT_SECTION(x) @ x
|
||||
#define RT_USED __root
|
||||
#define rt_section(x) @ x
|
||||
#define rt_used __root
|
||||
#define PRAGMA(x) _Pragma(#x)
|
||||
#define ALIGN(n) PRAGMA(data_alignment=n)
|
||||
#define RT_WEAK __weak
|
||||
#define rt_align(n) PRAGMA(data_alignment=n)
|
||||
#define rt_weak __weak
|
||||
#define rt_inline static inline
|
||||
#define RTT_API
|
||||
#elif defined (__GNUC__) /* GNU GCC Compiler */
|
||||
@@ -189,51 +189,51 @@ typedef __gnuc_va_list va_list;
|
||||
#endif /* RT_USING_LIBC */
|
||||
#define __RT_STRINGIFY(x...) #x
|
||||
#define RT_STRINGIFY(x...) __RT_STRINGIFY(x)
|
||||
#define RT_SECTION(x) __attribute__((section(x)))
|
||||
#define RT_USED __attribute__((used))
|
||||
#define ALIGN(n) __attribute__((aligned(n)))
|
||||
#define RT_WEAK __attribute__((weak))
|
||||
#define rt_section(x) __attribute__((section(x)))
|
||||
#define rt_used __attribute__((used))
|
||||
#define rt_align(n) __attribute__((aligned(n)))
|
||||
#define rt_weak __attribute__((weak))
|
||||
#define rt_inline static __inline
|
||||
#define RTT_API
|
||||
#elif defined (__ADSPBLACKFIN__) /* for VisualDSP++ Compiler */
|
||||
#define RT_SECTION(x) __attribute__((section(x)))
|
||||
#define RT_USED __attribute__((used))
|
||||
#define ALIGN(n) __attribute__((aligned(n)))
|
||||
#define RT_WEAK __attribute__((weak))
|
||||
#define rt_section(x) __attribute__((section(x)))
|
||||
#define rt_used __attribute__((used))
|
||||
#define rt_align(n) __attribute__((aligned(n)))
|
||||
#define rt_weak __attribute__((weak))
|
||||
#define rt_inline static inline
|
||||
#define RTT_API
|
||||
#elif defined (_MSC_VER)
|
||||
#define RT_SECTION(x)
|
||||
#define RT_USED
|
||||
#define ALIGN(n) __declspec(align(n))
|
||||
#define RT_WEAK
|
||||
#define rt_section(x)
|
||||
#define rt_used
|
||||
#define rt_align(n) __declspec(align(n))
|
||||
#define rt_weak
|
||||
#define rt_inline static __inline
|
||||
#define RTT_API
|
||||
#elif defined (__TI_COMPILER_VERSION__)
|
||||
/* The way that TI compiler set section is different from other(at least
|
||||
* GCC and MDK) compilers. See ARM Optimizing C/C++ Compiler 5.9.3 for more
|
||||
* details. */
|
||||
#define RT_SECTION(x) __attribute__((section(x)))
|
||||
#define rt_section(x) __attribute__((section(x)))
|
||||
#ifdef __TI_EABI__
|
||||
#define RT_USED __attribute__((retain)) __attribute__((used))
|
||||
#define rt_used __attribute__((retain)) __attribute__((used))
|
||||
#else
|
||||
#define RT_USED __attribute__((used))
|
||||
#define rt_used __attribute__((used))
|
||||
#endif
|
||||
#define PRAGMA(x) _Pragma(#x)
|
||||
#define ALIGN(n) __attribute__((aligned(n)))
|
||||
#define rt_align(n) __attribute__((aligned(n)))
|
||||
#ifdef __TI_EABI__
|
||||
#define RT_WEAK __attribute__((weak))
|
||||
#define rt_weak __attribute__((weak))
|
||||
#else
|
||||
#define RT_WEAK
|
||||
#define rt_weak
|
||||
#endif
|
||||
#define rt_inline static inline
|
||||
#define RTT_API
|
||||
#elif defined (__TASKING__)
|
||||
#define RT_SECTION(x) __attribute__((section(x)))
|
||||
#define RT_USED __attribute__((used, protect))
|
||||
#define rt_section(x) __attribute__((section(x)))
|
||||
#define rt_used __attribute__((used, protect))
|
||||
#define PRAGMA(x) _Pragma(#x)
|
||||
#define ALIGN(n) __attribute__((__align(n)))
|
||||
#define RT_WEAK __attribute__((weak))
|
||||
#define rt_align(n) __attribute__((__align(n)))
|
||||
#define rt_weak __attribute__((weak))
|
||||
#define rt_inline static inline
|
||||
#define RTT_API
|
||||
#else
|
||||
@@ -256,7 +256,7 @@ typedef int (*init_fn_t)(void);
|
||||
const char __rti_level_##fn[] = ".rti_fn." level; \
|
||||
const char __rti_##fn##_name[] = #fn; \
|
||||
__declspec(allocate("rti_fn$f")) \
|
||||
RT_USED const struct rt_init_desc __rt_init_msc_##fn = \
|
||||
rt_used const struct rt_init_desc __rt_init_msc_##fn = \
|
||||
{__rti_level_##fn, fn, __rti_##fn##_name};
|
||||
#else
|
||||
struct rt_init_desc
|
||||
@@ -267,7 +267,7 @@ typedef int (*init_fn_t)(void);
|
||||
#define INIT_EXPORT(fn, level) \
|
||||
const char __rti_level_##fn[] = ".rti_fn." level; \
|
||||
__declspec(allocate("rti_fn$f")) \
|
||||
RT_USED const struct rt_init_desc __rt_init_msc_##fn = \
|
||||
rt_used const struct rt_init_desc __rt_init_msc_##fn = \
|
||||
{__rti_level_##fn, fn };
|
||||
#endif
|
||||
#else
|
||||
@@ -279,11 +279,11 @@ typedef int (*init_fn_t)(void);
|
||||
};
|
||||
#define INIT_EXPORT(fn, level) \
|
||||
const char __rti_##fn##_name[] = #fn; \
|
||||
RT_USED const struct rt_init_desc __rt_init_desc_##fn RT_SECTION(".rti_fn." level) = \
|
||||
rt_used const struct rt_init_desc __rt_init_desc_##fn rt_section(".rti_fn." level) = \
|
||||
{ __rti_##fn##_name, fn};
|
||||
#else
|
||||
#define INIT_EXPORT(fn, level) \
|
||||
RT_USED const init_fn_t __rt_init_##fn RT_SECTION(".rti_fn." level) = fn
|
||||
rt_used const init_fn_t __rt_init_##fn rt_section(".rti_fn." level) = fn
|
||||
#endif
|
||||
#endif
|
||||
#else
|
||||
|
||||
@@ -31,8 +31,8 @@ __declspec(allocate("RTMSymTab$f"))const char __rtmsym_##symbol##_name[] = "__vs
|
||||
|
||||
#else
|
||||
#define RTM_EXPORT(symbol) \
|
||||
const char __rtmsym_##symbol##_name[] RT_SECTION(".rodata.name") = #symbol; \
|
||||
const struct rt_module_symtab __rtmsym_##symbol RT_SECTION("RTMSymTab")= \
|
||||
const char __rtmsym_##symbol##_name[] rt_section(".rodata.name") = #symbol; \
|
||||
const struct rt_module_symtab __rtmsym_##symbol rt_section("RTMSymTab")= \
|
||||
{ \
|
||||
(void *)&symbol, \
|
||||
__rtmsym_##symbol##_name \
|
||||
|
||||
Reference in New Issue
Block a user