scan-build.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. scan-build \
  27. $CHECKERS \
  28. ./configure
  29. scan-build \
  30. $CHECKERS \
  31. make -j2 -k
  32. # Haven't tried this yet.
  33. # -enable-checker alpha.unix.PthreadLock
  34. # This one gives a false positive on every strcmp.
  35. # -enable-checker alpha.core.PointerSub
  36. # This one hates it when we stick a nonzero const in a pointer.
  37. # -enable-checker alpha.core.FixedAddr
  38. # This one crashes sometimes for me.
  39. # -enable-checker alpha.deadcode.IdempotentOperations