summaryrefslogtreecommitdiff
path: root/ale_linters/c
diff options
context:
space:
mode:
authorroel0 <roel.postelmans@altran.com>2018-03-20 11:56:46 +0100
committerroel0 <roel.postelmans@altran.com>2018-03-20 11:56:46 +0100
commit3fb7efa2c6d249ccc5b69036dbeda690c7459515 (patch)
tree33393c06810204d57e558ed7cec68cb0902032ba /ale_linters/c
parentc47b5fd4b8f9b7c08774e631dae60ca51c23e7c9 (diff)
downloadale-3fb7efa2c6d249ccc5b69036dbeda690c7459515.zip
Added some unit tests and fixed some linting errors for automatic makefile parsing in C #1167
Diffstat (limited to 'ale_linters/c')
-rw-r--r--ale_linters/c/clang.vim10
-rw-r--r--ale_linters/c/gcc.vim8
2 files changed, 11 insertions, 7 deletions
diff --git a/ale_linters/c/clang.vim b/ale_linters/c/clang.vim
index 25d93715..74279b7c 100644
--- a/ale_linters/c/clang.vim
+++ b/ale_linters/c/clang.vim
@@ -3,7 +3,7 @@
call ale#Set('c_clang_executable', 'clang')
call ale#Set('c_clang_options', '-std=c11 -Wall')
-call ale#Set('c_gcc_parse_makefile', 0)
+call ale#Set('c_clang_parse_makefile', 0)
function! ale_linters#c#clang#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'c_clang_executable')
@@ -11,11 +11,13 @@ endfunction
function! ale_linters#c#clang#GetCommand(buffer) abort
let l:cflags = []
- if g:ale_c_parse_makefile
- let l:cflags = join(ale#c#ParseMakefile(a:buffer), ' ')
+ if g:ale_c_clang_parse_makefile
+ let l:cflags = join(ale#c#ParseMakefile(a:buffer), ' ') . ' '
endif
if empty(l:cflags)
let l:cflags = ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer))
+ else
+ let l:cflags .= ' '
endif
" -iquote with the directory the file is in makes #include work for
@@ -23,7 +25,7 @@ let l:cflags = []
return ale#Escape(ale_linters#c#clang#GetExecutable(a:buffer))
\ . ' -S -x c -fsyntax-only '
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
- \ . l:cflags . ' '
+ \ . l:cflags
\ . ale#Var(a:buffer, 'c_clang_options') . ' -'
endfunction
diff --git a/ale_linters/c/gcc.vim b/ale_linters/c/gcc.vim
index 3ad243a3..3199fe8a 100644
--- a/ale_linters/c/gcc.vim
+++ b/ale_linters/c/gcc.vim
@@ -3,7 +3,7 @@
call ale#Set('c_gcc_executable', 'gcc')
call ale#Set('c_gcc_options', '-std=c11 -Wall')
-call ale#Set('c_parse_makefile', 0)
+call ale#Set('c_gcc_parse_makefile', 0)
function! ale_linters#c#gcc#GetExecutable(buffer) abort
return ale#Var(a:buffer, 'c_gcc_executable')
@@ -11,11 +11,13 @@ endfunction
function! ale_linters#c#gcc#GetCommand(buffer) abort
let l:cflags = []
- if g:ale_c_parse_makefile
+ if g:ale_c_gcc_parse_makefile
let l:cflags = join(ale#c#ParseMakefile(a:buffer), ' ')
endif
if empty(l:cflags)
let l:cflags = ale#c#IncludeOptions(ale#c#FindLocalHeaderPaths(a:buffer))
+ else
+ let l:cflags .= ' '
endif
" -iquote with the directory the file is in makes #include work for
@@ -23,7 +25,7 @@ function! ale_linters#c#gcc#GetCommand(buffer) abort
return ale#Escape(ale_linters#c#gcc#GetExecutable(a:buffer))
\ . ' -S -x c -fsyntax-only '
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h')) . ' '
- \ . l:cflags . ' '
+ \ . l:cflags
\ . ale#Var(a:buffer, 'c_gcc_options') . ' -'
endfunction