Skip to content

Commit

Permalink
Add CPyChecker for a bit of static analysis of C code
Browse files Browse the repository at this point in the history
Refcounting correctly is hard...

The plugin will bail out before it successfully compiles. Allow the
check to fail but I want to see the warnings.
  • Loading branch information
zhuyifei1999 committed Sep 20, 2019
1 parent 959e5d5 commit 9436f26
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,18 @@ matrix:
python: 3.7
env:
- ACTION=codecov
- name: "Python 3.7 on Linux (CPyChecker)"
dist: bionic
python: 3.7
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
# Old GCC needed for refcounting verification
- g++-6 gcc-6-plugin-dev libpython3.7 libpython3.7-dev
env:
- ACTION=cpychecker
install:
- which python3 &> /dev/null && export PYTHON=python3 || export PYTHON=python
- pip3 install --upgrade pip
Expand Down
17 changes: 17 additions & 0 deletions travis.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,21 @@ EOF
esac
;;

cpychecker)
case "$1" in
install)
pip install six
pushd /tmp
git clone --branch v0.17 https://github.com/davidmalcolm/gcc-python-plugin.git gcc-python-plugin
cd gcc-python-plugin
CC=gcc-6 CXX=g++-6 make plugin
popd
;;
script)
# Not ready yet, permit failure
CC_FOR_CPYCHECKER=gcc-6 CC=/tmp/gcc-python-plugin/gcc-with-cpychecker CFLAGS=--cpychecker-verbose pip install -ve . || true
;;
esac
;;

esac

0 comments on commit 9436f26

Please sign in to comment.