cppcheck.sh 668 B

123456789101112131415161718
  1. #!/bin/sh
  2. #
  3. # cppcheck static analysis
  4. # For Debian based: apt-get install cppcheck
  5. #
  6. num_cores=$(grep -c ^processor /proc/cpuinfo)
  7. if [ -z "$num_cores" ]; then
  8. echo "Hey, it looks like we're not on Linux. Please fix this script to add support for this OS."
  9. num_cores=4
  10. fi
  11. echo "Number of threads for cppcheck: $num_cores"
  12. # TODO: with future versions of cppcheck, add --library=glibc
  13. cppcheck . --error-exitcode=1 --quiet --enable=all --platform=unix64 --std=c99 --std=c++11 \
  14. --inline-suppr --force --template=gcc -j$num_cores \
  15. -U__BIGGEST_ALIGNMENT__ -UUAVCAN_MEM_POOL_BLOCK_SIZE -UBIG_ENDIAN -UBYTE_ORDER \
  16. -Iinclude $@