Fix #2512 - Use -o /dev/null for gcc linting
This commit is contained in:
parent
4ee28d3129
commit
5e64acc6ab
@ -5,7 +5,10 @@ call ale#Set('asm_gcc_executable', 'gcc')
|
|||||||
call ale#Set('asm_gcc_options', '-Wall')
|
call ale#Set('asm_gcc_options', '-Wall')
|
||||||
|
|
||||||
function! ale_linters#asm#gcc#GetCommand(buffer) abort
|
function! ale_linters#asm#gcc#GetCommand(buffer) abort
|
||||||
return '%e -x assembler -fsyntax-only '
|
" `-o /dev/null` or `-o null` is needed to catch all errors,
|
||||||
|
" -fsyntax-only doesn't catch everything.
|
||||||
|
return '%e -x assembler'
|
||||||
|
\ . ' -o ' . g:ale#util#nul_file
|
||||||
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
\ . '-iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||||
\ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -'
|
\ . ' ' . ale#Var(a:buffer, 'asm_gcc_options') . ' -'
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -9,7 +9,11 @@ function! ale_linters#c#gcc#GetCommand(buffer, output) abort
|
|||||||
|
|
||||||
" -iquote with the directory the file is in makes #include work for
|
" -iquote with the directory the file is in makes #include work for
|
||||||
" headers in the same directory.
|
" headers in the same directory.
|
||||||
return '%e -S -x c -fsyntax-only'
|
"
|
||||||
|
" `-o /dev/null` or `-o null` is needed to catch all errors,
|
||||||
|
" -fsyntax-only doesn't catch everything.
|
||||||
|
return '%e -S -x c'
|
||||||
|
\ . ' -o ' . g:ale#util#nul_file
|
||||||
\ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
\ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||||
\ . ale#Pad(l:cflags)
|
\ . ale#Pad(l:cflags)
|
||||||
\ . ale#Pad(ale#Var(a:buffer, 'c_gcc_options')) . ' -'
|
\ . ale#Pad(ale#Var(a:buffer, 'c_gcc_options')) . ' -'
|
||||||
|
@ -9,7 +9,11 @@ function! ale_linters#cpp#gcc#GetCommand(buffer, output) abort
|
|||||||
|
|
||||||
" -iquote with the directory the file is in makes #include work for
|
" -iquote with the directory the file is in makes #include work for
|
||||||
" headers in the same directory.
|
" headers in the same directory.
|
||||||
return '%e -S -x c++ -fsyntax-only'
|
"
|
||||||
|
" `-o /dev/null` or `-o null` is needed to catch all errors,
|
||||||
|
" -fsyntax-only doesn't catch everything.
|
||||||
|
return '%e -S -x c++'
|
||||||
|
\ . ' -o ' . g:ale#util#nul_file
|
||||||
\ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
\ . ' -iquote ' . ale#Escape(fnamemodify(bufname(a:buffer), ':p:h'))
|
||||||
\ . ale#Pad(l:cflags)
|
\ . ale#Pad(l:cflags)
|
||||||
\ . ale#Pad(ale#Var(a:buffer, 'cpp_gcc_options')) . ' -'
|
\ . ale#Pad(ale#Var(a:buffer, 'cpp_gcc_options')) . ' -'
|
||||||
|
@ -194,6 +194,10 @@ function! s:GetLookupFromCompileCommandsFile(compile_commands_file) abort
|
|||||||
let l:raw_data = []
|
let l:raw_data = []
|
||||||
silent! let l:raw_data = json_decode(join(readfile(a:compile_commands_file), ''))
|
silent! let l:raw_data = json_decode(join(readfile(a:compile_commands_file), ''))
|
||||||
|
|
||||||
|
if type(l:raw_data) isnot v:t_list
|
||||||
|
let l:raw_data = []
|
||||||
|
endif
|
||||||
|
|
||||||
let l:file_lookup = {}
|
let l:file_lookup = {}
|
||||||
let l:dir_lookup = {}
|
let l:dir_lookup = {}
|
||||||
|
|
||||||
|
@ -1,8 +1,9 @@
|
|||||||
Before:
|
Before:
|
||||||
call ale#assert#SetUpLinterTest('asm', 'gcc')
|
call ale#assert#SetUpLinterTest('asm', 'gcc')
|
||||||
call ale#test#SetFilename('test.cpp')
|
call ale#test#SetFilename('test.cpp')
|
||||||
let b:command_tail = ' -x assembler -fsyntax-only -iquote'
|
let b:command_tail = ' -x assembler'
|
||||||
\ . ' ' . ale#Escape(g:dir)
|
\ . ' -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||||
|
\ . '-iquote ' . ale#Escape(g:dir)
|
||||||
\ . ' -Wall -'
|
\ . ' -Wall -'
|
||||||
|
|
||||||
After:
|
After:
|
||||||
|
@ -4,8 +4,9 @@ Before:
|
|||||||
|
|
||||||
call ale#assert#SetUpLinterTest('c', 'gcc')
|
call ale#assert#SetUpLinterTest('c', 'gcc')
|
||||||
|
|
||||||
let b:command_tail = ' -S -x c -fsyntax-only -iquote'
|
let b:command_tail = ' -S -x c'
|
||||||
\ . ' ' . ale#Escape(getcwd())
|
\ . ' -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||||
|
\ . ' -iquote ' . ale#Escape(getcwd())
|
||||||
\ . ' -std=c11 -Wall -'
|
\ . ' -std=c11 -Wall -'
|
||||||
|
|
||||||
After:
|
After:
|
||||||
|
@ -17,6 +17,8 @@ Before:
|
|||||||
let g:ale_c_parse_makefile = 0
|
let g:ale_c_parse_makefile = 0
|
||||||
|
|
||||||
After:
|
After:
|
||||||
|
Restore
|
||||||
|
|
||||||
unlet! g:original_project_filenames
|
unlet! g:original_project_filenames
|
||||||
|
|
||||||
call ale#assert#TearDownLinterTest()
|
call ale#assert#TearDownLinterTest()
|
||||||
@ -28,7 +30,7 @@ Execute(The C GCC handler should include 'include' directories for projects with
|
|||||||
|
|
||||||
AssertLinter 'gcc',
|
AssertLinter 'gcc',
|
||||||
\ ale#Escape('gcc')
|
\ ale#Escape('gcc')
|
||||||
\ . ' -S -x c -fsyntax-only'
|
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||||
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/subdir'))
|
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/subdir'))
|
||||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include'))
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include'))
|
||||||
\ . ' -'
|
\ . ' -'
|
||||||
@ -40,7 +42,7 @@ Execute(The C GCC handler should include 'include' directories for projects with
|
|||||||
|
|
||||||
AssertLinter 'gcc',
|
AssertLinter 'gcc',
|
||||||
\ ale#Escape('gcc')
|
\ ale#Escape('gcc')
|
||||||
\ . ' -S -x c -fsyntax-only '
|
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||||
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/subdir'))
|
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/subdir'))
|
||||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/include'))
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/include'))
|
||||||
\ . ' -'
|
\ . ' -'
|
||||||
@ -52,7 +54,7 @@ Execute(The C GCC handler should include root directories for projects with .h f
|
|||||||
|
|
||||||
AssertLinter 'gcc',
|
AssertLinter 'gcc',
|
||||||
\ ale#Escape('gcc')
|
\ ale#Escape('gcc')
|
||||||
\ . ' -S -x c -fsyntax-only '
|
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||||
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project/subdir'))
|
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project/subdir'))
|
||||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project'))
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project'))
|
||||||
\ . ' -'
|
\ . ' -'
|
||||||
@ -64,7 +66,7 @@ Execute(The C GCC handler should include root directories for projects with .hpp
|
|||||||
|
|
||||||
AssertLinter 'gcc',
|
AssertLinter 'gcc',
|
||||||
\ ale#Escape('gcc')
|
\ ale#Escape('gcc')
|
||||||
\ . ' -S -x c -fsyntax-only '
|
\ . ' -S -x c -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||||
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project/subdir'))
|
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project/subdir'))
|
||||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project'))
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project'))
|
||||||
\ . ' -'
|
\ . ' -'
|
||||||
@ -124,7 +126,7 @@ Execute(The C++ GCC handler should include 'include' directories for projects wi
|
|||||||
|
|
||||||
AssertLinter 'gcc',
|
AssertLinter 'gcc',
|
||||||
\ ale#Escape('gcc')
|
\ ale#Escape('gcc')
|
||||||
\ . ' -S -x c++ -fsyntax-only '
|
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||||
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/subdir'))
|
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/subdir'))
|
||||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include'))
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/makefile_project/include'))
|
||||||
\ . ' -'
|
\ . ' -'
|
||||||
@ -136,7 +138,7 @@ Execute(The C++ GCC handler should include 'include' directories for projects wi
|
|||||||
|
|
||||||
AssertLinter 'gcc',
|
AssertLinter 'gcc',
|
||||||
\ ale#Escape('gcc')
|
\ ale#Escape('gcc')
|
||||||
\ . ' -S -x c++ -fsyntax-only '
|
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||||
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/subdir'))
|
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/subdir'))
|
||||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/include'))
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/configure_project/include'))
|
||||||
\ . ' -'
|
\ . ' -'
|
||||||
@ -148,7 +150,7 @@ Execute(The C++ GCC handler should include root directories for projects with .h
|
|||||||
|
|
||||||
AssertLinter 'gcc',
|
AssertLinter 'gcc',
|
||||||
\ ale#Escape('gcc')
|
\ ale#Escape('gcc')
|
||||||
\ . ' -S -x c++ -fsyntax-only '
|
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||||
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project/subdir'))
|
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project/subdir'))
|
||||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project'))
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/h_file_project'))
|
||||||
\ . ' -'
|
\ . ' -'
|
||||||
@ -160,7 +162,7 @@ Execute(The C++ GCC handler should include root directories for projects with .h
|
|||||||
|
|
||||||
AssertLinter 'gcc',
|
AssertLinter 'gcc',
|
||||||
\ ale#Escape('gcc')
|
\ ale#Escape('gcc')
|
||||||
\ . ' -S -x c++ -fsyntax-only '
|
\ . ' -S -x c++ -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||||
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project/subdir'))
|
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project/subdir'))
|
||||||
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project'))
|
\ . ' -I' . ale#Escape(ale#path#Simplify(g:dir . '/../test_c_projects/hpp_file_project'))
|
||||||
\ . ' -'
|
\ . ' -'
|
||||||
|
@ -3,8 +3,9 @@ Before:
|
|||||||
let g:ale_c_parse_makefile = 0
|
let g:ale_c_parse_makefile = 0
|
||||||
|
|
||||||
call ale#assert#SetUpLinterTest('cpp', 'gcc')
|
call ale#assert#SetUpLinterTest('cpp', 'gcc')
|
||||||
let b:command_tail = ' -S -x c++ -fsyntax-only -iquote'
|
let b:command_tail = ' -S -x c++'
|
||||||
\ . ' ' . ale#Escape(getcwd())
|
\ . ' -o ' . (has('win32') ? 'nul': '/dev/null')
|
||||||
|
\ . ' -iquote ' . ale#Escape(getcwd())
|
||||||
\ . ' -std=c++14 -Wall -'
|
\ . ' -std=c++14 -Wall -'
|
||||||
|
|
||||||
After:
|
After:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user