Added ability to reload compilation flags for c and c++ after loading plugin

This commit is contained in:
grzebiel 2016-12-24 00:17:01 +01:00
parent 55827a9493
commit 9767fd8732
2 changed files with 14 additions and 6 deletions

View File

@ -9,12 +9,16 @@ if !exists('g:ale_c_gcc_options')
let g:ale_c_gcc_options = '-std=c11 -Wall' let g:ale_c_gcc_options = '-std=c11 -Wall'
endif endif
function! ale_linters#c#gcc#GetCommand(buffer) abort
return 'gcc -S -x c++ -fsyntax-only '
\ . g:ale_c_gcc_options . ' -'
endfunction
call ale#linter#Define('c', { call ale#linter#Define('c', {
\ 'name': 'gcc', \ 'name': 'gcc',
\ 'output_stream': 'stderr', \ 'output_stream': 'stderr',
\ 'executable': 'gcc', \ 'executable': 'gcc',
\ 'command': 'gcc -S -x c -fsyntax-only ' \ 'command_callback': 'ale_linters#c#gcc#GetCommand',
\ . g:ale_c_gcc_options
\ . ' -',
\ 'callback': 'ale#handlers#HandleGCCFormat', \ 'callback': 'ale#handlers#HandleGCCFormat',
\}) \})

View File

@ -15,12 +15,16 @@ if !exists('g:ale_cpp_gcc_options')
let g:ale_cpp_gcc_options = '-std=c++14 -Wall' let g:ale_cpp_gcc_options = '-std=c++14 -Wall'
endif endif
function! ale_linters#cpp#gcc#GetCommand(buffer) abort
return 'gcc -S -x c++ -fsyntax-only '
\ . g:ale_cpp_gcc_options . ' -'
endfunction
call ale#linter#Define('cpp', { call ale#linter#Define('cpp', {
\ 'name': 'g++', \ 'name': 'g++',
\ 'output_stream': 'stderr', \ 'output_stream': 'stderr',
\ 'executable': 'g++', \ 'executable': 'g++',
\ 'command': 'gcc -S -x c++ -fsyntax-only ' \ 'command_callback': 'ale_linters#cpp#gcc#GetCommand',
\ . g:ale_cpp_gcc_options
\ . ' -',
\ 'callback': 'ale#handlers#HandleGCCFormat', \ 'callback': 'ale#handlers#HandleGCCFormat',
\}) \})