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()
60
60
make -C examples clean
61
61
}
62
62
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
+
63
84
do_cppcheck
64
85
do_sparse
86
+ do_gcc
65
87
exit 0
Original file line number Diff line number Diff line change 18
18
run : |
19
19
sudo apt-get install -q -y clang-format-11
20
20
sudo apt-get install -q -y cppcheck
21
+ sudo apt-get install -q -y gcc-10
21
22
.ci/check-format.sh
22
23
.ci/static-analysis.sh
23
24
.ci/build-n-run.sh
Original file line number Diff line number Diff line change @@ -32,11 +32,16 @@ obj-m += ioctl.o
32
32
33
33
PWD := $(CURDIR )
34
34
35
+ ifeq ($(CONFIG_STATUS_CHECK_GCC ) ,y)
36
+ CC =$(STATUS_CHECK_GCC )
37
+ ccflags-y += -fanalyzer
38
+ endif
39
+
35
40
all :
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
37
42
38
43
clean :
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
40
45
$(RM ) other/cat_noblock * .plist
41
46
42
47
indent :
You can’t perform that action at this time.
0 commit comments