set warning as error

需求

在kernel中将所有的warning当做error处理,这样可以保证编译的时候没有warning。

解决办法

在Kernel中的Makefile中的KBUILD_CFLAGS的变量中加上-Werror选项,通常如下:

1
2
3
4
5
6
KBUILD_CFLAGS   := -Wall -Wundef -Wstrict-prototypes -Wno-trigraphs \
-fno-strict-aliasing -fno-common -fshort-wchar \
-Werror-implicit-function-declaration \
-Wno-format-security \
-std=gnu89 \
-Werror

Title:set warning as error

Author:Victor Huang

Time:2019-06-08 / 15:06

Link:http://wowothink.com/ab94cde8/

License: Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)