]> git.r.bdr.sh - rbdr/dotfiles/blob - vim/syntax_checkers/cuda.vim
Update the stuff
[rbdr/dotfiles] / vim / syntax_checkers / cuda.vim
1 "============================================================================
2 "File: cuda.vim
3 "Description: Syntax checking plugin for syntastic.vim
4 "
5 "Author: Hannes Schulz <schulz at ais dot uni-bonn dot de>
6 "
7 "============================================================================
8
9 " in order to also check header files add this to your .vimrc:
10 " (this creates an empty .syntastic_dummy.cu file in your source directory)
11 "
12 " let g:syntastic_cuda_check_header = 1
13
14 if exists('loaded_cuda_syntax_checker')
15 finish
16 endif
17 let loaded_cuda_syntax_checker = 1
18
19 if !executable('nvcc')
20 finish
21 endif
22
23 function! SyntaxCheckers_cuda_GetLocList()
24 let makeprg = 'nvcc --cuda -O0 -I . -Xcompiler -fsyntax-only '.shellescape(expand('%')).' -o /dev/null'
25 "let errorformat = '%-G%f:%s:,%f:%l:%c: %m,%f:%l: %m'
26 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'
27
28 if expand('%') =~? '\%(.h\|.hpp\|.cuh\)$'
29 if exists('g:syntastic_cuda_check_header')
30 let makeprg = 'echo > .syntastic_dummy.cu ; nvcc --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include '.shellescape(expand('%')).' -o /dev/null'
31 else
32 return []
33 endif
34 endif
35
36 return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
37 endfunction