splint.vim 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. " Vim compiler file
  2. " Compiler: splint/lclint (C source code checker)
  3. " Maintainer: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
  4. " Splint Home: http://www.splint.org/
  5. " Last Change: 2019 Jul 23
  6. " 2024 Apr 03 by The Vim Project (removed :CompilerSet definition)
  7. " $Revision: 1.3 $
  8. if exists("current_compiler")
  9. finish
  10. endif
  11. let current_compiler = "splint"
  12. let s:cpo_save = &cpo
  13. set cpo-=C
  14. " adapt this if you want to check more than one file at a time.
  15. " put command line options in .splintrc or ~/.splintrc
  16. CompilerSet makeprg=splint\ %:S
  17. " Note: when using the new array bounds checking flags: Each warning
  18. " usually has several lines and several references to source code mostly
  19. " within one or two lines (see sample warning below). The easiest way
  20. " not to mess up file name detection and not to jump to all positions is
  21. " to add something like
  22. " -linelen 500 +boundscompacterrormessages
  23. " to your .splintrc and 'set cmdheight=4' or more.
  24. " TODO: reliable way to distinguish file names and constraints.
  25. "
  26. " sample warning (generic):
  27. "
  28. "foo.c:1006:12: Clauses exit with var referencing local storage in one
  29. " case, fresh storage in other case
  30. " foo.c:1003:2: Fresh storage var allocated
  31. "
  32. " sample warning (bounds checking):
  33. "
  34. "bounds.c: (in function updateEnv)
  35. "bounds.c:10:5: Possible out-of-bounds store:
  36. " strcpy(str, tmp)
  37. " Unable to resolve constraint:
  38. " requires maxSet(str @ bounds.c:10:13) >= maxRead(getenv("MYENV") @
  39. " bounds.c:6:9)
  40. " needed to satisfy precondition:
  41. " requires maxSet(str @ bounds.c:10:13) >= maxRead(tmp @ bounds.c:10:18)
  42. " derived from strcpy precondition: requires maxSet(<parameter 1>) >=
  43. " maxRead(<parameter 2>)
  44. " A memory write may write to an address beyond the allocated buffer. (Use
  45. " -boundswrite to inhibit warning)
  46. CompilerSet errorformat=%OLCLint*m,
  47. \%OSplint*m,
  48. \%f(%l\\,%c):\ %m,
  49. \%*[\ ]%f:%l:%c:\ %m,
  50. \%*[\ ]%f:%l:\ %m,
  51. \%*[^\"]\"%f\"%*\\D%l:\ %m,
  52. \\"%f\"%*\\D%l:\ %m,
  53. \%A%f:%l:%c:\ %m,
  54. \%A%f:%l:%m,
  55. \\"%f\"\\,
  56. \\ line\ %l%*\\D%c%*[^\ ]\ %m,
  57. \%D%*\\a[%*\\d]:\ Entering\ directory\ `%f',
  58. \%X%*\\a[%*\\d]:\ Leaving\ directory\ `%f',
  59. \%DMaking\ %*\\a\ in\ %f,
  60. \%C\ %#%m
  61. let &cpo = s:cpo_save
  62. unlet s:cpo_save