2011-06-10 11:16:42 +02:00
|
|
|
"============================================================================
|
|
|
|
"File: cuda.vim
|
|
|
|
"Description: Syntax checking plugin for syntastic.vim
|
|
|
|
"
|
2011-06-20 08:04:04 +02:00
|
|
|
"Author: Hannes Schulz <schulz at ais dot uni-bonn dot de>
|
|
|
|
"
|
2011-06-10 11:16:42 +02:00
|
|
|
"============================================================================
|
|
|
|
|
2013-02-21 15:50:41 +00:00
|
|
|
if exists("g:loaded_syntastic_cuda_nvcc_checker")
|
|
|
|
finish
|
|
|
|
endif
|
2014-01-03 11:29:08 +02:00
|
|
|
let g:loaded_syntastic_cuda_nvcc_checker = 1
|
|
|
|
|
|
|
|
let s:save_cpo = &cpo
|
|
|
|
set cpo&vim
|
2013-02-21 15:50:41 +00:00
|
|
|
|
2013-10-28 13:53:33 +02:00
|
|
|
function! SyntaxCheckers_cuda_nvcc_GetLocList() dict
|
2012-06-22 16:07:50 +02:00
|
|
|
if exists('g:syntastic_cuda_arch')
|
2013-06-07 21:18:29 +03:00
|
|
|
let arch_flag = '-arch=' . g:syntastic_cuda_arch
|
2012-06-22 16:07:50 +02:00
|
|
|
else
|
|
|
|
let arch_flag = ''
|
|
|
|
endif
|
2013-06-07 21:18:29 +03:00
|
|
|
let makeprg =
|
2014-02-07 11:19:30 +02:00
|
|
|
\ self.getExecEscaped() . ' ' . arch_flag .
|
2014-02-06 16:50:27 +02:00
|
|
|
\ ' --cuda -O0 -I . -Xcompiler -fsyntax-only ' .
|
2013-07-04 21:30:52 +03:00
|
|
|
\ syntastic#util#shexpand('%') . ' ' . syntastic#c#NullOutput()
|
2013-10-28 17:30:25 +02:00
|
|
|
|
2013-05-14 17:36:20 +01: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 11:16:42 +02:00
|
|
|
|
2015-01-04 09:01:55 +02:00
|
|
|
if expand('%', 1) =~? '\m\%(.h\|.hpp\|.cuh\)$'
|
2011-06-10 11:16:42 +02:00
|
|
|
if exists('g:syntastic_cuda_check_header')
|
2013-06-07 21:18:29 +03:00
|
|
|
let makeprg =
|
|
|
|
\ 'echo > .syntastic_dummy.cu ; ' .
|
2014-02-07 11:19:30 +02:00
|
|
|
\ self.getExecEscaped() . ' ' . arch_flag .
|
2013-10-28 17:30:25 +02:00
|
|
|
\ ' --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include ' .
|
2013-07-04 21:30:52 +03:00
|
|
|
\ syntastic#util#shexpand('%') . ' ' . syntastic#c#NullOutput()
|
2011-06-10 11:16:42 +02:00
|
|
|
else
|
|
|
|
return []
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
|
|
|
|
endfunction
|
2013-01-27 20:08:30 +00:00
|
|
|
|
|
|
|
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
|
|
|
\ 'filetype': 'cuda',
|
|
|
|
\ 'name': 'nvcc'})
|
2014-01-03 11:29:08 +02:00
|
|
|
|
|
|
|
let &cpo = s:save_cpo
|
|
|
|
unlet s:save_cpo
|
|
|
|
|
2015-01-04 12:46:54 +02:00
|
|
|
" vim: set sw=4 sts=4 et fdm=marker:
|