From c11c97da8be0c158ac9cb85bd9ed336c1cf5f0a1 Mon Sep 17 00:00:00 2001 From: kongo2002 Date: Sun, 11 Mar 2012 19:35:52 +0100 Subject: [PATCH] fix compiler options for C as well --- syntax_checkers/c.vim | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) 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