2011-06-10 05:16:42 -04:00
|
|
|
"============================================================================
|
|
|
|
"File: cuda.vim
|
|
|
|
"Description: Syntax checking plugin for syntastic.vim
|
|
|
|
"
|
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
|
|
|
"============================================================================
|
|
|
|
|
2013-02-21 10:50:41 -05:00
|
|
|
if exists("g:loaded_syntastic_cuda_nvcc_checker")
|
|
|
|
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
|
2012-06-22 10:07:50 -04:00
|
|
|
if exists('g:syntastic_cuda_arch')
|
2013-06-07 14:18:29 -04:00
|
|
|
let arch_flag = '-arch=' . g:syntastic_cuda_arch
|
2012-06-22 10:07:50 -04:00
|
|
|
else
|
|
|
|
let arch_flag = ''
|
|
|
|
endif
|
2013-06-07 14:18:29 -04:00
|
|
|
let makeprg =
|
2014-02-07 04:19:30 -05:00
|
|
|
\ self.getExecEscaped() . ' ' . arch_flag .
|
2014-02-06 09:50:27 -05:00
|
|
|
\ ' --cuda -O0 -I . -Xcompiler -fsyntax-only ' .
|
2013-07-04 14:30:52 -04:00
|
|
|
\ syntastic#util#shexpand('%') . ' ' . syntastic#c#NullOutput()
|
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
|
|
|
|
2013-10-25 08:56:09 -04:00
|
|
|
if expand('%') =~? '\m\%(.h\|.hpp\|.cuh\)$'
|
2011-06-10 05:16:42 -04:00
|
|
|
if exists('g:syntastic_cuda_check_header')
|
2013-06-07 14:18:29 -04:00
|
|
|
let makeprg =
|
|
|
|
\ 'echo > .syntastic_dummy.cu ; ' .
|
2014-02-07 04:19:30 -05:00
|
|
|
\ self.getExecEscaped() . ' ' . arch_flag .
|
2013-10-28 11:30:25 -04:00
|
|
|
\ ' --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include ' .
|
2013-07-04 14:30:52 -04:00
|
|
|
\ syntastic#util#shexpand('%') . ' ' . syntastic#c#NullOutput()
|
2011-06-10 05:16:42 -04:00
|
|
|
else
|
|
|
|
return []
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
|
|
|
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
|
|
|
|
|
|
|
|
" vim: set et sts=4 sw=4:
|