编译器属性。用于屏蔽不同编译器属性的区别。
更多...
|
#define | __weak __attribute__((weak)) |
| 弱声明符号。 被 __weak 修饰的符号(变量或函数) 可以被 没有 用 __weak 修饰的符号覆盖或重定义。
|
|
#define | __used __attribute__((used)) |
| 编辑器不会优化掉被 __used 修饰的符号, 即使在代码中即使没有使用到该符号。
|
|
#define | __aligned(x) __attribute__((aligned(x))) |
| 指定变量或结构体的对齐方式(单位字节)。
|
|
#define | __section(x) __attribute__((section(x))) |
| 指定函数或变量的段位置,如 data 或 bss。
|
|
#define | likely(x) __builtin_expect(!!(x), 1) |
| 分支预测,优化条件为 真 的可能性更大的情况。
|
|
#define | unlikely(x) __builtin_expect(!!(x), 0) |
| 分支预测,优化条件为 假 的可能性更大的情况。
|
|
#define | __packed __attribute__((packed)) |
| 取消结构体在编译过程中的优化对齐,按照实际占用字节数进行对齐。
|
|
编译器属性。用于屏蔽不同编译器属性的区别。
◆ __weak
#define __weak __attribute__((weak)) |
◆ __used
#define __used __attribute__((used)) |
编辑器不会优化掉被 __used 修饰的符号, 即使在代码中即使没有使用到该符号。
在文件 xf_attr.h 第 60 行定义.
◆ __aligned
#define __aligned |
( |
|
x | ) |
__attribute__((aligned(x))) |
◆ __section
#define __section |
( |
|
x | ) |
__attribute__((section(x))) |
◆ likely
#define likely |
( |
|
x | ) |
__builtin_expect(!!(x), 1) |
◆ unlikely
#define unlikely |
( |
|
x | ) |
__builtin_expect(!!(x), 0) |
◆ __packed
#define __packed __attribute__((packed)) |