這篇的對象是 static function,
static function 若沒有其它 function 去存取的話,
在 compile 時,會發生 unused error,
可以在 function 前加上 attribute((unused)) 避免出現 unused error,
但如果 function 本體實作有 error 時,仍會被檢查出來。

Case 1

function 沒有被存取

1335 static irqreturn_t xxx_handler(int irq, void *data)                                                                       1336 {1337         struct smbchg_chip *chip = (struct smbchg_chip *)data;..........

.....
.....
android/kernel/msm-3.18/drivers/power/qpnp-smbcharger.c:1335:20: warning: 'xxx_handler' defined but not used [-Wunused-function]
error, forbidden warning: qpnp-smbcharger.c:1335
make[3]: *** [drivers/power/qpnp-smbcharger.o] Error 1
make[2]: *** [drivers/power] Error 2
make[1]: *** [drivers] Error 2
make[1]: *** Waiting for unfinished jobs....
.....
.....
.....

Case 2

function 沒有被存取 且 加上 attribute((unused))

1335 __attribute__((unused)) static irqreturn_t xxx_handler(int irq, void *data)                                                                       1336 {1337         struct smbchg_chip *chip = (struct smbchg_chip *)data;...............

compile success

Case 3

function 沒有被存取 且 加上 attribute((unused)) 且 function 本體有 error

1335 static _attribute__((unused)) irqreturn_t xxx_handler(int irq, void *data)1336 {1337         asfadsf1338         struct smbchg_chip *chip = (struct smbchg_chip *)data;  ...............

.....
.....
android/kernel/msm-3.18/drivers/power/qpnp-smbcharger.c:1337:9: error: 'asfadsf' undeclared (first use in this function)asfadsf^
.....
.....

應用時機

當 coder 尚在 實作 function 本體,並想檢查是否有錯誤時,可以使用

转自:https://www.cnblogs.com/youchihwang/p/8986370.html

转载于:https://www.cnblogs.com/zl1991/p/11316477.html

unused function warning message(转)相关推荐

  1. R中Warning message:Computation failed in stat_stratum():could not find function “default_missing“

    R中画图报Warning message: Computation failed in stat_stratum(): could not find function "default_mi ...

  2. 关于编译Boost库时出现typedef unused的warning的解决办法

    之前在写代码后编译boost库时发现一个很神奇的现象,当我用g++默认的头文件寻址方式(即gcc后面不指定-I,从系统库中寻址),boost库的头文件就不会报warning,而当我用-I来指定boos ...

  3. Warning message:NAs introduced by coercion

    Warning message:NAs introduced by coercion 目录 Warning message:NAs introduced by coercion 问题: 解决: 完整问 ...

  4. Warning message:In a + b : longer object length is not a multiple of shorter object length

    Warning message:In a + b : longer object length is not a multiple of shorter object length 目录 Warnin ...

  5. geom_signif 函数自己的错误 ——Warning message:

    被两个错误搞了,一天---------以此纪念傻逼的自己,,气死了 第一个很傻逼的错误 **Computation failed in `stat_signif()`:not enough 'y' o ...

  6. Dell(戴尔)笔记本加装内存条后出现警告:“Warning Message : Alter!The amount of system memory has changed”

    Dell(戴尔)笔记本加装内存条后出现警告:"Warning Message : Alter!The amount of system memory has changed",点击 ...

  7. 关于R语言显示“Warning message: In normalizePath(path.expand(path), winslash, mustWork) : path[1]=”问题的解决办法

    作者声明:本方法由作者全网首创最先发布,未经允许严禁抄袭等行为,转载请附上原文出处链接,侵权必究! 正文: 笔者也是才接触R语言,还在基础学习阶段,R和RStudio好久没有更新版本了,今天更新了一下 ...

  8. Error in file(file, “rt“) : cannot open the connection In addition: Warning message:In file(file, “

    Error in file(file, "rt") : cannot open the connection In addition: Warning message: In fi ...

  9. 电脑黑屏:Warning Message Time-of-day not set_please

    问题场景: 首先是报Time-of_day not set-please run SETUP progarm. 的警告信息.然后开机黑屏. Warning Message:警告信息 Time-of-d ...

最新文章

  1. SQLer:无需编程语言即可将SQL查询转换为RESTful API的工具
  2. Zookeeper知识学习
  3. LINUX下CPU Load Average的一点研究
  4. [Intel Edison开发板] 02、Edison开发板入门
  5. 论述计算机科学与技术专业的狭义与广义,2013年秋季学期计算机科学与技术专业《高等代数》复习提纲与补充题...
  6. 2699元不加价!魅族16s Pro国家宝藏之越王勾践剑礼盒上架
  7. mysql创建表有则删除_MySQL创建表和删除表
  8. Axure资源及原型工具Axure RP 9下载
  9. 取消百度SiteApp转码
  10. Oracle并集union和union all
  11. 设计模式------享元模式和组合模式
  12. 华硕天选一代无线网卡断网
  13. 使用window.open打开新窗口被谷歌浏览器拦截
  14. BIM系统平台建设及实施方案
  15. al输入标题自动写作
  16. 选好核心交换机六个关键指标有哪些?
  17. 智慧政务行业发展报告
  18. 物联网国赛AIOT智能家居系统部署
  19. Cocos2d-x 3.X, IOS版添加广点通广告平台
  20. Phoenix(凤凰)的安装介绍

热门文章

  1. 圣杯布局与双飞翼布局全解
  2. [ python ] 正则表达式及re模块
  3. 销售必备心灵鸡汤(转)
  4. CAShapeLayer + UIBezierPath
  5. 工作中技术学习总结-初版
  6. smarty模板中类似for的功能实现
  7. php register_shutdown_function
  8. .NET程序设计之四书五经
  9. leetcode算法题--第一个只出现一次的字符
  10. php foreach 不等于_PHP中的7个模板引擎