本文主要是介绍__attribute__((unused))的作用,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
在分析内核时注意到有些函数会有添加__attribute__((unused)),在gcc手册中找到了有关的解释:
unused:This attribute, attached to a function, means that the function is meant to be
possibly unused. GCC will not produce a warning for this function.
===============================================================================
used: This attribute, attached to a function, means that code must be emitted for the
function even if it appears that the function is not referenced. This is useful,
for example, when the function is referenced only in inline assembly.
表示该函数或变量可能不使用,这个属性可以避免编译器产生警告信息
这篇关于__attribute__((unused))的作用的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!