__attribute__ ((unused))
程序员文章站
2022-07-14 13:17:22
...
今天编译 tcpdump 看到这个选项。。谷歌了下,原来是去除 编译器对未引用的函数的警告的,
Problem: I received the following warning:
warning: unused variable '<variable_name>'
warning: unused function '<function_name>'
Solution: If variable
<variable_name> or function
<function_name> is not used, it can be removed. If it is only used sometimes, you can use __attribute__((unused)). This attribute suppresses these warnings. For example:
int __attribute__ ((unused)) myfunction(int parm1, long parm2) { … }
long __attribute__ ((unused)) myvariable;
If there are a large number of unused variables or functions, which can happen with ported code, you can add the -Wno-unused compiler option to your makefile. This option suppresses all unused warnings.
转载于:https://my.oschina.net/sincoder/blog/68031
上一篇: 生成随机验证码工具类
下一篇: django-生成随机验证码
推荐阅读
-
Xcode版本问题:Unknown argument type ‘__attribute__‘ in method -[RCTAppState getCurrentAppState:error:].
-
__attribute__ ((unused))
-
GCC 编译时指定变量存储地址 __attribute__((section(".ARM.__at_address")))
-
弱符号__attribute__((weak))
-
SQL Server中如何识别、查找未使用的索引(unused indexes)
-
error ‘res‘ is assigned a value but never used no-unused-vars
-
Oracle日志文件的状态current/active/inactive/unused
-
pip 错误unused-command-line-argument-hard-error-in-future解决办法
-
pip 错误unused-command-line-argument-hard-error-in-future解决办法
-
pip 错误unused-command-line-argument-hard-error-in-future解决办法