neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

splint.vim (2219B)


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