2011-06-10 05:16:42 -04:00
|
|
|
"============================================================================
|
|
|
|
"File: cuda.vim
|
2016-04-26 13:09:00 -04:00
|
|
|
"Description: Syntax checking plugin for syntastic
|
2011-06-20 02:04:04 -04:00
|
|
|
"Author: Hannes Schulz <schulz at ais dot uni-bonn dot de>
|
|
|
|
"
|
2011-06-10 05:16:42 -04:00
|
|
|
"============================================================================
|
|
|
|
|
2015-03-25 12:44:34 -04:00
|
|
|
if exists('g:loaded_syntastic_cuda_nvcc_checker')
|
2013-02-21 10:50:41 -05:00
|
|
|
finish
|
|
|
|
endif
|
2014-01-03 04:29:08 -05:00
|
|
|
let g:loaded_syntastic_cuda_nvcc_checker = 1
|
|
|
|
|
|
|
|
let s:save_cpo = &cpo
|
|
|
|
set cpo&vim
|
2013-02-21 10:50:41 -05:00
|
|
|
|
2013-10-28 07:53:33 -04:00
|
|
|
function! SyntaxCheckers_cuda_nvcc_GetLocList() dict
|
2017-02-15 01:48:45 -05:00
|
|
|
let buf = bufnr('')
|
|
|
|
let arch_flag = syntastic#util#bufVar(buf, 'cuda_arch')
|
2016-06-05 15:58:04 -04:00
|
|
|
if arch_flag !=# ''
|
2016-06-06 00:24:31 -04:00
|
|
|
let arch_flag = '-arch=' . arch_flag
|
|
|
|
call syntastic#log#oneTimeWarn('variable g:syntastic_cuda_arch is deprecated, ' .
|
|
|
|
\ 'please add ' . string(arch_flag) . ' to g:syntastic_cuda_nvcc_args instead')
|
2016-06-05 15:58:04 -04:00
|
|
|
endif
|
|
|
|
|
|
|
|
let build_opts = {}
|
2016-06-06 00:24:31 -04:00
|
|
|
let dummy = ''
|
2017-02-15 01:48:45 -05:00
|
|
|
if index(['h', 'hpp', 'cuh'], fnamemodify(bufname(buf), ':e'), 0, 1) >= 0
|
|
|
|
if syntastic#util#bufVar(buf, 'cuda_check_header', 0)
|
|
|
|
let dummy = fnamemodify(bufname(buf), ':p:h') . syntastic#util#Slash() . '.syntastic_dummy.cu'
|
2016-06-05 15:58:04 -04:00
|
|
|
let build_opts = {
|
2016-06-06 00:24:31 -04:00
|
|
|
\ 'exe_before': 'echo > ' . syntastic#util#shescape(dummy) . ' ;',
|
2016-06-05 15:58:04 -04:00
|
|
|
\ 'fname_before': '.syntastic_dummy.cu -include' }
|
|
|
|
else
|
|
|
|
return []
|
|
|
|
endif
|
2012-06-22 10:07:50 -04:00
|
|
|
endif
|
2016-06-05 15:58:04 -04:00
|
|
|
|
|
|
|
call extend(build_opts, {
|
2016-06-06 00:24:31 -04:00
|
|
|
\ 'args_before': arch_flag . ' --cuda -O0 -I .',
|
2018-05-03 00:42:41 -04:00
|
|
|
\ 'args': syntastic#c#ReadConfig(syntastic#util#bufVar(buf, 'cuda_config_file')),
|
2016-06-05 15:58:04 -04:00
|
|
|
\ 'args_after': '-Xcompiler -fsyntax-only',
|
|
|
|
\ 'tail_after': syntastic#c#NullOutput() })
|
|
|
|
|
|
|
|
let makeprg = self.makeprgBuild(build_opts)
|
2013-10-28 11:30:25 -04:00
|
|
|
|
2013-05-14 12:36:20 -04:00
|
|
|
let errorformat =
|
|
|
|
\ '%*[^"]"%f"%*\D%l: %m,'.
|
|
|
|
\ '"%f"%*\D%l: %m,'.
|
|
|
|
\ '%-G%f:%l: (Each undeclared identifier is reported only once,'.
|
|
|
|
\ '%-G%f:%l: for each function it appears in.),'.
|
|
|
|
\ '%f:%l:%c:%m,'.
|
|
|
|
\ '%f(%l):%m,'.
|
|
|
|
\ '%f:%l:%m,'.
|
|
|
|
\ '"%f"\, line %l%*\D%c%*[^ ] %m,'.
|
|
|
|
\ '%D%*\a[%*\d]: Entering directory `%f'','.
|
|
|
|
\ '%X%*\a[%*\d]: Leaving directory `%f'','.
|
|
|
|
\ '%D%*\a: Entering directory `%f'','.
|
|
|
|
\ '%X%*\a: Leaving directory `%f'','.
|
|
|
|
\ '%DMaking %*\a in %f,'.
|
|
|
|
\ '%f|%l| %m'
|
2011-06-10 05:16:42 -04:00
|
|
|
|
2017-02-15 06:51:32 -05:00
|
|
|
let loclist = SyntasticMake({
|
|
|
|
\ 'makeprg': makeprg,
|
|
|
|
\ 'errorformat': errorformat,
|
|
|
|
\ 'defaults': {'type': 'E'} })
|
|
|
|
|
|
|
|
for e in loclist
|
2017-02-16 01:19:32 -05:00
|
|
|
let pat = matchstr(e['text'], '\m\c^\s*warning:\s*\zs.*')
|
|
|
|
if pat !=# ''
|
|
|
|
let e['text'] = pat
|
2017-02-15 06:51:32 -05:00
|
|
|
let e['type'] = 'W'
|
|
|
|
endif
|
|
|
|
endfor
|
2016-06-06 00:24:31 -04:00
|
|
|
|
|
|
|
if dummy !=# ''
|
|
|
|
call delete(dummy)
|
|
|
|
endif
|
|
|
|
|
|
|
|
return loclist
|
2011-06-10 05:16:42 -04:00
|
|
|
endfunction
|
2013-01-27 15:08:30 -05:00
|
|
|
|
|
|
|
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
|
|
|
\ 'filetype': 'cuda',
|
|
|
|
\ 'name': 'nvcc'})
|
2014-01-03 04:29:08 -05:00
|
|
|
|
|
|
|
let &cpo = s:save_cpo
|
|
|
|
unlet s:save_cpo
|
|
|
|
|
2015-01-04 05:46:54 -05:00
|
|
|
" vim: set sw=4 sts=4 et fdm=marker:
|