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
"============================================================================
" in order to also check header files add this to your .vimrc:
" (this creates an empty .syntastic_dummy.cu file in your source directory)
"
" let g:syntastic_cuda_check_header = 1
if exists ( 'loaded_cuda_syntax_checker' )
finish
endif
let loaded_cuda_syntax_checker = 1
2012-01-13 10:41:34 -05:00
if ! executable ( 'nvcc' )
2011-06-10 05:16:42 -04:00
finish
endif
function ! SyntaxCheckers_cuda_GetLocList ( )
2012-01-13 10:41:34 -05:00
let makeprg = 'nvcc --cuda -O0 -I . -Xcompiler -fsyntax-only ' .shellescape ( expand ( '%' ) ) .' -o /dev/null'
2011-06-10 05:16:42 -04:00
"let errorformat = '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m'
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'
if expand ( '%' ) = ~ ? '\%(.h\|.hpp\|.cuh\)$'
if exists ( 'g:syntastic_cuda_check_header' )
2012-01-13 10:41:34 -05:00
let makeprg = 'echo > .syntastic_dummy.cu ; nvcc --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include ' .shellescape ( expand ( '%' ) ) .' -o /dev/null'
2011-06-10 05:16:42 -04:00
else
return []
endif
endif
return SyntasticMake ( { 'makeprg' : makeprg , 'errorformat' : errorformat })
endfunction