[fix][components][utilities]adjust the order of compiler macros (#5593)
* [fix][components][utilities]adjust the order of compiler macros Signed-off-by: WillianChan <chentingwei@rt-thread.com> * [modify][components][utilities]This PR complies with RT-Thread code specification Signed-off-by: WillianChan <chentingwei@rt-thread.com>
This commit is contained in:
parent
a1d1f95338
commit
49ccbdb851
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
|
@ -46,14 +46,14 @@ int var_export_init(void)
|
||||||
#if defined(__ARMCC_VERSION) /* for ARM C Compiler */
|
#if defined(__ARMCC_VERSION) /* for ARM C Compiler */
|
||||||
ve_exporter_table = &__ve_table_start + 1;
|
ve_exporter_table = &__ve_table_start + 1;
|
||||||
ve_exporter_num = &__ve_table_end - &__ve_table_start;
|
ve_exporter_num = &__ve_table_end - &__ve_table_start;
|
||||||
|
#elif defined (__IAR_SYSTEMS_ICC__) /* for IAR Compiler */
|
||||||
|
ve_exporter_table = &__ve_table_start + 1;
|
||||||
|
ve_exporter_num = &__ve_table_end - &__ve_table_start - 1;
|
||||||
#elif defined (__GNUC__) /* for GCC Compiler */
|
#elif defined (__GNUC__) /* for GCC Compiler */
|
||||||
extern const int __ve_table_start;
|
extern const int __ve_table_start;
|
||||||
extern const int __ve_table_end;
|
extern const int __ve_table_end;
|
||||||
ve_exporter_table = (const ve_exporter_t *)&__ve_table_start;
|
ve_exporter_table = (const ve_exporter_t *)&__ve_table_start;
|
||||||
ve_exporter_num = (const ve_exporter_t *)&__ve_table_end - ve_exporter_table;
|
ve_exporter_num = (const ve_exporter_t *)&__ve_table_end - ve_exporter_table;
|
||||||
#elif defined (__ICCARM__) || defined(__ICCRX__) /* for IAR Compiler */
|
|
||||||
ve_exporter_table = &__ve_table_start + 1;
|
|
||||||
ve_exporter_num = &__ve_table_end - &__ve_table_start - 1;
|
|
||||||
#elif defined (_MSC_VER) /* for MS VC++ compiler */
|
#elif defined (_MSC_VER) /* for MS VC++ compiler */
|
||||||
unsigned int *ptr_begin = (unsigned int *)&__ve_table_start;
|
unsigned int *ptr_begin = (unsigned int *)&__ve_table_start;
|
||||||
unsigned int *ptr_end = (unsigned int *)&__ve_table_end;
|
unsigned int *ptr_end = (unsigned int *)&__ve_table_end;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
|
@ -42,7 +42,18 @@ typedef struct ve_iterator ve_iterator_t;
|
||||||
#define VE_NOT_FOUND (0xFFFFFFFFu) /* not found */
|
#define VE_NOT_FOUND (0xFFFFFFFFu) /* not found */
|
||||||
|
|
||||||
/* exporter's export command */
|
/* exporter's export command */
|
||||||
#if defined(__GNUC__)
|
#if defined(__ARMCC_VERSION) || defined(__IAR_SYSTEMS_ICC__)
|
||||||
|
#define VAR_EXPORT(module, identi, value) \
|
||||||
|
const char _vexp_##identi##_module[] RT_SECTION(".rodata.vexp") = #module; \
|
||||||
|
const char _vexp_##identi##_identi[] RT_SECTION(".rodata.vexp") = #identi; \
|
||||||
|
RT_USED const struct ve_exporter _vexp_##module##identi \
|
||||||
|
RT_SECTION("1."#module".VarExpTab."#identi) = \
|
||||||
|
{ \
|
||||||
|
_vexp_##identi##_module, \
|
||||||
|
_vexp_##identi##_identi, \
|
||||||
|
value, \
|
||||||
|
}
|
||||||
|
#elif defined(__GNUC__)
|
||||||
#define VAR_EXPORT(module, identi, value) \
|
#define VAR_EXPORT(module, identi, value) \
|
||||||
const char _vexp_##identi##_module[] RT_SECTION(".rodata.vexp") = #module; \
|
const char _vexp_##identi##_module[] RT_SECTION(".rodata.vexp") = #module; \
|
||||||
const char _vexp_##identi##_identi[] RT_SECTION(".rodata.vexp") = #identi; \
|
const char _vexp_##identi##_identi[] RT_SECTION(".rodata.vexp") = #identi; \
|
||||||
|
@ -65,17 +76,6 @@ typedef struct ve_iterator ve_iterator_t;
|
||||||
_vexp_##identi##_identi, \
|
_vexp_##identi##_identi, \
|
||||||
value, \
|
value, \
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
#define VAR_EXPORT(module, identi, value) \
|
|
||||||
const char _vexp_##identi##_module[] RT_SECTION(".rodata.vexp") = #module; \
|
|
||||||
const char _vexp_##identi##_identi[] RT_SECTION(".rodata.vexp") = #identi; \
|
|
||||||
RT_USED const struct ve_exporter _vexp_##module##identi \
|
|
||||||
RT_SECTION("1."#module".VarExpTab."#identi) = \
|
|
||||||
{ \
|
|
||||||
_vexp_##identi##_module, \
|
|
||||||
_vexp_##identi##_identi, \
|
|
||||||
value, \
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* initialize var export */
|
/* initialize var export */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
* Copyright (c) 2006-2022, RT-Thread Development Team
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue