From 9767fd87324977d767dda2dc6c90d2639d1326e0 Mon Sep 17 00:00:00 2001 From: grzebiel Date: Sat, 24 Dec 2016 00:17:01 +0100 Subject: [PATCH] Added ability to reload compilation flags for c and c++ after loading plugin --- ale_linters/c/gcc.vim | 10 +++++++--- ale_linters/cpp/gcc.vim | 10 +++++++--- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/ale_linters/c/gcc.vim b/ale_linters/c/gcc.vim index 3c18964a..583f4fab 100644 --- a/ale_linters/c/gcc.vim +++ b/ale_linters/c/gcc.vim @@ -9,12 +9,16 @@ if !exists('g:ale_c_gcc_options') let g:ale_c_gcc_options = '-std=c11 -Wall' 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', { \ 'name': 'gcc', \ 'output_stream': 'stderr', \ 'executable': 'gcc', -\ 'command': 'gcc -S -x c -fsyntax-only ' -\ . g:ale_c_gcc_options -\ . ' -', +\ 'command_callback': 'ale_linters#c#gcc#GetCommand', \ 'callback': 'ale#handlers#HandleGCCFormat', \}) diff --git a/ale_linters/cpp/gcc.vim b/ale_linters/cpp/gcc.vim index 084c0602..200a25c1 100644 --- a/ale_linters/cpp/gcc.vim +++ b/ale_linters/cpp/gcc.vim @@ -15,12 +15,16 @@ if !exists('g:ale_cpp_gcc_options') let g:ale_cpp_gcc_options = '-std=c++14 -Wall' 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', { \ 'name': 'g++', \ 'output_stream': 'stderr', \ 'executable': 'g++', -\ 'command': 'gcc -S -x c++ -fsyntax-only ' -\ . g:ale_cpp_gcc_options -\ . ' -', +\ 'command_callback': 'ale_linters#cpp#gcc#GetCommand', \ 'callback': 'ale#handlers#HandleGCCFormat', \})