diff --git a/autoload/syntastic/c.vim b/autoload/syntastic/c.vim index 8d9ef73a..e49a29a0 100644 --- a/autoload/syntastic/c.vim +++ b/autoload/syntastic/c.vim @@ -223,24 +223,7 @@ function! s:_get_cflags(ft, ck, opts) abort " {{{2 " check if the user manually set some cflags let b_cflags = s:_get_checker_var('b', a:ft, a:ck, 'cflags', '') - if b_cflags ==# '' - if a:ft ==# 'c' || a:ft ==# 'cpp' - " check whether to search for include files at all - if !s:_get_checker_var('g', a:ft, a:ck, 'no_include_search', 0) - " refresh the include file search if desired - if s:_get_checker_var('g', a:ft, a:ck, 'auto_refresh_includes', 0) - let flags .= ' ' . s:_search_headers() - else - " search for header includes if not cached already - if !exists('b:syntastic_' . a:ft . '_includes') - let b:syntastic_{a:ft}_includes = s:_search_headers() - endif - let flags .= ' ' . b:syntastic_{a:ft}_includes - endif - endif - endif - else - " user-defined cflags + if b_cflags !=# '' let flags .= ' ' . b_cflags endif @@ -248,6 +231,19 @@ function! s:_get_cflags(ft, ck, opts) abort " {{{2 let config_file = s:_get_checker_var('g', a:ft, a:ck, 'config_file', '.syntastic_' . a:ft . '_config') let flags .= ' ' . syntastic#c#ReadConfig(config_file) + if b_cflags ==# '' && (a:ft ==# 'c' || a:ft ==# 'cpp') && !s:_get_checker_var('g', a:ft, a:ck, 'no_include_search', 0) + " refresh the include file search if desired + if s:_get_checker_var('g', a:ft, a:ck, 'auto_refresh_includes', 0) + let flags .= ' ' . s:_search_headers() + else + " search for header includes if not cached already + if !exists('b:syntastic_' . a:ft . '_includes') + let b:syntastic_{a:ft}_includes = s:_search_headers() + endif + let flags .= ' ' . b:syntastic_{a:ft}_includes + endif + endif + return flags endfunction " }}}2 diff --git a/plugin/syntastic.vim b/plugin/syntastic.vim index 98602f58..13db02d0 100644 --- a/plugin/syntastic.vim +++ b/plugin/syntastic.vim @@ -19,7 +19,7 @@ if has('reltime') lockvar! g:_SYNTASTIC_START endif -let g:_SYNTASTIC_VERSION = '3.6.0-140' +let g:_SYNTASTIC_VERSION = '3.6.0-141' lockvar g:_SYNTASTIC_VERSION " Sanity checks {{{1