aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/workflows/clang_static_analyzer.yml2
-rwxr-xr-x.github/workflows/clang_static_analyzer/start.sh17
-rw-r--r--docs/source/community/code_contributions.rst20
-rw-r--r--src/geodesic.c8
4 files changed, 25 insertions, 22 deletions
diff --git a/.github/workflows/clang_static_analyzer.yml b/.github/workflows/clang_static_analyzer.yml
index 9751fece..10d9c3d8 100644
--- a/.github/workflows/clang_static_analyzer.yml
+++ b/.github/workflows/clang_static_analyzer.yml
@@ -1,4 +1,4 @@
-name: CLang Static Analyzer
+name: Clang Static Analyzer
on: [push, pull_request]
diff --git a/.github/workflows/clang_static_analyzer/start.sh b/.github/workflows/clang_static_analyzer/start.sh
index 515e4d4a..e75c9b18 100755
--- a/.github/workflows/clang_static_analyzer/start.sh
+++ b/.github/workflows/clang_static_analyzer/start.sh
@@ -5,25 +5,25 @@ set -e
sudo apt update
DEBIAN_FRONTEND=noninteractive sudo apt-get install -y --no-install-recommends \
- autoconf automake libtool g++ make sqlite3 libsqlite3-dev libtiff-dev libcurl4-openssl-dev jq
+ g++ cmake make sqlite3 libsqlite3-dev libtiff-dev libcurl4-openssl-dev jq
CLANG_LLVM=clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04
wget -nv https://releases.llvm.org/9.0.0/$CLANG_LLVM.tar.xz
tar xJf $CLANG_LLVM.tar.xz
mv $CLANG_LLVM clang+llvm-9
-# prepare build files
-./autogen.sh
-
NPROC=$(nproc)
echo "NPROC=${NPROC}"
export MAKEFLAGS="-j ${NPROC}"
export PATH=$PWD/clang+llvm-9/bin:$PATH
-CXXFLAGS="-std=c++11" scan-build -o scanbuildoutput -plist -v ./configure
-rm -rf scanbuildoutput
-TOPDIR=$PWD
-scan-build -o $TOPDIR/scanbuildoutput -sarif -v -enable-checker alpha.unix.cstring.OutOfBounds,alpha.unix.cstring.BufferOverlap,optin.cplusplus.VirtualCall,optin.cplusplus.UninitializedObject make
+
+mkdir csa_build
+cd csa_build
+
+scan-build -o scanbuildoutput -plist -v cmake ..
+
+scan-build -o scanbuildoutput -sarif -v -enable-checker alpha.unix.cstring.OutOfBounds,alpha.unix.cstring.BufferOverlap,optin.cplusplus.VirtualCall,optin.cplusplus.UninitializedObject make
rm -f filtered_scanbuild.txt
files=$(find scanbuildoutput -name "*.sarif")
@@ -35,6 +35,7 @@ for f in $files; do
echo ""
cat tmp.txt >> filtered_scanbuild.txt
fi
+ rm -f tmp.txt
done
if [ -s filtered_scanbuild.txt ]; then
echo ""
diff --git a/docs/source/community/code_contributions.rst b/docs/source/community/code_contributions.rst
index 84feeb2f..a21b590b 100644
--- a/docs/source/community/code_contributions.rst
+++ b/docs/source/community/code_contributions.rst
@@ -111,10 +111,10 @@ possible, you can add a comment in the code like
in the preceding line. Replace
duplicateBreak with the actual name of the violated rule emitted by cppcheck.
-CLang Static Analyzer (CSA)
+Clang Static Analyzer (CSA)
~~~~~~~~~~~~~~~~~~~~~~~~~~~
-CSA is run by the ``travis/csa`` build configuration. You may also run it locally.
+CSA is run by a GitHub Actions workflow. You may also run it locally.
Preliminary step: install clang. For example:
@@ -123,27 +123,29 @@ Preliminary step: install clang. For example:
wget https://releases.llvm.org/9.0.0/clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz
tar xJf clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04.tar.xz
mv clang+llvm-9.0.0-x86_64-linux-gnu-ubuntu-18.04 clang+llvm-9
+ export PATH=$PWD/clang+llvm-9/bin:$PATH
-Run configure under the scan-build utility of clang:
+Configure PROJ with the :program:`scan-build` utility of clang:
::
+ mkdir csa_build
+ cd csa_build
+ scan-build cmake ..
- ./clang+llvm-9/bin/scan-build ./configure
-
-Build under scan-build:
+Build using :program:`scan-build`:
::
- ./clang+llvm-9/bin/scan-build make [-j8]
+ scan-build make [-j8]
If CSA finds errors, they will be emitted during the build. And in which case,
-at the end of the build process, scan-build will emit a warning message
+at the end of the build process, :program:`scan-build` will emit a warning message
indicating errors have been found and how to display the error report. This
is with something like
::
- ./clang+llvm-9/bin/scan-view /tmp/scan-build-2021-03-15-121416-17476-1
+ scan-view /tmp/scan-build-2021-03-15-121416-17476-1
This will open a web browser with the interactive report.
diff --git a/src/geodesic.c b/src/geodesic.c
index c8835a7a..225ccfdf 100644
--- a/src/geodesic.c
+++ b/src/geodesic.c
@@ -593,8 +593,8 @@ real geod_genposition(const struct geod_geodesicline* l,
* if ((outmask & GEOD_XX) && pYY)
* *pYY = YY;
*
- * the second check "&& pYY" is redundant. It's there to make the CLang
- * static analyzer happy.
+ * the second check "&& pYY" is redundant. It's there to make the Clang
+ * Static Analyzer happy.
*/
if ((outmask & GEOD_LATITUDE) && plat2)
*plat2 = lat2;
@@ -1826,7 +1826,7 @@ void geod_polygon_addedge(const struct geod_geodesic* g,
real azi, real s) {
if (p->num) { /* Do nothing is num is zero */
/* Initialize S12 to stop Visual Studio warning. Initialization of lat and
- * lon is to make CLang static analyzer happy. */
+ * lon is to make Clang Static Analyzer happy. */
real lat = 0, lon = 0, S12 = 0;
geod_gendirect(g, p->lat, p->lon, azi, GEOD_LONG_UNROLL, s,
&lat, &lon, nullptr,
@@ -1928,7 +1928,7 @@ unsigned geod_polygon_testedge(const struct geod_geodesic* g,
tempsum = p->A[0];
crossings = p->crossings;
{
- /* Initialization of lat, lon, and S12 is to make CLang static analyzer
+ /* Initialization of lat, lon, and S12 is to make Clang Static Analyzer
* happy. */
real lat = 0, lon = 0, s12, S12 = 0;
geod_gendirect(g, p->lat, p->lon, azi, GEOD_LONG_UNROLL, s,