Merge branch 'gcc_refactor'

This commit is contained in:
LCD 47 2013-09-20 01:52:15 +03:00
commit 29839fc89f
19 changed files with 393 additions and 955 deletions

View File

@ -31,8 +31,8 @@ CSS, Cucumber, CUDA, D, Dart, DocBook, Dust, Elixir, Erlang, eRuby, Fortran,
Gentoo metadata, Go, Haml, Haskell, Haxe, HSS, HTML, Java, JavaScript, JSON, Gentoo metadata, Go, Haml, Haskell, Haxe, HSS, HTML, Java, JavaScript, JSON,
LESS, LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C, LESS, LISP, LLVM intermediate language, Lua, MATLAB, NASM, Objective-C,
Objective-C++, OCaml, Perl, Perl POD, PHP, Puppet, Python, reStructuredText, Objective-C++, OCaml, Perl, Perl POD, PHP, Puppet, Python, reStructuredText,
Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX, Twig, TypeScript, Vala, VHDL, Ruby, Rust, SASS/SCSS, Scala, Slim, Tcl, TeX, Twig, TypeScript, Vala, Verilog,
xHtml, XML, XSLT, YAML, z80, Zope page templates, zsh. VHDL, xHtml, XML, XSLT, YAML, z80, Zope page templates, zsh.
## Screenshot ## Screenshot

View File

