diff --git a/syntax_checkers/c.vim b/syntax_checkers/c.vim index 740ad746..9b645f41 100644 --- a/syntax_checkers/c.vim +++ b/syntax_checkers/c.vim @@ -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