fix compiler options for C as well

This commit is contained in:
kongo2002 2012-03-11 19:35:52 +01:00
parent 85c347c14f
commit c11c97da8b

View File

@ -65,13 +65,20 @@ let s:save_cpo = &cpo
set cpo&vim
function! SyntaxCheckers_c_GetLocList()
let makeprg = 'gcc -fsyntax-only -std=gnu99 '.shellescape(expand('%')).
\ ' '.syntastic#c#GetIncludeDirs(0)
let makeprg = 'gcc -fsyntax-only -std=gnu99 '
let 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: %m,%f:%l: %trror: %m,%f:%l: %m'
" add optional user-defined compiler options
if exists('g:syntastic_c_compiler_options')
let makeprg .= g:syntastic_c_compiler_options
endif
let makeprg .= ' '.shellescape(expand('%')).
\ ' '.syntastic#c#GetIncludeDirs(0)
" determine whether to parse header files as well
if expand('%') =~? '.h$'
if exists('g:syntastic_c_check_header')
@ -82,11 +89,6 @@ function! SyntaxCheckers_c_GetLocList()
endif
endif
" add optional user-defined compiler options
if exists('g:syntastic_c_compiler_options')
let makeprg .= g:syntastic_c_compiler_options
endif
" check if the user manually set some cflags
if !exists('b:syntastic_c_cflags')
" check whether to search for include files at all