2012-04-08 18:54:13 -04:00
|
|
|
"============================================================================
|
|
|
|
"File: c.vim
|
|
|
|
"Description: Syntax checking plugin for syntastic.vim
|
|
|
|
"Maintainer: Gregor Uhlenheuer <kongo2002 at gmail dot com>
|
|
|
|
"License: This program is free software. It comes without any warranty,
|
|
|
|
" to the extent permitted by applicable law. You can redistribute
|
|
|
|
" it and/or modify it under the terms of the Do What The Fuck You
|
|
|
|
" Want To Public License, Version 2, as published by Sam Hocevar.
|
|
|
|
" See http://sam.zoy.org/wtfpl/COPYING for more details.
|
|
|
|
"
|
|
|
|
"============================================================================
|
|
|
|
|
2013-03-20 05:31:45 -04:00
|
|
|
if exists('g:loaded_syntastic_c_gcc_checker')
|
2012-04-08 18:54:13 -04:00
|
|
|
finish
|
|
|
|
endif
|
2013-03-20 05:31:45 -04:00
|
|
|
let g:loaded_syntastic_c_gcc_checker = 1
|
2012-04-08 18:54:13 -04:00
|
|
|
|
2014-02-08 02:45:51 -05:00
|
|
|
if !exists('g:syntastic_c_compiler_options')
|
|
|
|
let g:syntastic_c_compiler_options = '-std=gnu99'
|
|
|
|
endif
|
|
|
|
|
2014-01-03 04:29:08 -05:00
|
|
|
let s:save_cpo = &cpo
|
|
|
|
set cpo&vim
|
|
|
|
|
2013-10-28 11:30:25 -04:00
|
|
|
function! SyntaxCheckers_c_gcc_IsAvailable() dict
|
2014-02-13 10:38:47 -05:00
|
|
|
if !exists('g:syntastic_c_compiler')
|
|
|
|
let g:syntastic_c_compiler = executable(self.getExec()) ? self.getExec() : 'clang'
|
|
|
|
endif
|
2014-10-06 15:15:44 -04:00
|
|
|
call self.log('g:syntastic_c_compiler =', g:syntastic_c_compiler)
|
2015-01-04 02:01:55 -05:00
|
|
|
return executable(expand(g:syntastic_c_compiler, 1))
|
2013-01-31 11:56:29 -05:00
|
|
|
endfunction
|
2012-04-08 18:54:13 -04:00
|
|
|
|
2013-10-28 07:53:33 -04:00
|
|
|
function! SyntaxCheckers_c_gcc_GetLocList() dict
|
2013-06-25 02:59:07 -04:00
|
|
|
return syntastic#c#GetLocList('c', 'gcc', {
|
2013-05-21 03:03:04 -04:00
|
|
|
\ 'errorformat':
|
|
|
|
\ '%-G%f:%s:,' .
|
|
|
|
\ '%-G%f:%l: %#error: %#(Each undeclared identifier is reported only%.%#,' .
|
|
|
|
\ '%-G%f:%l: %#error: %#for each function it appears%.%#,' .
|
|
|
|
\ '%-GIn file included%.%#,' .
|
|
|
|
\ '%-G %#from %f:%l\,,' .
|
|
|
|
\ '%f:%l:%c: %trror: %m,' .
|
|
|
|
\ '%f:%l:%c: %tarning: %m,' .
|
|
|
|
\ '%f:%l:%c: %m,' .
|
|
|
|
\ '%f:%l: %trror: %m,' .
|
|
|
|
\ '%f:%l: %tarning: %m,'.
|
|
|
|
\ '%f:%l: %m',
|
2013-06-24 04:46:27 -04:00
|
|
|
\ 'main_flags': '-x c -fsyntax-only',
|
|
|
|
\ 'header_flags': '-x c',
|
2013-10-25 08:56:09 -04:00
|
|
|
\ 'header_names': '\m\.h$' })
|
2012-04-08 18:54:13 -04:00
|
|
|
endfunction
|
|
|
|
|
2013-01-27 15:08:30 -05:00
|
|
|
call g:SyntasticRegistry.CreateAndRegisterChecker({
|
|
|
|
\ 'filetype': 'c',
|
2014-02-08 02:45:51 -05:00
|
|
|
\ 'name': 'gcc' })
|
2013-01-27 15:08:30 -05:00
|
|
|
|
2012-04-08 18:54:13 -04:00
|
|
|
let &cpo = s:save_cpo
|
|
|
|
unlet s:save_cpo
|
|
|
|
|
2015-01-04 05:46:54 -05:00
|
|
|
" vim: set sw=4 sts=4 et fdm=marker:
|