blob: e00460149c2a8dee09cbe2f3bca5efc8cce01163 [file] [log] [blame]
Bram Moolenaar071d4272004-06-13 20:20:40 +00001" 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/
Bram Moolenaar54775062019-07-31 21:07:14 +02005" Last Change: 2019 Jul 23
Doug Kearns408281e2024-04-04 22:00:58 +02006" 2024 Apr 03 by The Vim Project (removed :CompilerSet definition)
Bram Moolenaar5c736222010-01-06 20:54:52 +01007" $Revision: 1.3 $
Bram Moolenaar071d4272004-06-13 20:20:40 +00008
9if exists("current_compiler")
10 finish
11endif
12let current_compiler = "splint"
13
Bram Moolenaar071d4272004-06-13 20:20:40 +000014let s:cpo_save = &cpo
15set 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
Bram Moolenaar54775062019-07-31 21:07:14 +020019CompilerSet makeprg=splint\ %:S
Bram Moolenaar071d4272004-06-13 20:20:40 +000020
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
51CompilerSet errorformat=%OLCLint*m,
52 \%OSplint*m,
Bram Moolenaar8fef2ad2005-04-23 20:42:23 +000053 \%f(%l\\,%c):\ %m,
Bram Moolenaar071d4272004-06-13 20:20:40 +000054 \%*[\ ]%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,
Bram Moolenaare5f258e2004-10-07 20:45:47 +000065 \%C\ %#%m
Bram Moolenaar071d4272004-06-13 20:20:40 +000066
67let &cpo = s:cpo_save
68unlet s:cpo_save