[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:
Man, Jianting (Meco)
2022-12-11 13:12:03 -05:00
committed by GitHub
parent a4b8762d85
commit 99bdf978d7
178 changed files with 472 additions and 462 deletions

View File

@@ -715,10 +715,10 @@ Macro definitions are often used in RT-Thread. For example, some common macro de
#define rt_inline static __inline
```
2RT_USEDdefinition is as follows, the purpose of this macro is to explain to the compiler that this code is useful, compilation needs to be saved even if it is not called in the function. For example, RT-Thread auto-initialization uses custom segments, using RT_USED will retain custom code snippets.
2rt_useddefinition is as follows, the purpose of this macro is to explain to the compiler that this code is useful, compilation needs to be saved even if it is not called in the function. For example, RT-Thread auto-initialization uses custom segments, using rt_used will retain custom code snippets.
```c
#define RT_USED __attribute__((used))
#define rt_used __attribute__((used))
```
3RT_UNUSEDdefinition is as follows, indicates that a function or variable may not be used. This attribute prevents the compiler from generating warnings.
@@ -727,10 +727,10 @@ Macro definitions are often used in RT-Thread. For example, some common macro de
#define RT_UNUSED __attribute__((unused))
```
4RT_WEAKdefinition is as follows, often used to define functions, when linking the function, the compiler will link the function without the keyword prefix first and link the function modified by weak if it can't find those functions.
4rt_weakdefinition is as follows, often used to define functions, when linking the function, the compiler will link the function without the keyword prefix first and link the function modified by weak if it can't find those functions.
```c
#define RT_WEAK __weak
#define rt_weak __weak
```
5ALIGN(n)definition is as follows, is used to align its stored address with n bytes when allocating an address space to an object. Here, n can be the power of 2. Byte alignment not only facilitates quick CPU access, but also save memory space if byte alignment is properly used.