mirror of
https://gitlab.com/game-loader/hugo.git
synced 2025-04-20 14:02:07 +08:00
change post
This commit is contained in:
parent
5f097a1720
commit
83fbfce999
@ -40,9 +40,9 @@ Minimal程序使用了SEC宏,展开后结果分析如下:
|
|||||||
|
|
||||||
#### \_Pragma {#pragma}
|
#### \_Pragma {#pragma}
|
||||||
|
|
||||||
其中有三句为_Pragma,这是一个C99新引入的运算符,作为运算符的优势在于其可以用于宏中,如该源文件中的SEC宏。该运算符在处理运算符内的表达式后即相当于#pragma指令。处理过程非常简单,将'\\\\'替换为'\\',将\\"替换为"。这样_Pragma在预处理后即成为 `#pragma GCC diagnostic ignored "-Wignored-attributes"` 。pragma则是针对编译器给出的控制编译的指令,因此相关信息需要查阅gcc的说明。在该网站可以看到 **[<span class="underline">gcc支持的pragma</span>](https://gcc.gnu.org/onlinedocs/gcc/Pragmas.html)** 。其中该处使用的pragma为 **<span class="underline">[Diagnostic Pragmas\_](https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas)</span>** ,这里要注意的是这个编译指令会覆盖编译器的命令行参数,push即改变状态,忽视Wignored-attributes参数,pop则恢复原状。
|
其中有三句为_Pragma,这是一个C99新引入的运算符,作为运算符的优势在于其可以用于宏中,如该源文件中的SEC宏。该运算符在处理运算符内的表达式后即相当于#pragma指令。处理过程非常简单,将'\\\\'替换为'\\',将\\"替换为"。这样_Pragma在预处理后即成为 `#pragma GCC diagnostic ignored "-Wignored-attributes"` 。pragma则是针对编译器给出的控制编译的指令,因此相关信息需要查阅gcc的说明。在该网站可以看到 \underline{\*[[https://gcc.gnu.org/onlinedocs/gcc/Pragmas.html][gcc支持的pragma]]\*} 。其中该处使用的pragma为 \underline{\*[[https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas][Diagnostic Pragmas]]\*} ,这里要注意的是这个编译指令会覆盖编译器的命令行参数,push即改变状态,忽视Wignored-attributes参数,pop则恢复原状。
|
||||||
|
|
||||||
|
|
||||||
#### __attribute\_\_ {#attribute}
|
#### __attribute\_\_ {#attribute}
|
||||||
|
|
||||||
__attribute__也是一种编译器指令,用于在声明(函数,变量,类型)时帮助声明对象向编译器告知某些编译特性。在gnu网站上可以查知 **[可用的属性](https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/Function-Attributes.html)** ,在此处的含义为,将对应的函数放入指定的name段中,并且即使该函数没有被引用也不允许将该自定义的段优化掉(used)。
|
__attribute__也是一种编译器指令,用于在声明(函数,变量,类型)时帮助声明对象向编译器告知某些编译特性。在gnu网站上可以查知 \underline{\*[[https://gcc.gnu.org/onlinedocs/gcc-3.2/gcc/Function-Attributes.html][可用的属性]]\*} ,在此处的含义为,将对应的函数放入指定的name段中,并且即使该函数没有被引用也不允许将该自定义的段优化掉(used)。
|
||||||
|
Loading…
Reference in New Issue
Block a user