@ -6,68 +6,13 @@ let g:loaded_syntastic_c_autoload = 1
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim
" initialize c/cpp syntax checker handlers " Public functions {{{1
function! s:Init()
let s:handlers = []
let s:cflags = {}
call s:RegHandler('gtk', 'syntastic#c#CheckPKG',
\ ['gtk', 'gtk+-2.0', 'gtk+', 'glib-2.0', 'glib'])
call s:RegHandler('glib', 'syntastic#c#CheckPKG',
\ ['glib', 'glib-2.0', 'glib'])
call s:RegHandler('glade', 'syntastic#c#CheckPKG',
\ ['glade', 'libglade-2.0', 'libglade'])
call s:RegHandler('libsoup', 'syntastic#c#CheckPKG',
\ ['libsoup', 'libsoup-2.4', 'libsoup-2.2'])
call s:RegHandler('webkit', 'syntastic#c#CheckPKG',
\ ['webkit', 'webkit-1.0'])
call s:RegHandler('cairo', 'syntastic#c#CheckPKG',
\ ['cairo', 'cairo'])
call s:RegHandler('pango', 'syntastic#c#CheckPKG',
\ ['pango', 'pango'])
call s:RegHandler('libxml', 'syntastic#c#CheckPKG',
\ ['libxml', 'libxml-2.0', 'libxml'])
call s:RegHandler('freetype', 'syntastic#c#CheckPKG',
\ ['freetype', 'freetype2', 'freetype'])
call s:RegHandler('SDL', 'syntastic#c#CheckPKG',
\ ['sdl', 'sdl'])
call s:RegHandler('opengl', 'syntastic#c#CheckPKG',
\ ['opengl', 'gl'])
call s:RegHandler('ruby', 'syntastic#c#CheckRuby', [])
call s:RegHandler('Python\.h', 'syntastic#c#CheckPython', [])
call s:RegHandler('php\.h', 'syntastic#c#CheckPhp', [])
endfunction
" default include directories
let s:default_includes = [ '.', '..', 'include', 'includes',
\ '../include', '../includes' ]
" convenience function to determine the 'null device' parameter " convenience function to determine the 'null device' parameter
" based on the current operating system " based on the current operating system
function! syntastic#c#GetNullDevice() function! syntastic#c#NullOutput()
if has('win32') let known_os = has('win32') || has('unix') || has('mac')
return '-o nul' return known_os ? '-o ' . syntastic#util#DevNull() : ''
elseif has('unix') || has('mac')
return '-o /dev/null'
endif
return ''
endfunction
" get the gcc include directory argument depending on the default
" includes and the optional user-defined 'g:syntastic_c_include_dirs'
function! syntastic#c#GetIncludeDirs(filetype)
let include_dirs = []
if !exists('g:syntastic_'.a:filetype.'_no_default_include_dirs') ||
\ !g:syntastic_{a:filetype}_no_default_include_dirs
let include_dirs = copy(s:default_includes)
endif
if exists('g:syntastic_'.a:filetype.'_include_dirs')
call extend(include_dirs, g:syntastic_{a:filetype}_include_dirs)
endif
return join(map(syntastic#util#unique(include_dirs), '"-I" . v:val'), ' ')
endfunction endfunction
" read additional compiler flags from the given configuration file " read additional compiler flags from the given configuration file
@ -75,19 +20,27 @@ endfunction
function! syntastic#c#ReadConfig(file) function! syntastic#c#ReadConfig(file)
" search in the current file's directory upwards " search in the current file's directory upwards
let config = findfile(a:file, '.;') let config = findfile(a:file, '.;')
if config == '' || !filereadable(config) | return '' | endif if config == '' || !filereadable(config)
return ''
endif
" convert filename into absolute path " convert filename into absolute path
let filepath = substitute(fnamemodify(config, ':p:h'), '\', '/', 'g') let filepath = fnamemodify(config, ':p:h')
" try to read config file " try to read config file
try try
let lines = map(readfile(config), let lines = readfile(config)
\ 'substitute(v:val, ''\'', ''/'', ''g'')') catch /^Vim\%((\a\+)\)\=:E484/
catch /E484/
return '' return ''
endtry endtry
" filter out empty lines and comments
call filter(lines, 'v:val !~ ''\v^(\s*#|$)''')
" remove leading and trailing spaces
call map(lines, 'substitute(v:val, ''^\s\+'', "", "")')
call map(lines, 'substitute(v:val, ''\s\+$'', "", "")')
let parameters = [] let parameters = []
for line in lines for line in lines
let matches = matchlist(line, '\C^\s*-I\s*\(\S\+\)') let matches = matchlist(line, '\C^\s*-I\s*\(\S\+\)')
@ -96,23 +49,145 @@ function! syntastic#c#ReadConfig(file)
if match(matches[1], '^\%(/\|\a:\)') != -1 if match(matches[1], '^\%(/\|\a:\)') != -1
call add(parameters, '-I' . matches[1]) call add(parameters, '-I' . matches[1])
else else
call add(parameters, '-I' . filepath . '/' . matches[1]) call add(parameters, '-I' . filepath . syntastic#util#Slash() . matches[1])
endif endif
else else
call add(parameters, line) call add(parameters, line)
endif endif
endfor endfor
return join(parameters, ' ') return join(map(parameters, 'syntastic#util#shescape(fnameescape(v:val))'), ' ')
endfunction
" GetLocList() for C-like compilers
function! syntastic#c#GetLocList(filetype, subchecker, options)
try
let flags = s:GetCflags(a:filetype, a:subchecker, a:options)
catch /\m\C^Syntastic: skip checks$/
return []
endtry
let makeprg = g:syntastic_{a:filetype}_compiler . ' ' . flags . ' ' . syntastic#util#shexpand('%')
let errorformat = s:GetCheckerVar('g', a:filetype, a:subchecker, 'errorformat', a:options['errorformat'])
let postprocess = s:GetCheckerVar('g', a:filetype, a:subchecker, 'remove_include_errors', 0) ?
\ ['filterForeignErrors'] : []
" process makeprg
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat,
\ 'postprocess': postprocess })
endfunction
" Private functions {{{1
" initialize c/cpp syntax checker handlers
function! s:Init()
let s:handlers = []
let s:cflags = {}
call s:RegHandler('cairo', 'syntastic#c#CheckPKG', ['cairo', 'cairo'])
call s:RegHandler('freetype', 'syntastic#c#CheckPKG', ['freetype', 'freetype2', 'freetype'])
call s:RegHandler('glade', 'syntastic#c#CheckPKG', ['glade', 'libglade-2.0', 'libglade'])
call s:RegHandler('glib', 'syntastic#c#CheckPKG', ['glib', 'glib-2.0', 'glib'])
call s:RegHandler('gtk', 'syntastic#c#CheckPKG', ['gtk', 'gtk+-2.0', 'gtk+', 'glib-2.0', 'glib'])
call s:RegHandler('libsoup', 'syntastic#c#CheckPKG', ['libsoup', 'libsoup-2.4', 'libsoup-2.2'])
call s:RegHandler('libxml', 'syntastic#c#CheckPKG', ['libxml', 'libxml-2.0', 'libxml'])
call s:RegHandler('pango', 'syntastic#c#CheckPKG', ['pango', 'pango'])
call s:RegHandler('SDL', 'syntastic#c#CheckPKG', ['sdl', 'sdl'])
call s:RegHandler('opengl', 'syntastic#c#CheckPKG', ['opengl', 'gl'])
call s:RegHandler('webkit', 'syntastic#c#CheckPKG', ['webkit', 'webkit-1.0'])
call s:RegHandler('php\.h', 'syntastic#c#CheckPhp', [])
call s:RegHandler('Python\.h', 'syntastic#c#CheckPython', [])
call s:RegHandler('ruby', 'syntastic#c#CheckRuby', [])
endfunction
" resolve checker-related user variables
function! s:GetCheckerVar(scope, filetype, subchecker, name, default)
let prefix = a:scope . ':' . 'syntastic_'
if exists(prefix . a:filetype . '_' . a:subchecker . '_' . a:name)
return {a:scope}:syntastic_{a:filetype}_{a:subchecker}_{a:name}
elseif exists(prefix . a:filetype . '_' . a:name)
return {a:scope}:syntastic_{a:filetype}_{a:name}
else
return a:default
endif
endfunction
" resolve user CFLAGS
function! s:GetCflags(ft, ck, opts)
" determine whether to parse header files as well
if has_key(a:opts, 'header_names') && expand('%') =~? a:opts['header_names']
if s:GetCheckerVar('g', a:ft, a:ck, 'check_header', 0)
let flags = get(a:opts, 'header_flags', '') . ' -c ' . syntastic#c#NullOutput()
else
" checking headers when check_header is unset: bail out
throw 'Syntastic: skip checks'
endif
else
let flags = get(a:opts, 'main_flags', '')
endif
let flags .= ' ' . s:GetCheckerVar('g', a:ft, a:ck, 'compiler_options', '') . ' ' . s:GetIncludeDirs(a:ft)
" check if the user manually set some cflags
let b_cflags = s:GetCheckerVar('b', a:ft, a:ck, 'cflags', '')
if b_cflags == ''
" check whether to search for include files at all
if !s:GetCheckerVar('g', a:ft, a:ck, 'no_include_search', 0)
if a:ft ==# 'c' || a:ft ==# 'cpp'
" refresh the include file search if desired
if s:GetCheckerVar('g', a:ft, a:ck, 'auto_refresh_includes', 0)
let flags .= ' ' . s:SearchHeaders()
else
" search for header includes if not cached already
if !exists('b:syntastic_' . a:ft . '_includes')
let b:syntastic_{a:ft}_includes = s:SearchHeaders()
endif
let flags .= ' ' . b:syntastic_{a:ft}_includes
endif
endif
endif
else
" user-defined cflags
let flags .= ' ' . b_cflags
endif
" add optional config file parameters
let config_file = s:GetCheckerVar('g', a:ft, a:ck, 'config_file', '.syntastic_' . a:ft . '_config')
let flags .= ' ' . syntastic#c#ReadConfig(config_file)
return flags
endfunction
" get the gcc include directory argument depending on the default
" includes and the optional user-defined 'g:syntastic_c_include_dirs'
function! s:GetIncludeDirs(filetype)
let include_dirs = []
if a:filetype =~# '\v^%(c|cpp|d|objc|objcpp)$' &&
\ (!exists('g:syntastic_'.a:filetype.'_no_default_include_dirs') ||
\ !g:syntastic_{a:filetype}_no_default_include_dirs)
let include_dirs = copy(s:default_includes)
endif
if exists('g:syntastic_'.a:filetype.'_include_dirs')
call extend(include_dirs, g:syntastic_{a:filetype}_include_dirs)
endif
return join(map(syntastic#util#unique(include_dirs), 'syntastic#util#shescape(fnameescape("-I" . v:val))'), ' ')
endfunction endfunction
" search the first 100 lines for include statements that are " search the first 100 lines for include statements that are
" given in the handlers dictionary " given in the handlers dictionary
function! syntastic#c#SearchHeaders() function! s:SearchHeaders()
let includes = '' let includes = ''
let files = [] let files = []
let found = [] let found = []
let lines = filter(getline(1, 100), 'v:val =~# "#\s*include"') let lines = filter(getline(1, 100), 'v:val =~# "^\s*#\s*include"')
" search current buffer " search current buffer
for line in lines for line in lines
@ -121,6 +196,7 @@ function! syntastic#c#SearchHeaders()
call add(files, file) call add(files, file)
continue continue
endif endif
for handler in s:handlers for handler in s:handlers
if line =~# handler["regex"] if line =~# handler["regex"]
let includes .= call(handler["func"], handler["args"]) let includes .= call(handler["func"], handler["args"])
@ -133,18 +209,21 @@ function! syntastic#c#SearchHeaders()
" search included headers " search included headers
for hfile in files for hfile in files
if hfile != '' if hfile != ''
let filename = expand('%:p:h') . (has('win32') ? let filename = expand('%:p:h') . syntastic#util#Slash() . hfile
\ '\' : '/') . hfile
try try
let lines = readfile(filename, '', 100) let lines = readfile(filename, '', 100)
catch /E484/ catch /^Vim\%((\a\+)\)\=:E484/
continue continue
endtry endtry
let lines = filter(lines, 'v:val =~# "#\s*include"')
let lines = filter(lines, 'v:val =~# "^\s*#\s*include"')
for handler in s:handlers for handler in s:handlers
if index(found, handler["regex"]) != -1 if index(found, handler["regex"]) != -1
continue continue
endif endif
for line in lines for line in lines
if line =~# handler["regex"] if line =~# handler["regex"]
let includes .= call(handler["func"], handler["args"]) let includes .= call(handler["func"], handler["args"])
@ -165,14 +244,14 @@ endfunction
function! syntastic#c#CheckPKG(name, ...) function! syntastic#c#CheckPKG(name, ...)
if executable('pkg-config') if executable('pkg-config')
if !has_key(s:cflags, a:name) if !has_key(s:cflags, a:name)
for i in range(a:0) for pkg in a:000
let l:cflags = system('pkg-config --cflags '.a:000[i]) let pkg_flags = system('pkg-config --cflags ' . pkg)
" since we cannot necessarily trust the pkg-config exit code " since we cannot necessarily trust the pkg-config exit code
" we have to check for an error output as well " we have to check for an error output as well
if v:shell_error == 0 && l:cflags !~? 'not found' if v:shell_error == 0 && pkg_flags !~? 'not found'
let l:cflags = ' '.substitute(l:cflags, "\n", '', '') let pkg_flags = ' ' . substitute(pkg_flags, "\n", '', '')
let s:cflags[a:name] = l:cflags let s:cflags[a:name] = pkg_flags
return l:cflags return pkg_flags
endif endif
endfor endfor
else else
@ -185,11 +264,11 @@ endfunction
" try to find PHP includes with 'php-config' " try to find PHP includes with 'php-config'
function! syntastic#c#CheckPhp() function! syntastic#c#CheckPhp()
if executable('php-config') if executable('php-config')
if !exists('s:php_flags') if !has_key(s:cflags, 'php')
let s:php_flags = system('php-config --includes') let s:cflags['php'] = system('php-config --includes')
let s:php_flags = ' ' . substitute(s:php_flags, "\n", '', '') let s:cflags['php'] = ' ' . substitute(s:cflags['php'], "\n", '', '')
endif endif
return s:php_flags return s:cflags['php']
endif endif
return '' return ''
endfunction endfunction
@ -197,13 +276,13 @@ endfunction
" try to find the ruby headers with 'rbconfig' " try to find the ruby headers with 'rbconfig'
function! syntastic#c#CheckRuby() function! syntastic#c#CheckRuby()
if executable('ruby') if executable('ruby')
if !exists('s:ruby_flags') if !has_key(s:cflags, 'ruby')
let s:ruby_flags = system('ruby -r rbconfig -e ' let s:cflags['ruby'] = system('ruby -r rbconfig -e ' .
\ . '''puts RbConfig::CONFIG["rubyhdrdir"] || RbConfig::CONFIG["archdir"]''') \ '''puts RbConfig::CONFIG["rubyhdrdir"] || RbConfig::CONFIG["archdir"]''')
let s:ruby_flags = substitute(s:ruby_flags, "\n", '', '') let s:cflags['ruby'] = substitute(s:cflags['ruby'], "\n", '', '')
let s:ruby_flags = ' -I' . s:ruby_flags let s:cflags['ruby'] = ' -I' . s:cflags['ruby']
endif endif
return s:ruby_flags return s:cflags['ruby']
endif endif
return '' return ''
endfunction endfunction
@ -211,13 +290,13 @@ endfunction
" try to find the python headers with distutils " try to find the python headers with distutils
function! syntastic#c#CheckPython() function! syntastic#c#CheckPython()
if executable('python') if executable('python')
if !exists('s:python_flags') if !has_key(s:cflags, 'python')
let s:python_flags = system('python -c ''from distutils import ' let s:cflags['python'] = system('python -c ''from distutils import ' .
\ . 'sysconfig; import sys; sys.stdout.write(sysconfig.get_python_inc())''') \ 'sysconfig; import sys; sys.stdout.write(sysconfig.get_python_inc())''')
let s:python_flags = substitute(s:python_flags, "\n", '', '') let s:cflags['python'] = substitute(s:cflags['python'], "\n", '', '')
let s:python_flags = ' -I' . s:python_flags let s:cflags['python'] = ' -I' . s:cflags['python']
endif endif
return s:python_flags return s:cflags['python']
endif endif
return '' return ''
endfunction endfunction
@ -231,9 +310,20 @@ function! s:RegHandler(regex, function, args)
call add(s:handlers, handler) call add(s:handlers, handler)
endfunction endfunction
" }}}1
" default include directories
let s:default_includes = [
\ '.',
\ '..',
\ 'include',
\ 'includes',
\ '..' . syntastic#util#Slash() . 'include',
\ '..' . syntastic#util#Slash() . 'includes' ]
call s:Init() call s:Init()
let &cpo = s:save_cpo let &cpo = s:save_cpo
unlet s:save_cpo unlet s:save_cpo
" vim: set et sts=4 sw=4: " vim: set et sts=4 sw=4 fdm=marker:

View File

@ -66,6 +66,11 @@ function! syntastic#postprocess#decodeXMLEntities(errors)
return llist return llist
endfunction endfunction
" filter out errors referencing other files
function! syntastic#postprocess#filterForeignErrors(errors)
return filter(copy(a:errors), 'get(v:val, "bufnr") == ' . bufnr(''))
endfunction
let &cpo = s:save_cpo let &cpo = s:save_cpo
unlet s:save_cpo unlet s:save_cpo
" vim: set et sts=4 sw=4: " vim: set et sts=4 sw=4:

View File

@ -19,6 +19,11 @@ function! syntastic#util#DevNull()
return '/dev/null' return '/dev/null'
endfunction endfunction
" Get directory separator
function! syntastic#util#Slash() abort
return !exists("+shellslash") || &shellslash ? '/' : '\'
endfunction
"search the first 5 lines of the file for a magic number and return a map "search the first 5 lines of the file for a magic number and return a map
"containing the args and the executable "containing the args and the executable
" "

View File

@ -7,68 +7,6 @@
" "
"============================================================================ "============================================================================
" In order to also check header files add this to your .vimrc:
"
" let g:syntastic_ada_check_header = 1
"
" To disable the search of included header files after special
" libraries like gtk and glib add this line to your .vimrc:
"
" let g:syntastic_ada_no_include_search = 1
"
" To disable the include of the default include dirs (such as /usr/include)
" add this line to your .vimrc:
"
" let g:syntastic_ada_no_default_include_dirs = 1
"
" To enable header files being re-checked on every file write add the
" following line to your .vimrc. Otherwise the header files are checked only
" one time on initially loading the file.
" In order to force syntastic to refresh the header includes simply
" unlet b:syntastic_ada_includes. Then the header files are being re-checked
" on the next file write.
"
" let g:syntastic_ada_auto_refresh_includes = 1
"
" Alternatively you can set the buffer local variable b:syntastic_ada_cflags.
" If this variable is set for the current buffer no search for additional
" libraries is done. I.e. set the variable like this:
"
" let b:syntastic_ada_cflags = ' -I/usr/include/libsoup-2.4'
"
" In order to add some custom include directories that should be added to the
" gcc command line you can add those to the global variable
" g:syntastic_ada_include_dirs. This list can be used like this:
"
" let g:syntastic_ada_include_dirs = [ 'includes', 'headers' ]
"
" Moreover it is possible to add additional compiler options to the syntax
" checking execution via the variable 'g:syntastic_ada_compiler_options':
"
" let g:syntastic_ada_compiler_options = ' -std=c++0x'
"
" Additionally the setting 'g:syntastic_ada_config_file' allows you to define
" a file that contains additional compiler arguments like include directories
" or CFLAGS. The file is expected to contain one option per line. If none is
" given the filename defaults to '.syntastic_ada_config':
"
" let g:syntastic_ada_config_file = '.config'
"
" Using the global variable 'g:syntastic_ada_remove_include_errors' you can
" specify whether errors of files included via the
" g:syntastic_ada_include_dirs' setting are removed from the result set:
"
" let g:syntastic_ada_remove_include_errors = 1
"
" Use the variable 'g:syntastic_ada_errorformat' to override the default error
" format:
"
" let g:syntastic_ada_errorformat = '%f:%l:%c: %trror: %m'
"
" Set your compiler executable with e.g. (defaults to gcc)
"
" let g:syntastic_ada_compiler = 'gcc'
if exists('g:loaded_syntastic_ada_gcc_checker') if exists('g:loaded_syntastic_ada_gcc_checker')
finish finish
endif endif
@ -89,73 +27,15 @@ if !exists('g:syntastic_ada_compiler_options')
let g:syntastic_ada_compiler_options = '' let g:syntastic_ada_compiler_options = ''
endif endif
if !exists('g:syntastic_ada_config_file')
let g:syntastic_ada_config_file = '.syntastic_ada_config'
endif
function! SyntaxCheckers_ada_gcc_GetLocList() function! SyntaxCheckers_ada_gcc_GetLocList()
let makeprg = g:syntastic_ada_compiler . ' -c -x ada -fsyntax-only ' return syntastic#c#GetLocList('ada', 'gcc', {
let errorformat = '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m' \ 'errorformat':
\ '%-G%f:%s:,' .
if exists('g:syntastic_c_errorformat') \ '%f:%l:%c: %m,' .
let errorformat = g:syntastic_c_errorformat \ '%f:%l: %m',
endif \ 'main_flags': '-c -x ada -fsyntax-only',
\ 'header_flags': '-x ada',
" add optional user-defined compiler options \ 'header_names': '\.ads$' })
let makeprg .= g:syntastic_ada_compiler_options
let makeprg .= ' ' . syntastic#util#shexpand('%') .
\ ' ' . syntastic#c#GetIncludeDirs('ada')
" determine whether to parse header files as well
if expand('%') =~? '\.ads$'
if exists('g:syntastic_ada_check_header')
let makeprg = g:syntastic_ada_compiler .
\ ' -c ' . syntastic#util#shexpand('%') .
\ ' ' . g:syntastic_ada_compiler_options .
\ ' ' . syntastic#c#GetIncludeDirs('ada')
else
return []
endif
endif
" check if the user manually set some cflags
if !exists('b:syntastic_ada_cflags')
" check whether to search for include files at all
if !exists('g:syntastic_ada_no_include_search') ||
\ g:syntastic_ada_no_include_search != 1
" refresh the include file search if desired
if exists('g:syntastic_ada_auto_refresh_includes') &&
\ g:syntastic_ada_auto_refresh_includes != 0
let makeprg .= syntastic#c#SearchHeaders()
else
" search for header includes if not cached already
if !exists('b:syntastic_ada_includes')
let b:syntastic_ada_includes = syntastic#c#SearchHeaders()
endif
let makeprg .= b:syntastic_ada_includes
endif
endif
else
" use the user-defined cflags
let makeprg .= b:syntastic_ada_cflags
endif
" add optional config file parameters
let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_ada_config_file)
" process makeprg
let errors = SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat })
" filter the processed errors if desired
if exists('g:syntastic_ada_remove_include_errors') &&
\ g:syntastic_ada_remove_include_errors != 0
return filter(errors,
\ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr(''))
else
return errors
endif
endfunction endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({

View File

@ -22,7 +22,7 @@ endfunction
function! SyntaxCheckers_asciidoc_asciidoc_GetLocList() function! SyntaxCheckers_asciidoc_asciidoc_GetLocList()
let makeprg = syntastic#makeprg#build({ let makeprg = syntastic#makeprg#build({
\ 'exe': 'asciidoc', \ 'exe': 'asciidoc',
\ 'args': syntastic#c#GetNullDevice(), \ 'args': syntastic#c#NullOutput(),
\ 'filetype': 'asciidoc', \ 'filetype': 'asciidoc',
\ 'subchecker': 'asciidoc' }) \ 'subchecker': 'asciidoc' })

View File

@ -10,67 +10,6 @@
" "
"============================================================================ "============================================================================
" In order to also check header files add this to your .vimrc:
"
" let g:syntastic_c_check_header = 1
"
" To disable the search of included header files after special
" libraries like gtk and glib add this line to your .vimrc:
"
" let g:syntastic_c_no_include_search = 1
"
" To disable the include of the default include dirs (such as /usr/include)
" add this line to your .vimrc:
"
" let g:syntastic_c_no_default_include_dirs = 1
"
" To enable header files being re-checked on every file write add the
" following line to your .vimrc. Otherwise the header files are checked only
" one time on initially loading the file.
" In order to force syntastic to refresh the header includes simply
" unlet b:syntastic_c_includes. Then the header files are being re-checked on
" the next file write.
"
" let g:syntastic_c_auto_refresh_includes = 1
"
" Alternatively you can set the buffer local variable b:syntastic_c_cflags.
" If this variable is set for the current buffer no search for additional
" libraries is done. I.e. set the variable like this:
"
" let b:syntastic_c_cflags = ' -I/usr/include/libsoup-2.4'
"
" In order to add some custom include directories that should be added to the
" gcc command line you can add those to the global variable
" g:syntastic_c_include_dirs. This list can be used like this:
"
" let g:syntastic_c_include_dirs = [ 'includes', 'headers' ]
"
" Moreover it is possible to add additional compiler options to the syntax
" checking execution via the variable 'g:syntastic_c_compiler_options':
"
" let g:syntastic_c_compiler_options = ' -ansi'
"
" Additionally the setting 'g:syntastic_c_config_file' allows you to define a
" file that contains additional compiler arguments like include directories or
" CFLAGS. The file is expected to contain one option per line. If none is
" given the filename defaults to '.syntastic_c_config':
"
" let g:syntastic_c_config_file = '.config'
"
" Using the global variable 'g:syntastic_c_remove_include_errors' you can
" specify whether errors of files included via the g:syntastic_c_include_dirs'
" setting are removed from the result set:
"
" let g:syntastic_c_remove_include_errors = 1
"
" Use the variable 'g:syntastic_c_errorformat' to override the default error
" format:
"
" let g:syntastic_c_errorformat = '%f:%l:%c: %trror: %m'
"
" Set your compiler executable with e.g. (defaults to gcc)
"
" let g:syntastic_c_compiler = 'clang'
if exists('g:loaded_syntastic_c_gcc_checker') if exists('g:loaded_syntastic_c_gcc_checker')
finish finish
@ -92,85 +31,23 @@ if !exists('g:syntastic_c_compiler_options')
let g:syntastic_c_compiler_options = '-std=gnu99' let g:syntastic_c_compiler_options = '-std=gnu99'
endif endif
if !exists('g:syntastic_c_config_file')
let g:syntastic_c_config_file = '.syntastic_c_config'
endif
function! SyntaxCheckers_c_gcc_GetLocList() function! SyntaxCheckers_c_gcc_GetLocList()
let makeprg = g:syntastic_c_compiler . ' -x c -fsyntax-only ' return syntastic#c#GetLocList('c', 'gcc', {
let errorformat = \ 'errorformat':
\ '%-G%f:%s:,' . \ '%-G%f:%s:,' .
\ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' . \ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' .
\ '%-G%f:%l: %#error: %#for each function it appears%.%#,' . \ '%-G%f:%l: %#error: %#for each function it appears%.%#,' .
\ '%-GIn file included%.%#,' . \ '%-GIn file included%.%#,' .
\ '%-G %#from %f:%l\,,' . \ '%-G %#from %f:%l\,,' .
\ '%f:%l:%c: %trror: %m,' . \ '%f:%l:%c: %trror: %m,' .
\ '%f:%l:%c: %tarning: %m,' . \ '%f:%l:%c: %tarning: %m,' .
\ '%f:%l:%c: %m,' . \ '%f:%l:%c: %m,' .
\ '%f:%l: %trror: %m,' . \ '%f:%l: %trror: %m,' .
\ '%f:%l: %tarning: %m,'. \ '%f:%l: %tarning: %m,'.
\ '%f:%l: %m' \ '%f:%l: %m',
\ 'main_flags': '-x c -fsyntax-only',
if exists('g:syntastic_c_errorformat') \ 'header_flags': '-x c',
let errorformat = g:syntastic_c_errorformat \ 'header_names': '\.h$' })
endif
" add optional user-defined compiler options
let makeprg .= g:syntastic_c_compiler_options
let makeprg .= ' ' . syntastic#util#shexpand('%') .
\ ' ' . syntastic#c#GetIncludeDirs('c')
" determine whether to parse header files as well
if expand('%') =~? '\.h$'
if exists('g:syntastic_c_check_header')
let makeprg = g:syntastic_c_compiler .
\ ' -c ' . syntastic#util#shexpand('%') .
\ ' ' . g:syntastic_c_compiler_options .
\ ' ' . syntastic#c#GetNullDevice() .
\ ' ' . syntastic#c#GetIncludeDirs('c')
else
return []
endif
endif
" check if the user manually set some cflags
if !exists('b:syntastic_c_cflags')
" check whether to search for include files at all
if !exists('g:syntastic_c_no_include_search') ||
\ g:syntastic_c_no_include_search != 1
" refresh the include file search if desired
if exists('g:syntastic_c_auto_refresh_includes') &&
\ g:syntastic_c_auto_refresh_includes != 0
let makeprg .= syntastic#c#SearchHeaders()
else
" search for header includes if not cached already
if !exists('b:syntastic_c_includes')
let b:syntastic_c_includes = syntastic#c#SearchHeaders()
endif
let makeprg .= b:syntastic_c_includes
endif
endif
else
" use the user-defined cflags
let makeprg .= b:syntastic_c_cflags
endif
" add optional config file parameters
let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_c_config_file)
" process makeprg
let errors = SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat })
" filter the processed errors if desired
if exists('g:syntastic_c_remove_include_errors') &&
\ g:syntastic_c_remove_include_errors != 0
return filter(errors,
\ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr(''))
else
return errors
endif
endfunction endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({

View File

@ -0,0 +1,47 @@
"============================================================================
"File: cobc.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: LCD 47 <lcd047 at gmail dot com>
"License: This program is free software. It comes without any warranty,
" to the extent permitted by applicable law. You can redistribute
" it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details.
"
"============================================================================
if exists('g:loaded_syntastic_cobol_cobc_checker')
finish
endif
let g:loaded_syntastic_cobol_cobc_checker = 1
if !exists('g:syntastic_cobol_compiler')
let g:syntastic_cobol_compiler = 'cobc'
endif
function! SyntaxCheckers_cobol_cobc_IsAvailable()
return executable(g:syntastic_cobol_compiler)
endfunction
let s:save_cpo = &cpo
set cpo&vim
if !exists('g:syntastic_cobol_compiler_options')
let g:syntastic_cobol_compiler_options = ''
endif
function! SyntaxCheckers_cobol_cobc_GetLocList()
return syntastic#c#GetLocList('cobol', 'cobc', {
\ 'errorformat': '%f:%l: %trror: %m',
\ 'main_flags': '-fsyntax-only' })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'cobol',
\ 'name': 'cobc'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View File

@ -10,68 +10,6 @@
" "
"============================================================================ "============================================================================
" In order to also check header files add this to your .vimrc:
"
" let g:syntastic_cpp_check_header = 1
"
" To disable the search of included header files after special
" libraries like gtk and glib add this line to your .vimrc:
"
" let g:syntastic_cpp_no_include_search = 1
"
" To disable the include of the default include dirs (such as /usr/include)
" add this line to your .vimrc:
"
" let g:syntastic_cpp_no_default_include_dirs = 1
"
" To enable header files being re-checked on every file write add the
" following line to your .vimrc. Otherwise the header files are checked only
" one time on initially loading the file.
" In order to force syntastic to refresh the header includes simply
" unlet b:syntastic_cpp_includes. Then the header files are being re-checked
" on the next file write.
"
" let g:syntastic_cpp_auto_refresh_includes = 1
"
" Alternatively you can set the buffer local variable b:syntastic_cpp_cflags.
" If this variable is set for the current buffer no search for additional
" libraries is done. I.e. set the variable like this:
"
" let b:syntastic_cpp_cflags = ' -I/usr/include/libsoup-2.4'
"
" In order to add some custom include directories that should be added to the
" gcc command line you can add those to the global variable
" g:syntastic_cpp_include_dirs. This list can be used like this:
"
" let g:syntastic_cpp_include_dirs = [ 'includes', 'headers' ]
"
" Moreover it is possible to add additional compiler options to the syntax
" checking execution via the variable 'g:syntastic_cpp_compiler_options':
"
" let g:syntastic_cpp_compiler_options = ' -std=c++0x'
"
" Additionally the setting 'g:syntastic_cpp_config_file' allows you to define
" a file that contains additional compiler arguments like include directories
" or CFLAGS. The file is expected to contain one option per line. If none is
" given the filename defaults to '.syntastic_cpp_config':
"
" let g:syntastic_cpp_config_file = '.config'
"
" Using the global variable 'g:syntastic_cpp_remove_include_errors' you can
" specify whether errors of files included via the
" g:syntastic_cpp_include_dirs' setting are removed from the result set:
"
" let g:syntastic_cpp_remove_include_errors = 1
"
" Use the variable 'g:syntastic_cpp_errorformat' to override the default error
" format:
"
" let g:syntastic_cpp_errorformat = '%f:%l:%c: %trror: %m'
"
" Set your compiler executable with e.g. (defaults to g++)
"
" let g:syntastic_cpp_compiler = 'clang++'
if exists('g:loaded_syntastic_cpp_gcc_checker') if exists('g:loaded_syntastic_cpp_gcc_checker')
finish finish
endif endif
@ -92,81 +30,19 @@ if !exists('g:syntastic_cpp_compiler_options')
let g:syntastic_cpp_compiler_options = '' let g:syntastic_cpp_compiler_options = ''
endif endif
if !exists('g:syntastic_cpp_config_file')
let g:syntastic_cpp_config_file = '.syntastic_cpp_config'
endif
function! SyntaxCheckers_cpp_gcc_GetLocList() function! SyntaxCheckers_cpp_gcc_GetLocList()
let makeprg = g:syntastic_cpp_compiler . ' -x c++ -fsyntax-only ' return syntastic#c#GetLocList('cpp', 'gcc', {
let errorformat = \ 'errorformat':
\ '%-G%f:%s:,' . \ '%-G%f:%s:,' .
\ '%f:%l:%c: %trror: %m,' . \ '%f:%l:%c: %trror: %m,' .
\ '%f:%l:%c: %tarning: %m,' . \ '%f:%l:%c: %tarning: %m,' .
\ '%f:%l:%c: %m,'. \ '%f:%l:%c: %m,'.
\ '%f:%l: %trror: %m,'. \ '%f:%l: %trror: %m,'.
\ '%f:%l: %tarning: %m,'. \ '%f:%l: %tarning: %m,'.
\ '%f:%l: %m' \ '%f:%l: %m',
\ 'main_flags': '-x c++ -fsyntax-only',
if exists('g:syntastic_cpp_errorformat') \ 'header_flags': '-x c++',
let errorformat = g:syntastic_cpp_errorformat \ 'header_names': '\.\(h\|hpp\|hh\)$' })
endif
" add optional user-defined compiler options
let makeprg .= g:syntastic_cpp_compiler_options
let makeprg .= ' ' . syntastic#util#shexpand('%') .
\ ' ' . syntastic#c#GetIncludeDirs('cpp')
" determine whether to parse header files as well
if expand('%') =~? '\.\(h\|hpp\|hh\)$'
if exists('g:syntastic_cpp_check_header')
let makeprg = g:syntastic_cpp_compiler .
\ ' -c ' . syntastic#util#shexpand('%') .
\ ' ' . g:syntastic_cpp_compiler_options .
\ ' ' . syntastic#c#GetNullDevice() .
\ ' ' . syntastic#c#GetIncludeDirs('cpp')
else
return []
endif
endif
" check if the user manually set some cflags
if !exists('b:syntastic_cpp_cflags')
" check whether to search for include files at all
if !exists('g:syntastic_cpp_no_include_search') ||
\ g:syntastic_cpp_no_include_search != 1
" refresh the include file search if desired
if exists('g:syntastic_cpp_auto_refresh_includes') &&
\ g:syntastic_cpp_auto_refresh_includes != 0
let makeprg .= syntastic#c#SearchHeaders()
else
" search for header includes if not cached already
if !exists('b:syntastic_cpp_includes')
let b:syntastic_cpp_includes = syntastic#c#SearchHeaders()
endif
let makeprg .= b:syntastic_cpp_includes
endif
endif
else
" use the user-defined cflags
let makeprg .= b:syntastic_cpp_cflags
endif
" add optional config file parameters
let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_cpp_config_file)
" process makeprg
let errors = SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat })
" filter the processed errors if desired
if exists('g:syntastic_cpp_remove_include_errors') &&
\ g:syntastic_cpp_remove_include_errors != 0
return filter(errors,
\ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr(''))
else
return errors
endif
endfunction endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({

View File

@ -36,7 +36,7 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList()
endif endif
let makeprg = let makeprg =
\ 'nvcc ' . arch_flag . ' --cuda -O0 -I . -Xcompiler -fsyntax-only ' . \ 'nvcc ' . arch_flag . ' --cuda -O0 -I . -Xcompiler -fsyntax-only ' .
\ syntastic#util#shexpand('%') . ' ' . syntastic#c#GetNullDevice() \ syntastic#util#shexpand('%') . ' ' . syntastic#c#NullOutput()
let errorformat = let errorformat =
\ '%*[^"]"%f"%*\D%l: %m,'. \ '%*[^"]"%f"%*\D%l: %m,'.
\ '"%f"%*\D%l: %m,'. \ '"%f"%*\D%l: %m,'.
@ -58,7 +58,7 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList()
let makeprg = let makeprg =
\ 'echo > .syntastic_dummy.cu ; ' . \ 'echo > .syntastic_dummy.cu ; ' .
\ 'nvcc ' . arch_flag . ' --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include ' . \ 'nvcc ' . arch_flag . ' --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include ' .
\ syntastic#util#shexpand('%') . ' ' . syntastic#c#GetNullDevice() \ syntastic#util#shexpand('%') . ' ' . syntastic#c#NullOutput()
else else
return [] return []
endif endif

View File

@ -15,68 +15,6 @@
" "
"============================================================================ "============================================================================
" In order to also check header files add this to your .vimrc:
"
" let g:syntastic_d_check_header = 1
"
" To disable the search of included header files after special
" libraries like gtk and glib add this line to your .vimrc:
"
" let g:syntastic_d_no_include_search = 1
"
" To disable the include of the default include dirs (such as /usr/include)
" add this line to your .vimrc:
"
" let g:syntastic_d_no_default_include_dirs = 1
"
" To enable header files being re-checked on every file write add the
" following line to your .vimrc. Otherwise the header files are checked only
" one time on initially loading the file.
" In order to force syntastic to refresh the header includes simply
" unlet b:syntastic_d_includes. Then the header files are being re-checked
" on the next file write.
"
" let g:syntastic_d_auto_refresh_includes = 1
"
" Alternatively you can set the buffer local variable b:syntastic_d_cflags.
" If this variable is set for the current buffer no search for additional
" libraries is done. I.e. set the variable like this:
"
" let b:syntastic_d_cflags = ' -I/usr/include/libsoup-2.4'
"
" In order to add some custom include directories that should be added to the
" dmd command line you can add those to the global variable
" g:syntastic_d_include_dirs. This list can be used like this:
"
" let g:syntastic_d_include_dirs = [ 'includes', 'headers' ]
"
" Moreover it is possible to add additional compiler options to the syntax
" checking execution via the variable 'g:syntastic_d_compiler_options':
"
" let g:syntastic_d_compiler_options = ' -std=c++0x'
"
" Additionally the setting 'g:syntastic_d_config_file' allows you to define
" a file that contains additional compiler arguments like include directories
" or CFLAGS. The file is expected to contain one option per line. If none is
" given the filename defaults to '.syntastic_d_config':
"
" let g:syntastic_d_config_file = '.config'
"
" Using the global variable 'g:syntastic_d_remove_include_errors' you can
" specify whether errors of files included via the
" g:syntastic_d_include_dirs' setting are removed from the result set:
"
" let g:syntastic_d_remove_include_errors = 1
"
" Use the variable 'g:syntastic_d_errorformat' to override the default error
" format:
"
" let g:syntastic_d_errorformat = '%f:%l:%c: %trror: %m'
"
" Set your compiler executable with e.g. (defaults to dmd)
"
" let g:syntastic_d_compiler = 'clang++'
if exists('g:loaded_syntastic_d_dmd_checker') if exists('g:loaded_syntastic_d_dmd_checker')
finish finish
endif endif
@ -97,74 +35,13 @@ if !exists('g:syntastic_d_compiler_options')
let g:syntastic_d_compiler_options = '' let g:syntastic_d_compiler_options = ''
endif endif
if !exists('g:syntastic_d_config_file')
let g:syntastic_d_config_file = '.syntastic_d_config'
endif
function! SyntaxCheckers_d_dmd_GetLocList() function! SyntaxCheckers_d_dmd_GetLocList()
let makeprg = g:syntastic_d_compiler . ' -c -of' . syntastic#util#DevNull() . ' ' return syntastic#c#GetLocList('d', 'dmd', {
let errorformat = '%-G%f:%s:,%f(%l): %m,%f:%l: %m' \ 'errorformat':
\ '%-G%f:%s:,%f(%l): %m,' .
if exists('g:syntastic_d_errorformat') \ '%f:%l: %m',
let errorformat = g:syntastic_d_errorformat \ 'main_flags': '-c -of' . syntastic#util#DevNull(),
endif \ 'header_names': '\.di$' })
" add optional user-defined compiler options
let makeprg .= g:syntastic_d_compiler_options
let makeprg .= ' ' . syntastic#util#shexpand('%') .
\ ' ' . syntastic#c#GetIncludeDirs('d')
" determine whether to parse header files as well
if expand('%') =~? '\.di$'
if exists('g:syntastic_d_check_header')
let makeprg = g:syntastic_d_compiler .
\ ' -c ' . syntastic#util#shexpand('%') .
\ ' -of' . syntastic#util#DevNull() .
\ ' ' . g:syntastic_d_compiler_options .
\ ' ' . syntastic#c#GetIncludeDirs('d')
else
return []
endif
endif
" check if the user manually set some cflags
if !exists('b:syntastic_d_cflags')
" check whether to search for include files at all
if !exists('g:syntastic_d_no_include_search') ||
\ g:syntastic_d_no_include_search != 1
" refresh the include file search if desired
if exists('g:syntastic_d_auto_refresh_includes') &&
\ g:syntastic_d_auto_refresh_includes != 0
let makeprg .= syntastic#c#SearchHeaders()
else
" search for header includes if not cached already
if !exists('b:syntastic_d_includes')
let b:syntastic_d_includes = syntastic#c#SearchHeaders()
endif
let makeprg .= b:syntastic_d_includes
endif
endif
else
" use the user-defined cflags
let makeprg .= b:syntastic_d_cflags
endif
" add optional config file parameters
let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_d_config_file)
" process makeprg
let errors = SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat })
" filter the processed errors if desired
if exists('g:syntastic_d_remove_include_errors') &&
\ g:syntastic_d_remove_include_errors != 0
return filter(errors,
\ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr(''))
else
return errors
endif
endfunction endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({

View File

@ -7,14 +7,6 @@
" it and/or modify it under the terms of the Do What The Fuck You " it and/or modify it under the terms of the Do What The Fuck You
" Want To Public License, Version 2, as published by Sam Hocevar. " Want To Public License, Version 2, as published by Sam Hocevar.
" See http://sam.zoy.org/wtfpl/COPYING for more details. " See http://sam.zoy.org/wtfpl/COPYING for more details.
"Note: This syntax checker uses gfortran with the option -fsyntax-only
" to check for errors and warnings. Additional flags may be
" supplied through both local and global variables,
" b:syntastic_fortran_flags,
" g:syntastic_fortran_flags.
" This is particularly useful when the source requires module files
" in order to compile (that is when it needs modules defined in
" separate files).
" "
"============================================================================ "============================================================================
@ -23,41 +15,38 @@ if exists("g:loaded_syntastic_fortran_gfortran_checker")
endif endif
let g:loaded_syntastic_fortran_gfortran_checker=1 let g:loaded_syntastic_fortran_gfortran_checker=1
if !exists('g:syntastic_fortran_flags') if !exists('g:syntastic_fortran_compiler')
let g:syntastic_fortran_flags = '' let g:syntastic_fortran_compiler = 'gfortran'
endif endif
function! SyntaxCheckers_fortran_gfortran_IsAvailable() function! SyntaxCheckers_fortran_gfortran_IsAvailable()
return executable('gfortran') return executable(g:syntastic_fortran_compiler)
endfunction endfunction
let s:save_cpo = &cpo
set cpo&vim
if !exists('g:syntastic_fortran_compiler_options')
let g:syntastic_fortran_compiler_options = ''
endif
function! SyntaxCheckers_fortran_gfortran_GetLocList() function! SyntaxCheckers_fortran_gfortran_GetLocList()
let makeprg = syntastic#makeprg#build({ return syntastic#c#GetLocList('fortran', 'gfortran', {
\ 'exe': 'gfortran', \ 'errorformat':
\ 'args': s:args(), \ '%-C %#,'.
\ 'filetype': 'fortran', \ '%-C %#%.%#,'.
\ 'subchecker': 'gfortran' }) \ '%A%f:%l.%c:,'.
\ '%Z%trror: %m,'.
let errorformat = \ '%Z%tarning: %m,'.
\ '%-C %#,'. \ '%-G%.%#',
\ '%-C %#%.%#,'. \ 'main_flags': '-fsyntax-only' })
\ '%A%f:%l.%c:,'.
\ '%Z%m,'.
\ '%G%.%#'
return SyntasticMake({
\ 'makeprg': makeprg,
\ 'errorformat': errorformat })
endfunction
function s:args()
let rv = '-fsyntax-only ' . g:syntastic_fortran_flags
if exists('b:syntastic_fortran_flags')
let rv .= " " . b:syntastic_fortran_flags
endif
return rv
endfunction endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'fortran', \ 'filetype': 'fortran',
\ 'name': 'gfortran'}) \ 'name': 'gfortran'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4:

