标签:ret str attr def coder finish mpi declare sed
這篇的對象是 static function,
static function 若沒有其它 function 去存取的話,
在 compile 時,會發生 unused error,
可以在 function 前加上 attribute((unused)) 避免出現 unused error,
但如果 function 本體實作有 error 時,仍會被檢查出來。
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....
.....
.....
.....
1335 __attribute__((unused)) static irqreturn_t xxx_handler(int irq, void *data)
1336 {
1337 struct smbchg_chip *chip = (struct smbchg_chip *)data;
.....
.....
.....
compile success
1335 static r_attribute__((unused)) irqreturn_t xxx_handler(int irq, void *data)
1336 {
1337 asfadsf
1338 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 本體,並想檢查是否有錯誤時,可以使用
unused function warning message
标签:ret str attr def coder finish mpi declare sed
原文地址:https://www.cnblogs.com/youchihwang/p/8986370.html