aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSamuel Lidén Borell <samuel@kodafritt.se>2026-01-25 10:59:25 +0100
committerSamuel Lidén Borell <samuel@kodafritt.se>2026-01-25 10:59:25 +0100
commit6c45e281bacd196744893048ec200246d13293cb (patch)
treea4ee0be86d7727d729f6c4f45f6faff75945e281
parent8a9f27bdd3c237daee951d1bae4fff93eacfaeec (diff)
downloadslul-try2-main.tar.gz
slul-try2-main.zip
bootstrap: Add sparse to check-allHEADmain
-rw-r--r--bootstrap/Makefile16
1 files changed, 13 insertions, 3 deletions
diff --git a/bootstrap/Makefile b/bootstrap/Makefile
index 3e8b984..351d075 100644
--- a/bootstrap/Makefile
+++ b/bootstrap/Makefile
@@ -56,6 +56,8 @@ CPPCHECK_FLAGS = \
-q --enable=warning,performance,portability \
--check-level=exhaustive --inconclusive \
-D__STDC_VERSION__=202311 --error-exitcode=1
+# sparse gives some false positives in system headers for me
+SPARSE_FLAGS = -Wsparse-all -Wno-unknown-attribute -Wno-default-bitfield-sign
# Stage 1 compiler (written in C)
C_SOURCES = \
@@ -116,6 +118,9 @@ OBJECTS = \
RTL_C_HEADERS = \
$(srcdir)/rtlincl/rtl.h \
$(srcdir)/rtl/internal.h
+RTL_INCLUDES = \
+ -I $(srcdir)/rtlincl \
+ -I $(srcdir)/rtl
RTL_C_SOURCES = \
$(srcdir)/rtl/cli.c \
$(srcdir)/rtl/fail.c \
@@ -182,11 +187,12 @@ $(builddir)/stage2: $(STAGE2_OBJECTS) $(RTL_C_HEADERS)
.PHONY: all check check-all check-boundschecked check-valgrind \
check-pmccabe clang-analyze clean gcc-analyzer \
cppcheck cppcheck-stage1 cppcheck-rtl \
+ sparse sparse-stage1 sparse-rtl \
gdb-stage1 longlines outdirs
# TODO add a proper test once the stage2 compiler is done
check: $(builddir)/stage2
check-all: check check-valgrind check-boundschecked clang-analyze \
- gcc-analyzer cppcheck cppcheck-stage1 cppcheck-rtl \
+ gcc-analyzer cppcheck sparse \
check-tokens longlines
check-valgrind: $(builddir)/stage1
valgrind --leak-check=yes -q $(builddir)/stage1 \
@@ -219,8 +225,12 @@ cppcheck: cppcheck-stage1 cppcheck-rtl
cppcheck-stage1:
cppcheck $(CPPCHECK_FLAGS) -I $(srcdir) $(C_SOURCES)
cppcheck-rtl:
- cppcheck $(CPPCHECK_FLAGS) -I $(srcdir)/rtl -I $(srcdir)/rtlincl \
- $(RTL_C_SOURCES)
+ cppcheck $(CPPCHECK_FLAGS) $(RTL_INCLUDES) $(RTL_C_SOURCES)
+sparse: sparse-stage1 sparse-rtl
+sparse-stage1:
+ sparse $(SPARSE_FLAGS) -I $(srcdir) $(C_SOURCES) $(SPARSE_GREP)
+sparse-rtl:
+ sparse $(SPARSE_FLAGS) $(RTL_INCLUDES) $(RTL_C_SOURCES) $(SPARSE_GREP)
check-pmccabe:
pmccabe -c $(C_SOURCES) | sort -nr | head -n 20
gdb-stage1: $(builddir)/stage1