Checker nvcc: cleanup.

- Mark variable g:syntastic_cuda_arch as deprecated.
- Create temporary files in the base directory of the file being
  checked, rather than the current directory.
- Remove temporary files after use.
This commit is contained in:
LCD 47 2016-06-06 07:24:31 +03:00
parent f9eca22c04
commit b8bdaa20be
2 changed files with 15 additions and 5 deletions

View File

@ -19,7 +19,7 @@ if has('reltime')
lockvar! g:_SYNTASTIC_START
endif
let g:_SYNTASTIC_VERSION = '3.7.0-143'
let g:_SYNTASTIC_VERSION = '3.7.0-144'
lockvar g:_SYNTASTIC_VERSION
" Sanity checks {{{1

View File

@ -20,14 +20,18 @@ set cpo&vim
function! SyntaxCheckers_cuda_nvcc_GetLocList() dict
let arch_flag = syntastic#util#var('cuda_arch')
if arch_flag !=# ''
let arch_flag = ' -arch=' . arch_flag
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')
endif
let build_opts = {}
let dummy = ''
if index(['h', 'hpp', 'cuh'], expand('%:e', 1), 0, 1) >= 0
if syntastic#util#var('cuda_check_header', 0)
let dummy = expand('%:p:h', 1) . syntastic#util#Slash() . '.syntastic_dummy.cu'
let build_opts = {
\ 'exe_before': 'echo > .syntastic_dummy.cu ;',
\ 'exe_before': 'echo > ' . syntastic#util#shescape(dummy) . ' ;',
\ 'fname_before': '.syntastic_dummy.cu -include' }
else
return []
@ -35,7 +39,7 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList() dict
endif
call extend(build_opts, {
\ 'args_before': '--cuda -O0 -I .' . arch_flag,
\ 'args_before': arch_flag . ' --cuda -O0 -I .',
\ 'args': syntastic#c#ReadConfig(g:syntastic_cuda_config_file),
\ 'args_after': '-Xcompiler -fsyntax-only',
\ 'tail_after': syntastic#c#NullOutput() })
@ -58,7 +62,13 @@ function! SyntaxCheckers_cuda_nvcc_GetLocList() dict
\ '%DMaking %*\a in %f,'.
\ '%f|%l| %m'
return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
let loclist = SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
if dummy !=# ''
call delete(dummy)
endif
return loclist
endfunction
call g:SyntasticRegistry.CreateAndRegisterChecker({