scan-build.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/bin/sh
  2. # Copyright 2014 The Tor Project, Inc
  3. # See LICENSE for licensing information
  4. #
  5. # This script is used for running a bunch of clang scan-build checkers
  6. # on Tor.
  7. #
  8. # It has hardwired paths for Nick's desktop at the moment.
  9. CHECKERS="\
  10. --use-analyzer=/opt/clang-3.4/bin/clang \
  11. -disable-checker deadcode.DeadStores \
  12. -enable-checker alpha.core.CastSize \
  13. -enable-checker alpha.core.CastToStruct \
  14. -enable-checker alpha.core.IdenticalExpr \
  15. -enable-checker alpha.core.SizeofPtr \
  16. -enable-checker alpha.security.ArrayBoundV2 \
  17. -enable-checker alpha.security.MallocOverflow \
  18. -enable-checker alpha.security.ReturnPtrRange \
  19. -enable-checker alpha.unix.SimpleStream
  20. -enable-checker alpha.unix.cstring.BufferOverlap \
  21. -enable-checker alpha.unix.cstring.NotNullTerminated \
  22. -enable-checker alpha.unix.cstring.OutOfBounds \
  23. -enable-checker alpha.core.FixedAddr \
  24. -enable-checker security.insecureAPI.strcpy
  25. "
  26. /opt/clang-3.4/bin/scan-build/scan-build \
  27. $CHECKERS \
  28. --use-analyzer=/opt/clang-3.4/bin/clang \
  29. ./configure
  30. /opt/clang-3.4/bin/scan-build/scan-build \
  31. $CHECKERS \
  32. --use-analyzer=/opt/clang-3.4/bin/clang \
  33. make -j2
  34. # Haven't tried this yet.
  35. # -enable-checker alpha.unix.PthreadLock
  36. # This one gives a false positive on every strcmp.
  37. # -enable-checker alpha.core.PointerSub
  38. # This one hates it when we stick a nonzero const in a pointer.
  39. # -enable-checker alpha.core.FixedAddr
  40. # This one crashes sometimes for me.
  41. # -enable-checker alpha.deadcode.IdempotentOperations