set default C compiler options

This commit is contained in:
kongo2002 2012-03-11 19:40:53 +01:00
parent c11c97da8b
commit 6ce5880b81

View File

@ -64,17 +64,19 @@ endif
let s:save_cpo = &cpo let s:save_cpo = &cpo
set cpo&vim set cpo&vim
if !exists('g:syntastic_c_compiler_options')
let g:syntastic_c_compiler_options = '-std=gnu99'
endif
function! SyntaxCheckers_c_GetLocList() function! SyntaxCheckers_c_GetLocList()
let makeprg = 'gcc -fsyntax-only -std=gnu99 ' let makeprg = 'gcc -fsyntax-only '
let errorformat = '%-G%f:%s:,%-G%f:%l: %#error: %#(Each undeclared '. let errorformat = '%-G%f:%s:,%-G%f:%l: %#error: %#(Each undeclared '.
\ 'identifier is reported only%.%#,%-G%f:%l: %#error: %#for '. \ 'identifier is reported only%.%#,%-G%f:%l: %#error: %#for '.
\ 'each function it appears%.%#,%-GIn file included%.%#,'. \ 'each function it appears%.%#,%-GIn file included%.%#,'.
\ '%-G %#from %f:%l\,,%f:%l:%c: %m,%f:%l: %trror: %m,%f:%l: %m' \ '%-G %#from %f:%l\,,%f:%l:%c: %m,%f:%l: %trror: %m,%f:%l: %m'
" add optional user-defined compiler options " add optional user-defined compiler options
if exists('g:syntastic_c_compiler_options') let makeprg .= g:syntastic_c_compiler_options
let makeprg .= g:syntastic_c_compiler_options
endif
let makeprg .= ' '.shellescape(expand('%')). let makeprg .= ' '.shellescape(expand('%')).
\ ' '.syntastic#c#GetIncludeDirs(0) \ ' '.syntastic#c#GetIncludeDirs(0)