Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
13753cca
Commit
13753cca
authored
9 years ago
by
Joakim Nohlgård
Browse files
Options
Downloads
Patches
Plain Diff
Makefile.scan-build: Add make goal for running Clang static code analysis
parent
9264a087
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Makefile.docker
+4
-0
4 additions, 0 deletions
Makefile.docker
Makefile.include
+9
-0
9 additions, 0 deletions
Makefile.include
Makefile.scan-build
+91
-0
91 additions, 0 deletions
Makefile.scan-build
with
104 additions
and
0 deletions
Makefile.docker
+
4
−
0
View file @
13753cca
...
@@ -5,6 +5,8 @@ export DOCKER_FLAGS ?= --rm
...
@@ -5,6 +5,8 @@ export DOCKER_FLAGS ?= --rm
export DOCKER_MAKECMDGOALS_POSSIBLE = \
export DOCKER_MAKECMDGOALS_POSSIBLE = \
all \
all \
buildtest \
buildtest \
scan-build \
scan-build-analyze \
#
#
export DOCKER_MAKECMDGOALS = $(filter $(MAKECMDGOALS),$(DOCKER_MAKECMDGOALS_POSSIBLE))
export DOCKER_MAKECMDGOALS = $(filter $(MAKECMDGOALS),$(DOCKER_MAKECMDGOALS_POSSIBLE))
...
@@ -52,6 +54,8 @@ export DOCKER_ENV_VARS = \
...
@@ -52,6 +54,8 @@ export DOCKER_ENV_VARS = \
BUILDTEST_MCU_GROUP \
BUILDTEST_MCU_GROUP \
BUILDTEST_VERBOSE \
BUILDTEST_VERBOSE \
TOOLCHAIN \
TOOLCHAIN \
SCANBUILD_OUTPUTDIR \
SCANBUILD_ARGS \
#
#
# Find which variables were set using the command line or the environment and
# Find which variables were set using the command line or the environment and
...
...
This diff is collapsed.
Click to expand it.
Makefile.include
+
9
−
0
View file @
13753cca
...
@@ -18,6 +18,9 @@ RIOTPROJECT := $(abspath $(RIOTPROJECT))
...
@@ -18,6 +18,9 @@ RIOTPROJECT := $(abspath $(RIOTPROJECT))
# using abspath, strip etc.
# using abspath, strip etc.
include
$(RIOTBASE)/Makefile.docker
include
$(RIOTBASE)/Makefile.docker
# Static code analysis tools provided by LLVM
include
$(RIOTBASE)/Makefile.scan-build
# Path to the current directory relative to the git root
# Path to the current directory relative to the git root
BUILDRELPATH
?=
$(
shell git rev-parse
--show-prefix
)
BUILDRELPATH
?=
$(
shell git rev-parse
--show-prefix
)
...
@@ -54,6 +57,12 @@ ifeq (, ${JENKINS_URL})
...
@@ -54,6 +57,12 @@ ifeq (, ${JENKINS_URL})
endif
endif
endif
endif
ifeq
($(OS),Darwin)
OPEN
:=
open
else
OPEN
:=
xdg-open
endif
ifeq
($(QUIET),1)
ifeq
($(QUIET),1)
AD
=
@
AD
=
@
MAKEFLAGS
+=
--no-print-directory
MAKEFLAGS
+=
--no-print-directory
...
...
This diff is collapsed.
Click to expand it.
Makefile.scan-build
0 → 100644
+
91
−
0
View file @
13753cca
SCANBUILD_ENV_VARS
:=
\
APPDIR
\
AR
\
ARFLAGS
\
AS
\
ASFLAGS
\
BINDIR
\
BINDIRBASE
\
BOARD
\
BUILDRELPATH
\
CC
\
CFLAGS
\
CPPMIX
\
CXX
\
CXXEXFLAGS
\
CXXUWFLAGS
\
ELFFILE
\
HEXFILE
\
HOME
\
LINK
\
LINKFLAGPREFIX
\
LINKFLAGS
\
OBJCOPY
\
OFLAGS
\
PATH
\
PREFIX
\
QUIET
\
RIOT_VERSION
\
SIZE
\
TOOLCHAIN
\
UNDEF
\
USER
\
#
SCANBUILD_ARGS
?=
\
-analyze-headers
\
--use-cc
=
$(
CC
)
\
--use-c
++
=
$(
CXX
)
\
-analyzer-config
stable-report-filename
=
true
\
#
export
SCANBUILD_OUTPUTDIR
=
$(
CURDIR
)
/scan-build/
# Find all variables given on the command line and recreate the command.
CMDVARS
:=
$(
strip
$(
foreach varname,
$(
SCANBUILD_ENV_VARS
)
,
\
$(
if
$(
filter
command
,
$(
origin
$(
varname
)))
,
\
'
$(
varname
)
=
$(
subst '
,
'\'',
$($(
varname
)))
'
,
\
)))
ENVVARS
:=
$(
strip
$(
foreach varname,
$(
SCANBUILD_ENV_VARS
)
,
\
$(
if
$(
filter environment,
$(
origin
$(
varname
)))
,
\
'
$(
varname
)
=
$(
subst '
,
'\'',
$($(
varname
)))
'
,
\
)))
.PHONY
:
scan-build scan-build-analyze scan-build-view
scan-build
:
scan-build-view scan-build-analyze
scan-build-view
:
scan-build-analyze
ifeq
($(BUILD_IN_DOCKER),1)
scan-build-analyze
:
..in-docker-container
else
# BUILD_IN_DOCKER
scan-build-analyze
:
clean
@$(
COLOR_ECHO
)
'
$(
COLOR_GREEN
)
Performing Clang static code analysis using toolchain "
$(
TOOLCHAIN
)
".
$(
COLOR_RESET
)
'
# ccc-analyzer needs to be told the proper -target setting for best results,
# otherwise false error reports about unknown register names etc will be produced.
# These kinds of errors can be safely ignored as long as they only come from LLVM
@if
[
"$${TOOLCHAIN}"
!=
"llvm"
-a
"$${BOARD}"
!=
"native"
];
then
\
$(COLOR_ECHO)
'$(COLOR_YELLOW)Recommend using TOOLCHAIN=llvm for best results.$(COLOR_RESET)'
;
\
$(COLOR_ECHO) '$(COLOR_YELLOW)Ignore any "error
:
unknown register name '
\'
'rX'
\'
' in asm" messages.$(COLOR_RESET)';
\
fi
$(
AD
)
mkdir
-p
'
$(
SCANBUILD_OUTPUTDIR
)
'
$(
AD
)
env
-i
$(
ENVVARS
)
\
scan-build
-o
'
$(
SCANBUILD_OUTPUTDIR
)
'
$(
SCANBUILD_ARGS
)
\
make
-C
$(
CURDIR
)
all
$(
strip
$(
CMDVARS
));
endif
# BUILD_IN_DOCKER
ifeq
(1,$(INSIDE_DOCKER))
scan-build-view
:
@
else
@
echo
"Showing most recent report in your web browser..."
@
REPORT_FILE
=
"
$$(
find '
$(
SCANBUILD_OUTPUTDIR
)
' -maxdepth 2 -mindepth 2
\
-type f -name 'index.html' 2>/dev/null | sort | tail -n 1
)
"
;
\
if
[
-n
"
$${
REPORT_FILE
}
"
]
;
then
\
echo
"
$(
OPEN
)
$${
REPORT_FILE
}
"
;
\
$(
OPEN
)
"
$${
REPORT_FILE
}
"
;
\
else
\
echo
"No report found"
;
\
fi
endif
# Reset the default goal.
.DEFAULT_GOAL
:=
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment