diff options
| author | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
|---|---|---|
| committer | 3gg <3gg@shellblade.net> | 2025-12-27 12:03:39 -0800 |
| commit | 5a079a2d114f96d4847d1ee305d5b7c16eeec50e (patch) | |
| tree | 8926ab44f168acf787d8e19608857b3af0f82758 /contrib/SDL-3.2.8/build-scripts/codechecker-buildbot.sh | |
Initial commit
Diffstat (limited to 'contrib/SDL-3.2.8/build-scripts/codechecker-buildbot.sh')
| -rwxr-xr-x | contrib/SDL-3.2.8/build-scripts/codechecker-buildbot.sh | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/contrib/SDL-3.2.8/build-scripts/codechecker-buildbot.sh b/contrib/SDL-3.2.8/build-scripts/codechecker-buildbot.sh new file mode 100755 index 0000000..76b7853 --- /dev/null +++ b/contrib/SDL-3.2.8/build-scripts/codechecker-buildbot.sh | |||
| @@ -0,0 +1,59 @@ | |||
| 1 | #!/bin/bash | ||
| 2 | |||
| 3 | # This is a script used by some Buildbot build workers to push the project | ||
| 4 | # through Clang's static analyzer and prepare the output to be uploaded | ||
| 5 | # back to the buildmaster. You might find it useful too. | ||
| 6 | |||
| 7 | # Install Clang (you already have it on macOS, apt-get install clang | ||
| 8 | # on Ubuntu, etc), install CMake, and pip3 install codechecker. | ||
| 9 | |||
| 10 | FINALDIR="$1" | ||
| 11 | |||
| 12 | set -x | ||
| 13 | set -e | ||
| 14 | |||
| 15 | cd `dirname "$0"` | ||
| 16 | cd .. | ||
| 17 | |||
| 18 | rm -rf codechecker-buildbot | ||
| 19 | if [ ! -z "$FINALDIR" ]; then | ||
| 20 | rm -rf "$FINALDIR" | ||
| 21 | fi | ||
| 22 | |||
| 23 | mkdir codechecker-buildbot | ||
| 24 | cd codechecker-buildbot | ||
| 25 | |||
| 26 | # We turn off deprecated declarations, because we don't care about these warnings during static analysis. | ||
| 27 | cmake -Wno-dev -DSDL_STATIC=OFF -DCMAKE_BUILD_TYPE=Debug -DSDL_ASSERTIONS=enabled -DCMAKE_C_FLAGS="-Wno-deprecated-declarations" -DCMAKE_EXPORT_COMPILE_COMMANDS=1 .. | ||
| 28 | |||
| 29 | # CMake on macOS adds "-arch arm64" or whatever is appropriate, but this confuses CodeChecker, so strip it out. | ||
| 30 | perl -w -pi -e 's/\-arch\s+.*?\s+//g;' compile_commands.json | ||
| 31 | |||
| 32 | rm -rf ../analysis | ||
| 33 | CodeChecker analyze compile_commands.json -o ./reports | ||
| 34 | |||
| 35 | # "parse" returns 2 if there was a static analysis issue to report, but this | ||
| 36 | # does not signify an error in the parsing (that would be error code 1). Turn | ||
| 37 | # off the abort-on-error flag. | ||
| 38 | set +e | ||
| 39 | CodeChecker parse ./reports -e html -o ../analysis | ||
| 40 | set -e | ||
| 41 | |||
| 42 | cd .. | ||
| 43 | chmod -R a+r analysis | ||
| 44 | chmod -R go-w analysis | ||
| 45 | find analysis -type d -exec chmod a+x {} \; | ||
| 46 | if [ -x /usr/bin/xattr ]; then find analysis -exec /usr/bin/xattr -d com.apple.quarantine {} \; 2>/dev/null ; fi | ||
| 47 | |||
| 48 | if [ ! -z "$FINALDIR" ]; then | ||
| 49 | mv analysis "$FINALDIR" | ||
| 50 | else | ||
| 51 | FINALDIR=analysis | ||
| 52 | fi | ||
| 53 | |||
| 54 | rm -rf codechecker-buildbot | ||
| 55 | |||
| 56 | echo "Done. Final output is in '$FINALDIR' ..." | ||
| 57 | |||
| 58 | # end of codechecker-buildbot.sh ... | ||
| 59 | |||
