有关gcc的扩展__attribute__((unused))

================================
Author: taoyuetao
Email:
tao_yuetao@yahoo.com.cn
Blog: taoyuetao.cublog.cn
================================
在分析
[url=javascript:;]linux[/url]
内核时注意到有些函数会有添加__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.

表示该函数或变量可能不使用,这个属性可以避免编译器产生警告信息。


本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/31100/showart_240177.html

posted on 2013-07-18 17:39  小葫芦藤  阅读(273)  评论(0编辑  收藏  举报

导航