gcc.vim 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. "============================================================================
  2. "File: gcc.vim
  3. "Description: Syntax checking for at&t and intel assembly files with gcc
  4. "Maintainer: Josh Rahm <joshuarahm@gmail.com>
  5. "License: This program is free software. It comes without any warranty,
  6. " to the extent permitted by applicable law. You can redistribute
  7. " it and/or modify it under the terms of the Do What The Fuck You
  8. " Want To Public License, Version 2, as published by Sam Hocevar.
  9. " See http://sam.zoy.org/wtfpl/COPYING for more details.
  10. "
  11. "============================================================================
  12. if exists('g:loaded_syntastic_asm_gcc_checker')
  13. finish
  14. endif
  15. let g:loaded_syntastic_asm_gcc_checker = 1
  16. if !exists('g:syntastic_asm_compiler_options')
  17. let g:syntastic_asm_compiler_options = ''
  18. endif
  19. if !exists('g:syntastic_asm_generic')
  20. let g:syntastic_asm_generic = 0
  21. endif
  22. let s:save_cpo = &cpo
  23. set cpo&vim
  24. function! SyntaxCheckers_asm_gcc_IsAvailable() dict " {{{1
  25. if !exists('g:syntastic_asm_compiler')
  26. let g:syntastic_asm_compiler = self.getExec()
  27. endif
  28. return executable(expand(g:syntastic_asm_compiler, 1))
  29. endfunction " }}}1
  30. function! SyntaxCheckers_asm_gcc_GetLocList() dict " {{{1
  31. return syntastic#c#GetLocList('asm', 'gcc', {
  32. \ 'errorformat':
  33. \ '%-G%f:%s:,' .
  34. \ '%f:%l:%c: %trror: %m,' .
  35. \ '%f:%l:%c: %tarning: %m,' .
  36. \ '%f:%l: %m',
  37. \ 'main_flags': '-x assembler -fsyntax-only' . (g:syntastic_asm_generic ? '' : ' -masm=' . s:GetDialect()) })
  38. endfunction " }}}1
  39. " Utilities {{{1
  40. function! s:GetDialect() " {{{2
  41. return syntastic#util#var('asm_dialect', expand('%:e', 1) ==? 'asm' ? 'intel' : 'att')
  42. endfunction " }}}2
  43. " }}}1
  44. call g:SyntasticRegistry.CreateAndRegisterChecker({
  45. \ 'filetype': 'asm',
  46. \ 'name': 'gcc' })
  47. let &cpo = s:save_cpo
  48. unlet s:save_cpo
  49. " vim: set sw=4 sts=4 et fdm=marker: