GCC中__attribute__((unused))和__attribute((unused))的区别

The difference between __attribute__((unused)) and __attribute((unused)) in GCC

__attribute__((unused))__attribute((unused)) 可以将变量标记为未使用以避免未使用警告。

它们有什么区别?

在 GCC 存储库中,在文件 c-common.c 中,定义了 struct c_common_resword 类型的数组 c_common_reswords

在数组中,您将找到以下元素:

 { "__attribute",   RID_ATTRIBUTE,  0 },
 { "__attribute__", RID_ATTRIBUTE,  0 },

RID_ATTRIBUTE是在/* C extensions */部分的enum rid中的c-common.h中定义的。

所以__attribute__attribute__是一样的。