1
0

gcc.vim 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. let s:save_cpo = &cpo
  20. set cpo&vim
  21. function! SyntaxCheckers_asm_gcc_IsAvailable() dict " {{{1
  22. if !exists('g:syntastic_asm_compiler')
  23. let g:syntastic_asm_compiler = self.getExec()
  24. endif
  25. return executable(expand(g:syntastic_asm_compiler, 1))
  26. endfunction " }}}1
  27. function! SyntaxCheckers_asm_gcc_GetLocList() dict " {{{1
  28. return syntastic#c#GetLocList('asm', 'gcc', {
  29. \ 'errorformat':
  30. \ '%-G%f:%s:,' .
  31. \ '%f:%l:%c: %trror: %m,' .
  32. \ '%f:%l:%c: %tarning: %m,' .
  33. \ '%f:%l: %m',
  34. \ 'main_flags': '-x assembler -fsyntax-only -masm=' . s:GetDialect() })
  35. endfunction " }}}1
  36. " Utilities {{{1
  37. function! s:GetDialect() " {{{2
  38. return exists('g:syntastic_asm_dialect') ? g:syntastic_asm_dialect :
  39. \ expand('%:e', 1) ==? 'asm' ? 'intel' : 'att'
  40. endfunction " }}}2
  41. " }}}1
  42. call g:SyntasticRegistry.CreateAndRegisterChecker({
  43. \ 'filetype': 'asm',
  44. \ 'name': 'gcc' })
  45. let &cpo = s:save_cpo
  46. unlet s:save_cpo
  47. " vim: set sw=4 sts=4 et fdm=marker: