Skip to content

Commit d0294dd

Browse files
committed
make: enable assert() in make scan-build
Compare scan-build's [documentation][1]: > ALWAYS analyze a project in its "debug" configuration > > Most projects can be built in a "debug" mode that enables assertions. > Assertions are picked up by the static analyzer to prune infeasible > paths, which in some cases can greatly reduce the number of false > positives (bogus error reports) emitted by the tool. Closes RIOT-OS#3960. 1: http://clang-analyzer.llvm.org/scan-build.html#recommended_debug
1 parent 6c61266 commit d0294dd

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

Makefile.cflags

+3-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ CFLAGS += -fno-common
5656
CFLAGS += -Wall
5757

5858
ifeq (,$(filter -DDEVELHELP,$(CFLAGS)))
59-
CFLAGS += -DNDEBUG
59+
ifneq (1,$(FORCE_ASSERTS))
60+
CFLAGS += -DNDEBUG
61+
endif
6062
endif
6163

6264
# Default ARFLAGS for platforms which do not specify it.

Makefile.scan-build

+1-1
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ scan-build-analyze: clean
7070
$(AD)mkdir -p '$(SCANBUILD_OUTPUTDIR)'
7171
$(AD)env -i $(ENVVARS) \
7272
scan-build -o '$(SCANBUILD_OUTPUTDIR)' $(SCANBUILD_ARGS) \
73-
make -C $(CURDIR) all $(strip $(CMDVARS));
73+
make -C $(CURDIR) all $(strip $(CMDVARS)) FORCE_ASSERTS=1;
7474
endif # BUILD_IN_DOCKER
7575

7676
ifeq (1,$(INSIDE_DOCKER))

0 commit comments

Comments
 (0)