nvcc.vim 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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. if exists('g:loaded_syntastic_cuda_nvcc_checker')
  9. finish
  10. endif
  11. let g:loaded_syntastic_cuda_nvcc_checker = 1
  12. let s:save_cpo = &cpo
  13. set cpo&vim
  14. function! SyntaxCheckers_cuda_nvcc_GetLocList() dict
  15. if exists('g:syntastic_cuda_arch')
  16. let arch_flag = '-arch=' . g:syntastic_cuda_arch
  17. else
  18. let arch_flag = ''
  19. endif
  20. let makeprg =
  21. \ self.getExecEscaped() . ' ' . arch_flag .
  22. \ ' --cuda -O0 -I . -Xcompiler -fsyntax-only ' .
  23. \ syntastic#util#shexpand('%') . ' ' . syntastic#c#NullOutput()
  24. let errorformat =
  25. \ '%*[^"]"%f"%*\D%l: %m,'.
  26. \ '"%f"%*\D%l: %m,'.
  27. \ '%-G%f:%l: (Each undeclared identifier is reported only once,'.
  28. \ '%-G%f:%l: for each function it appears in.),'.
  29. \ '%f:%l:%c:%m,'.
  30. \ '%f(%l):%m,'.
  31. \ '%f:%l:%m,'.
  32. \ '"%f"\, line %l%*\D%c%*[^ ] %m,'.
  33. \ '%D%*\a[%*\d]: Entering directory `%f'','.
  34. \ '%X%*\a[%*\d]: Leaving directory `%f'','.
  35. \ '%D%*\a: Entering directory `%f'','.
  36. \ '%X%*\a: Leaving directory `%f'','.
  37. \ '%DMaking %*\a in %f,'.
  38. \ '%f|%l| %m'
  39. if expand('%', 1) =~? '\m\%(.h\|.hpp\|.cuh\)$'
  40. if exists('g:syntastic_cuda_check_header')
  41. let makeprg =
  42. \ 'echo > .syntastic_dummy.cu ; ' .
  43. \ self.getExecEscaped() . ' ' . arch_flag .
  44. \ ' --cuda -O0 -I . .syntastic_dummy.cu -Xcompiler -fsyntax-only -include ' .
  45. \ syntastic#util#shexpand('%') . ' ' . syntastic#c#NullOutput()
  46. else
  47. return []
  48. endif
  49. endif
  50. return SyntasticMake({ 'makeprg': makeprg, 'errorformat': errorformat })
  51. endfunction
  52. call g:SyntasticRegistry.CreateAndRegisterChecker({
  53. \ 'filetype': 'cuda',
  54. \ 'name': 'nvcc'})
  55. let &cpo = s:save_cpo
  56. unlet s:save_cpo
  57. " vim: set sw=4 sts=4 et fdm=marker: