File tree Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Expand file tree Collapse file tree 3 files changed +30
-2
lines changed Original file line number Diff line number Diff line change @@ -60,6 +60,28 @@ function do_sparse()
6060 make -C examples clean
6161}
6262
63+ function do_gcc()
64+ {
65+ local GCC=$( which gcc-10)
66+ if [ $? -ne 0 ]; then
67+ echo " [!] gcc-10 is not installed. Failed to run static analysis with GCC." >&2
68+ exit 1
69+ fi
70+
71+ make -C examples CONFIG_STATUS_CHECK_GCC=y STATUS_CHECK_GCC=$GCC 2> gcc.log
72+
73+ local WARNING_COUNT=$( cat gcc.log | egrep -c " warning:" )
74+ local ERROR_COUNT=$( cat gcc.log | egrep -c " error:" )
75+ local COUNT=` expr $WARNING_COUNT + $ERROR_COUNT `
76+ if [ $COUNT -gt 0 ]; then
77+ echo " gcc failed: $WARNING_COUNT warning(s), $ERROR_COUNT error(s)"
78+ cat gcc.log
79+ exit 1
80+ fi
81+ make -C examples CONFIG_STATUS_CHECK_GCC=y STATUS_CHECK_GCC=$GCC clean
82+ }
83+
6384do_cppcheck
6485do_sparse
86+ do_gcc
6587exit 0
Original file line number Diff line number Diff line change 1818 run : |
1919 sudo apt-get install -q -y clang-format-11
2020 sudo apt-get install -q -y cppcheck
21+ sudo apt-get install -q -y gcc-10
2122 .ci/check-format.sh
2223 .ci/static-analysis.sh
2324 .ci/build-n-run.sh
Original file line number Diff line number Diff line change @@ -32,11 +32,16 @@ obj-m += ioctl.o
3232
3333PWD := $(CURDIR )
3434
35+ ifeq ($(CONFIG_STATUS_CHECK_GCC ) ,y)
36+ CC =$(STATUS_CHECK_GCC )
37+ ccflags-y += -fanalyzer
38+ endif
39+
3540all :
36- $(MAKE ) -C /lib/modules/$(shell uname -r) /build M=$(PWD ) modules
41+ $(MAKE ) -C /lib/modules/$(shell uname -r) /build CC= $( CC ) M=$(PWD ) modules
3742
3843clean :
39- $(MAKE ) -C /lib/modules/$(shell uname -r) /build M=$(PWD ) clean
44+ $(MAKE ) -C /lib/modules/$(shell uname -r) /build CC= $( CC ) M=$(PWD ) clean
4045 $(RM ) other/cat_noblock * .plist
4146
4247indent :
You can’t perform that action at this time.
0 commit comments