]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/ale_linters/asm/gcc.vim

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit 'd49e95aa7ba744f0a7f544aca43afdb6aab41f24' as '.vim/bundle/asyncomplete...
[etc/vim.git] / .vim / bundle / ale / ale_linters / asm / gcc.vim
1 " Author: Lucas Kolstad <lkolstad@uw.edu>
2 " Description: gcc linter for asm files
3
4 call ale#Set('asm_gcc_executable', 'gcc')
5 call ale#Set('asm_gcc_options', '-Wall')
6
7 function! ale_linters#asm#gcc#GetCommand(buffer) abort
8     " `-o /dev/null` or `-o null` is needed to catch all errors,
9     " -fsyntax-only doesn't catch everything.
10     return '%e -x assembler'
11     \   . ' -o ' . g:ale#util#nul_file
12     \   . '-iquote %s:h'
13     \   . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -'
14 endfunction
15
16 function! ale_linters#asm#gcc#Handle(buffer, lines) abort
17     let l:pattern = '^.\+:\(\d\+\): \([^:]\+\): \(.\+\)$'
18     let l:output = []
19
20     for l:match in ale#util#GetMatches(a:lines, l:pattern)
21         call add(l:output, {
22         \ 'lnum': l:match[1] + 0,
23         \ 'type': l:match[2] =~? 'error' ? 'E' : 'W',
24         \ 'text': l:match[3],
25         \})
26     endfor
27
28     return l:output
29 endfunction
30
31 call ale#linter#Define('asm', {
32 \    'name': 'gcc',
33 \    'output_stream': 'stderr',
34 \    'executable': {b -> ale#Var(b, 'asm_gcc_executable')},
35 \    'command': function('ale_linters#asm#gcc#GetCommand'),
36 \    'callback': 'ale_linters#asm#gcc#Handle',
37 \})