View File

@ -47,9 +47,9 @@ function! SyntaxCheckers_go_go_GetLocList()
" Test files, i.e. files with a name ending in `_test.go`, are not " Test files, i.e. files with a name ending in `_test.go`, are not
" compiled by `go build`, therefore `go test` must be called for those. " compiled by `go build`, therefore `go test` must be called for those.
if match(expand('%'), '_test.go$') == -1 if match(expand('%'), '_test.go$') == -1
let makeprg = 'go build ' . syntastic#c#GetNullDevice() let makeprg = 'go build ' . syntastic#c#NullOutput()
else else
let makeprg = 'go test -c ' . syntastic#c#GetNullDevice() let makeprg = 'go test -c ' . syntastic#c#NullOutput()
endif endif
let errorformat = let errorformat =

View File

@ -21,7 +21,7 @@ endfunction
function! SyntaxCheckers_llvm_llvm_GetLocList() function! SyntaxCheckers_llvm_llvm_GetLocList()
let makeprg = syntastic#makeprg#build({ let makeprg = syntastic#makeprg#build({
\ 'exe': 'llc', \ 'exe': 'llc',
\ 'args': syntastic#c#GetNullDevice(), \ 'args': syntastic#c#NullOutput(),
\ 'filetype': 'llvm', \ 'filetype': 'llvm',
\ 'subchecker': 'llvm' }) \ 'subchecker': 'llvm' })

View File

@ -22,7 +22,7 @@ function! SyntaxCheckers_nasm_nasm_GetLocList()
let wd = syntastic#util#shescape(expand("%:p:h") . "/") let wd = syntastic#util#shescape(expand("%:p:h") . "/")
let makeprg = syntastic#makeprg#build({ let makeprg = syntastic#makeprg#build({
\ 'exe': 'nasm', \ 'exe': 'nasm',
\ 'args': '-X gnu -f elf -I ' . wd . ' ' . syntastic#c#GetNullDevice() \ 'args': '-X gnu -f elf -I ' . wd . ' ' . syntastic#c#NullOutput(),
\ 'filetype': 'nasm', \ 'filetype': 'nasm',
\ 'subchecker': 'nasm' }) \ 'subchecker': 'nasm' })

View File

@ -10,69 +10,6 @@
" "
"============================================================================ "============================================================================
" In order to also check header files add this to your .vimrc:
" (this usually creates a .gch file in your source directory)
"
" let g:syntastic_objc_check_header = 1
"
" To disable the search of included header files after special
" libraries like gtk and glib add this line to your .vimrc:
"
" let g:syntastic_objc_no_include_search = 1
"
" To disable the include of the default include dirs (such as /usr/include)
" add this line to your .vimrc:
"
" let g:syntastic_objc_no_default_include_dirs = 1
"
" To enable header files being re-checked on every file write add the
" following line to your .vimrc. Otherwise the header files are checked only
" one time on initially loading the file.
" In order to force syntastic to refresh the header includes simply
" unlet b:syntastic_objc_includes. Then the header files are being re-checked on
" the next file write.
"
" let g:syntastic_objc_auto_refresh_includes = 1
"
" Alternatively you can set the buffer local variable b:syntastic_objc_cflags.
" If this variable is set for the current buffer no search for additional
" libraries is done. I.e. set the variable like this:
"
" let b:syntastic_objc_cflags = ' -I/usr/include/libsoup-2.4'
"
" In order to add some custom include directories that should be added to the
" gcc command line you can add those to the global variable
" g:syntastic_objc_include_dirs. This list can be used like this:
"
" let g:syntastic_objc_include_dirs = [ 'includes', 'headers' ]
"
" Moreover it is possible to add additional compiler options to the syntax
" checking execution via the variable 'g:syntastic_objc_compiler_options':
"
" let g:syntastic_objc_compiler_options = ' -ansi'
"
" Additionally the setting 'g:syntastic_objc_config_file' allows you to define a
" file that contains additional compiler arguments like include directories or
" CFLAGS. The file is expected to contain one option per line. If none is
" given the filename defaults to '.syntastic_objc_config':
"
" let g:syntastic_objc_config_file = '.config'
"
" Using the global variable 'g:syntastic_objc_remove_include_errors' you can
" specify whether errors of files included via the g:syntastic_objc_include_dirs'
" setting are removed from the result set:
"
" let g:syntastic_objc_remove_include_errors = 1
"
" Use the variable 'g:syntastic_objc_errorformat' to override the default error
" format:
"
" let g:syntastic_objc_errorformat = '%f:%l:%c: %trror: %m'
"
" Set your compiler executable with e.g. (defaults to gcc)
"
" let g:syntastic_objc_compiler = 'clang'
if exists('g:loaded_syntastic_objc_gcc_checker') if exists('g:loaded_syntastic_objc_gcc_checker')
finish finish
endif endif
@ -93,85 +30,23 @@ if !exists('g:syntastic_objc_compiler_options')
let g:syntastic_objc_compiler_options = '-std=gnu99' let g:syntastic_objc_compiler_options = '-std=gnu99'
endif endif
if !exists('g:syntastic_objc_config_file')
let g:syntastic_objc_config_file = '.syntastic_objc_config'
endif
function! SyntaxCheckers_objc_gcc_GetLocList() function! SyntaxCheckers_objc_gcc_GetLocList()
let makeprg = g:syntastic_objc_compiler . ' -x objective-c -fsyntax-only -lobjc' return syntastic#c#GetLocList('objc', 'gcc', {
let errorformat = \ 'errorformat':
\ '%-G%f:%s:,' . \ '%-G%f:%s:,' .
\ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' . \ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' .
\ '%-G%f:%l: %#error: %#for each function it appears%.%#,' . \ '%-G%f:%l: %#error: %#for each function it appears%.%#,' .
\ '%-GIn file included%.%#,'. \ '%-GIn file included%.%#,'.
\ '%-G %#from %f:%l\,,' . \ '%-G %#from %f:%l\,,' .
\ '%f:%l:%c: %trror: %m,' . \ '%f:%l:%c: %trror: %m,' .
\ '%f:%l:%c: %tarning: %m,' . \ '%f:%l:%c: %tarning: %m,' .
\ '%f:%l:%c: %m,' . \ '%f:%l:%c: %m,' .
\ '%f:%l: %trror: %m,' . \ '%f:%l: %trror: %m,' .
\ '%f:%l: %tarning: %m,' . \ '%f:%l: %tarning: %m,' .
\ '%f:%l: %m' \ '%f:%l: %m',
\ 'main_flags': '-x objective-c -fsyntax-only',
if exists('g:syntastic_objc_errorformat') \ 'header_flags': '-x objective-c-header -lobjc',
let errorformat = g:syntastic_objc_errorformat \ 'header_names': '\.h$' })
endif
" add optional user-defined compiler options
let makeprg .= g:syntastic_objc_compiler_options
let makeprg .= ' ' . syntastic#util#shexpand('%') .
\ ' ' . syntastic#c#GetIncludeDirs('objc')
" determine whether to parse header files as well
if expand('%') =~? '\.h$'
if exists('g:syntastic_objc_check_header')
let makeprg = g:syntastic_objc_compiler .
\ ' -x objective-c-header ' .
\ ' -c ' . syntastic#util#shexpand('%') .
\ ' ' . g:syntastic_objc_compiler_options .
\ ' ' . syntastic#c#GetIncludeDirs('objc')
else
return []
endif
endif
" check if the user manually set some cflags
if !exists('b:syntastic_objc_cflags')
" check whether to search for include files at all
if !exists('g:syntastic_objc_no_include_search') ||
\ g:syntastic_objc_no_include_search != 1
" refresh the include file search if desired
if exists('g:syntastic_objc_auto_refresh_includes') &&
\ g:syntastic_objc_auto_refresh_includes != 0
let makeprg .= syntastic#c#SearchHeaders()
else
" search for header includes if not cached already
if !exists('b:syntastic_objc_includes')
let b:syntastic_objc_includes = syntastic#c#SearchHeaders()
endif
let makeprg .= b:syntastic_objc_includes
endif
endif
else
" use the user-defined cflags
let makeprg .= b:syntastic_objc_cflags
endif
" add optional config file parameters
let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_objc_config_file)
" process makeprg
let errors = SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat })
" filter the processed errors if desired
if exists('g:syntastic_objc_remove_include_errors') &&
\ g:syntastic_objc_remove_include_errors != 0
return filter(errors,
\ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr(''))
else
return errors
endif
endfunction endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({

View File

@ -10,69 +10,6 @@
" "
"============================================================================ "============================================================================
" In order to also check header files add this to your .vimrc:
" (this usually creates a .gch file in your source directory)
"
" let g:syntastic_objcpp_check_header = 1
"
" To disable the search of included header files after special
" libraries like gtk and glib add this line to your .vimrc:
"
" let g:syntastic_objcpp_no_include_search = 1
"
" To disable the include of the default include dirs (such as /usr/include)
" add this line to your .vimrc:
"
" let g:syntastic_objcpp_no_default_include_dirs = 1
"
" To enable header files being re-checked on every file write add the
" following line to your .vimrc. Otherwise the header files are checked only
" one time on initially loading the file.
" In order to force syntastic to refresh the header includes simply
" unlet b:syntastic_objcpp_includes. Then the header files are being re-checked on
" the next file write.
"
" let g:syntastic_objcpp_auto_refresh_includes = 1
"
" Alternatively you can set the buffer local variable b:syntastic_objcpp_cflags.
" If this variable is set for the current buffer no search for additional
" libraries is done. I.e. set the variable like this:
"
" let b:syntastic_objcpp_cflags = ' -I/usr/include/libsoup-2.4'
"
" In order to add some custom include directories that should be added to the
" gcc command line you can add those to the global variable
" g:syntastic_objcpp_include_dirs. This list can be used like this:
"
" let g:syntastic_objcpp_include_dirs = [ 'includes', 'headers' ]
"
" Moreover it is possible to add additional compiler options to the syntax
" checking execution via the variable 'g:syntastic_objcpp_compiler_options':
"
" let g:syntastic_objcpp_compiler_options = ' -ansi'
"
" Additionally the setting 'g:syntastic_objcpp_config_file' allows you to define a
" file that contains additional compiler arguments like include directories or
" CFLAGS. The file is expected to contain one option per line. If none is
" given the filename defaults to '.syntastic_objcpp_config':
"
" let g:syntastic_objcpp_config_file = '.config'
"
" Using the global variable 'g:syntastic_objcpp_remove_include_errors' you can
" specify whether errors of files included via the g:syntastic_objcpp_include_dirs'
" setting are removed from the result set:
"
" let g:syntastic_objcpp_remove_include_errors = 1
"
" Use the variable 'g:syntastic_objcpp_errorformat' to override the default error
" format:
"
" let g:syntastic_objcpp_errorformat = '%f:%l:%c: %trror: %m'
"
" Set your compiler executable with e.g. (defaults to gcc)
"
" let g:syntastic_objcpp_compiler = 'clang'
if exists('g:loaded_syntastic_objcpp_gcc_checker') if exists('g:loaded_syntastic_objcpp_gcc_checker')
finish finish
endif endif
@ -93,85 +30,23 @@ if !exists('g:syntastic_objcpp_compiler_options')
let g:syntastic_objcpp_compiler_options = '-std=gnu99' let g:syntastic_objcpp_compiler_options = '-std=gnu99'
endif endif
if !exists('g:syntastic_objcpp_config_file')
let g:syntastic_objcpp_config_file = '.syntastic_objcpp_config'
endif
function! SyntaxCheckers_objcpp_gcc_GetLocList() function! SyntaxCheckers_objcpp_gcc_GetLocList()
let makeprg = g:syntastic_objcpp_compiler . ' -x objective-c++ -fsyntax-only -lobjc' return syntastic#c#GetLocList('objcpp', 'gcc', {
let errorformat = \ 'errorformat':
\ '%-G%f:%s:,' . \ '%-G%f:%s:,' .
\ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' . \ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' .
\ '%-G%f:%l: %#error: %#for each function it appears%.%#,' . \ '%-G%f:%l: %#error: %#for each function it appears%.%#,' .
\ '%-GIn file included%.%#,'. \ '%-GIn file included%.%#,'.
\ '%-G %#from %f:%l\,,' . \ '%-G %#from %f:%l\,,' .
\ '%f:%l:%c: %trror: %m,' . \ '%f:%l:%c: %trror: %m,' .
\ '%f:%l:%c: %tarning: %m,' . \ '%f:%l:%c: %tarning: %m,' .
\ '%f:%l:%c: %m,' . \ '%f:%l:%c: %m,' .
\ '%f:%l: %trror: %m,' . \ '%f:%l: %trror: %m,' .
\ '%f:%l: %tarning: %m,' . \ '%f:%l: %tarning: %m,' .
\ '%f:%l: %m' \ '%f:%l: %m',
\ 'main_flags': '-x objective-c++ -fsyntax-only',
if exists('g:syntastic_objcpp_errorformat') \ 'header_flags': '-x objective-c++-header -lobjc',
let errorformat = g:syntastic_objcpp_errorformat \ 'header_names': '\.h$' })
endif
" add optional user-defined compiler options
let makeprg .= g:syntastic_objcpp_compiler_options
let makeprg .= ' ' . syntastic#util#shexpand('%') .
\ ' ' . syntastic#c#GetIncludeDirs('objcpp')
" determine whether to parse header files as well
if expand('%') =~? '\.h$'
if exists('g:syntastic_objcpp_check_header')
let makeprg = g:syntastic_objcpp_compiler .
\ ' -x objective-c++-header ' .
\ ' -c ' . syntastic#util#shexpand('%') .
\ ' ' . g:syntastic_objcpp_compiler_options .
\ ' ' . syntastic#c#GetIncludeDirs('objcpp')
else
return []
endif
endif
" check if the user manually set some cflags
if !exists('b:syntastic_objcpp_cflags')
" check whether to search for include files at all
if !exists('g:syntastic_objcpp_no_include_search') ||
\ g:syntastic_objcpp_no_include_search != 1
" refresh the include file search if desired
if exists('g:syntastic_objcpp_auto_refresh_includes') &&
\ g:syntastic_objcpp_auto_refresh_includes != 0
let makeprg .= syntastic#c#SearchHeaders()
else
" search for header includes if not cached already
if !exists('b:syntastic_objcpp_includes')
let b:syntastic_objcpp_includes = syntastic#c#SearchHeaders()
endif
let makeprg .= b:syntastic_objcpp_includes
endif
endif
else
" use the user-defined cflags
let makeprg .= b:syntastic_objcpp_cflags
endif
" add optional config file parameters
let makeprg .= ' ' . syntastic#c#ReadConfig(g:syntastic_objcpp_config_file)
" process makeprg
let errors = SyntasticMake({ 'makeprg': makeprg,
\ 'errorformat': errorformat })
" filter the processed errors if desired
if exists('g:syntastic_objcpp_remove_include_errors') &&
\ g:syntastic_objcpp_remove_include_errors != 0
return filter(errors,
\ 'has_key(v:val, "bufnr") && v:val["bufnr"]=='.bufnr(''))
else
return errors
endif
endfunction endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({ call g:SyntasticRegistry.CreateAndRegisterChecker({

View File

@ -136,9 +136,9 @@ function s:GetOtherMakeprg()
" ocamlyacc output can't be redirected, so use menhir " ocamlyacc output can't be redirected, so use menhir
let makeprg = "menhir --only-preprocess " . syntastic#util#shexpand('%') . " >" . syntastic#util#DevNull() let makeprg = "menhir --only-preprocess " . syntastic#util#shexpand('%') . " >" . syntastic#util#DevNull()
elseif match(extension,'mll') >= 0 && executable("ocamllex") elseif match(extension,'mll') >= 0 && executable("ocamllex")
let makeprg = "ocamllex -q " . syntastic#c#GetNullDevice() . " " . syntastic#util#shexpand('%') let makeprg = "ocamllex -q " . syntastic#c#NullOutput() . " " . syntastic#util#shexpand('%')
else else
let makeprg = "camlp4o " . syntastic#c#GetNullDevice() . " " . syntastic#util#shexpand('%') let makeprg = "camlp4o " . syntastic#c#NullOutput() . " " . syntastic#util#shexpand('%')
endif endif
return makeprg return makeprg

View File

@ -0,0 +1,42 @@
"============================================================================
"File: verilator.vim
"Description: Syntax checking plugin for syntastic.vim
"Maintainer: Kocha <kocha dot lsifrontend at gmail dot com>
"============================================================================
if exists("g:loaded_syntastic_verilog_verilator_checker")
finish
endif
let g:loaded_syntastic_verilog_verilator_checker = 1
if !exists('g:syntastic_verilog_compiler')
let g:syntastic_verilog_compiler = 'verilator'
endif
let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_verilog_verilator_IsAvailable()
return executable(g:syntastic_verilog_compiler)
endfunction
if !exists('g:syntastic_verilog_compiler_options')
let g:syntastic_verilog_compiler_options = '-Wall'
endif
function! SyntaxCheckers_verilog_verilator_GetLocList()
return syntastic#c#GetLocList('verilog', 'verilator', {
\ 'errorformat':
\ '%%%trror-%\=%\w%#: %f:%l: %m,' .
\ '%%%tarning-%\=%\w%#: %f:%l: %m',
\ 'main_flags': '--lint-only' })
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({
\ 'filetype': 'verilog',
\ 'name': 'verilator'})
let &cpo = s:save_cpo
unlet s:save_cpo
" vim: set et sts=4 sw=4: