maint: add static-analysis target to cfg.mk
Run 'make static-anslysis' to perform static code analysis using clang's 'scan-build' tool. * cfk.mk: (static-analysis,static-analysis-init,static-analysis-config, static-analysis-make): New targets.
This commit is contained in:
1 parent
2ce2a9fcde
commit
fa06f5690f
1 file changed
+24
@@ -174,3 +174,27 @@ exclude_file_name_regexp--sc_prohibit_empty_lines_at_EOF = \
|
||||
|
||||
# Exempt test-related files from our 80-column limitation, for now.
|
||||
exclude_file_name_regexp--sc_long_lines = ^testsuite/
|
||||
|
||||
|
||||
# static analysis
|
||||
STAN_CFLAGS ?= "-g -O0"
|
||||
|
||||
.PHONY: static-analysis-init
|
||||
static-analysis-init:
|
||||
type scan-build 1>/dev/null 2>&1 || \
|
||||
{ echo "scan-build program not found" >&2; exit 1; }
|
||||
$(MAKE) clean
|
||||
|
||||
.PHONY: static-analysis-config
|
||||
static-analysis-config:
|
||||
test -x ./configure || \
|
||||
{ echo "./configure script not found" >&2; exit 1; }
|
||||
scan-build ./configure CFLAGS=$(STAN_CFLAGS)
|
||||
|
||||
.PHONY: static-analysis-make
|
||||
static-analysis-make:
|
||||
scan-build $(MAKE)
|
||||
|
||||
.PHONY: static-analysis
|
||||
static-analysis: static-analysis-init static-analysis-config \
|
||||
static-analysis-make
|
||||
Reference in new issue
Block a user