2018-07-29 18:24:19 +00:00
|
|
|
Before:
|
|
|
|
Save g:ale_c_parse_makefile
|
2020-08-29 15:05:49 +00:00
|
|
|
Save g:ale_c_always_make
|
|
|
|
Save b:ale_c_always_make
|
2018-07-29 18:24:19 +00:00
|
|
|
|
|
|
|
call ale#test#SetDirectory('/testplugin/test')
|
|
|
|
|
|
|
|
let g:ale_c_parse_makefile = 1
|
2020-08-29 15:05:49 +00:00
|
|
|
let g:ale_c_always_make = 1
|
|
|
|
let b:ale_c_always_make = 1
|
2018-07-29 18:24:19 +00:00
|
|
|
|
2020-08-27 18:33:43 +00:00
|
|
|
function SplitAndParse(path_prefix, command) abort
|
|
|
|
let l:args = ale#c#ShellSplit(a:command)
|
|
|
|
|
|
|
|
return ale#c#ParseCFlags(a:path_prefix, 0, l:args)
|
|
|
|
endfunction
|
|
|
|
|
2018-07-29 18:24:19 +00:00
|
|
|
After:
|
2020-08-27 18:33:43 +00:00
|
|
|
delfunction SplitAndParse
|
|
|
|
|
2018-07-29 18:24:19 +00:00
|
|
|
Restore
|
|
|
|
|
|
|
|
call ale#test#RestoreDirectory()
|
|
|
|
|
2020-08-29 15:05:49 +00:00
|
|
|
Execute(The make command should be correct):
|
|
|
|
call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.c')
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ ale#path#CdString(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'))
|
|
|
|
\ . 'make -n --always-make',
|
|
|
|
\ ale#c#GetMakeCommand(bufnr(''))
|
|
|
|
|
|
|
|
" You should be able to disable --always-make for a buffer.
|
|
|
|
let b:ale_c_always_make = 0
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ ale#path#CdString(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'))
|
|
|
|
\ . 'make -n',
|
|
|
|
\ ale#c#GetMakeCommand(bufnr(''))
|
|
|
|
|
2018-07-29 18:24:19 +00:00
|
|
|
Execute(The CFlags parser should be able to parse include directives):
|
|
|
|
call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.c')
|
|
|
|
|
|
|
|
AssertEqual
|
2019-08-17 18:08:14 +00:00
|
|
|
\ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir')),
|
2018-07-29 18:24:19 +00:00
|
|
|
\ ale#c#ParseCFlagsFromMakeOutput(bufnr(''), ['gcc -Isubdir -c file.c'])
|
|
|
|
|
2019-01-22 02:45:17 +00:00
|
|
|
AssertEqual
|
2020-08-27 20:17:24 +00:00
|
|
|
\ '-isystem ' . ale#Escape('/usr/include/dir'),
|
2019-01-22 02:45:17 +00:00
|
|
|
\ ale#c#ParseCFlagsFromMakeOutput(bufnr(''), ['gcc -isystem /usr/include/dir -c file.c'])
|
|
|
|
|
|
|
|
Execute(ParseCFlags should ignore -c and -o):
|
|
|
|
call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.c')
|
|
|
|
|
|
|
|
AssertEqual
|
2019-08-17 18:08:14 +00:00
|
|
|
\ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir')),
|
2019-01-22 02:45:17 +00:00
|
|
|
\ ale#c#ParseCFlagsFromMakeOutput(bufnr(''), ['gcc -Isubdir -c file.c -o a.out'])
|
|
|
|
|
2018-07-29 18:24:19 +00:00
|
|
|
Execute(The CFlags parser should be able to parse macro directives):
|
|
|
|
call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.c')
|
|
|
|
|
|
|
|
AssertEqual
|
2019-08-17 18:08:14 +00:00
|
|
|
\ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir'))
|
2018-07-29 18:24:19 +00:00
|
|
|
\ . ' -DTEST=1',
|
|
|
|
\ ale#c#ParseCFlagsFromMakeOutput(bufnr(''), ['gcc -Isubdir -DTEST=1 -c file.c'])
|
|
|
|
|
|
|
|
Execute(The CFlags parser should be able to parse macro directives with spaces):
|
|
|
|
call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.c')
|
|
|
|
|
|
|
|
AssertEqual
|
2019-08-17 18:08:14 +00:00
|
|
|
\ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir'))
|
2018-07-29 18:24:19 +00:00
|
|
|
\ . ' -DTEST=$(( 2 * 4 ))',
|
|
|
|
\ ale#c#ParseCFlagsFromMakeOutput(bufnr(''), ['gcc -Isubdir -DTEST=$(( 2 * 4 )) -c file.c'])
|
|
|
|
|
|
|
|
Execute(The CFlags parser should be able to parse shell directives with spaces):
|
|
|
|
call ale#test#SetFilename('test_c_projects/makefile_project/subdir/file.c')
|
|
|
|
|
|
|
|
AssertEqual
|
2019-08-17 18:08:14 +00:00
|
|
|
\ '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir'))
|
2018-07-29 18:24:19 +00:00
|
|
|
\ . ' -DTEST=`date +%s`',
|
|
|
|
\ ale#c#ParseCFlagsFromMakeOutput(bufnr(''), ['gcc -Isubdir -DTEST=`date +%s` -c file.c'])
|
|
|
|
|
|
|
|
Execute(ParseCFlags should be able to parse flags with relative paths):
|
|
|
|
AssertEqual
|
2019-08-17 18:08:14 +00:00
|
|
|
\ '-I' . ' ' . 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/kernel/include'))
|
2018-07-29 18:24:19 +00:00
|
|
|
\ . ' -DTEST=`date +%s`',
|
2020-08-27 18:33:43 +00:00
|
|
|
\ SplitAndParse(
|
2018-07-29 18:24:19 +00:00
|
|
|
\ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
|
|
|
|
\ 'gcc -Isubdir '
|
|
|
|
\ . '-I'. ale#path#Simplify('kernel/include')
|
|
|
|
\ . ' -DTEST=`date +%s` -c file.c'
|
|
|
|
\ )
|
|
|
|
|
2020-08-27 18:33:43 +00:00
|
|
|
Execute(We should handle paths with spaces in double quotes):
|
2018-07-29 18:24:19 +00:00
|
|
|
AssertEqual
|
|
|
|
\ '-Dgoal=9'
|
2019-08-17 18:08:14 +00:00
|
|
|
\ . ' ' . '-I' . ' ' . 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/dir with spaces'))
|
|
|
|
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include'))
|
2018-07-29 18:24:19 +00:00
|
|
|
\ . ' -DTEST=`date +%s`',
|
2020-08-27 18:33:43 +00:00
|
|
|
\ SplitAndParse(
|
2018-07-29 18:24:19 +00:00
|
|
|
\ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
|
2019-08-17 18:08:14 +00:00
|
|
|
\ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir '
|
2018-07-29 18:24:19 +00:00
|
|
|
\ . '-I"dir with spaces"' . ' -I'. ale#path#Simplify('kernel/include')
|
|
|
|
\ . ' -DTEST=`date +%s` -c file.c'
|
|
|
|
\ )
|
|
|
|
|
|
|
|
Execute(ParseCFlags should handle paths with spaces in single quotes):
|
|
|
|
AssertEqual
|
|
|
|
\ '-Dgoal=9'
|
2019-08-17 18:08:14 +00:00
|
|
|
\ . ' ' . '-I' . ' ' . 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/dir with spaces'))
|
|
|
|
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include'))
|
2018-07-29 18:24:19 +00:00
|
|
|
\ . ' -DTEST=`date +%s`',
|
2020-08-27 18:33:43 +00:00
|
|
|
\ SplitAndParse(
|
2018-07-29 18:24:19 +00:00
|
|
|
\ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
|
2019-08-17 18:08:14 +00:00
|
|
|
\ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir '
|
|
|
|
\ . '-I''dir with spaces''' . ' -I'. ale#path#Simplify('kernel/include')
|
2018-07-29 18:24:19 +00:00
|
|
|
\ . ' -DTEST=`date +%s` -c file.c'
|
|
|
|
\ )
|
|
|
|
|
|
|
|
Execute(ParseCFlags should handle paths with minuses):
|
|
|
|
AssertEqual
|
|
|
|
\ '-Dgoal=9'
|
2019-08-17 18:08:14 +00:00
|
|
|
\ . ' ' . '-I' . ' ' . 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/dir with spaces'))
|
|
|
|
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir-with-dash'))
|
|
|
|
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include'))
|
2018-07-29 18:24:19 +00:00
|
|
|
\ . ' -DTEST=`date +%s`',
|
2020-08-27 18:33:43 +00:00
|
|
|
\ SplitAndParse(
|
2018-07-29 18:24:19 +00:00
|
|
|
\ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
|
2019-08-17 18:08:14 +00:00
|
|
|
\ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir '
|
|
|
|
\ . '-I''dir with spaces''' . ' -Idir-with-dash'
|
2018-07-29 18:24:19 +00:00
|
|
|
\ . ' -I'. ale#path#Simplify('kernel/include')
|
|
|
|
\ . ' -DTEST=`date +%s` -c file.c'
|
|
|
|
\ )
|
|
|
|
|
2020-08-27 18:33:43 +00:00
|
|
|
Execute(We should handle -D with minuses):
|
2018-07-29 18:24:19 +00:00
|
|
|
AssertEqual
|
|
|
|
\ '-Dgoal=9'
|
2019-08-17 18:08:14 +00:00
|
|
|
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir'))
|
2018-07-29 18:24:19 +00:00
|
|
|
\ . ' -Dmacro-with-dash'
|
2019-08-17 18:08:14 +00:00
|
|
|
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir with spaces'))
|
|
|
|
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir-with-dash'))
|
|
|
|
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include'))
|
2018-07-29 18:24:19 +00:00
|
|
|
\ . ' -DTEST=`date +%s`',
|
2020-08-27 18:33:43 +00:00
|
|
|
\ SplitAndParse(
|
2018-07-29 18:24:19 +00:00
|
|
|
\ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
|
2019-08-17 18:08:14 +00:00
|
|
|
\ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir '
|
2018-07-29 18:24:19 +00:00
|
|
|
\ . '-Dmacro-with-dash '
|
2019-08-17 18:08:14 +00:00
|
|
|
\ . '-I''dir with spaces''' . ' -Idir-with-dash'
|
2018-07-29 18:24:19 +00:00
|
|
|
\ . ' -I'. ale#path#Simplify('kernel/include')
|
|
|
|
\ . ' -DTEST=`date +%s` -c file.c'
|
|
|
|
\ )
|
|
|
|
|
2020-08-27 18:33:43 +00:00
|
|
|
Execute(We should handle flags at the end of the line):
|
2018-09-11 01:46:18 +00:00
|
|
|
AssertEqual
|
|
|
|
\ '-Dgoal=9'
|
2019-08-17 18:08:14 +00:00
|
|
|
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/subdir'))
|
|
|
|
\ . ' -Dmacro-with-dash'
|
|
|
|
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir with spaces'))
|
|
|
|
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/dir-with-dash'))
|
|
|
|
\ . ' ' . '-I' . ' ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/kernel/include')),
|
2020-08-27 18:33:43 +00:00
|
|
|
\ SplitAndParse(
|
2018-09-11 01:46:18 +00:00
|
|
|
\ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
|
2019-08-17 18:08:14 +00:00
|
|
|
\ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir '
|
|
|
|
\ . '-Dmacro-with-dash '
|
|
|
|
\ . '-I''dir with spaces''' . ' -Idir-with-dash'
|
2018-09-11 01:46:18 +00:00
|
|
|
\ . ' -I'. ale#path#Simplify('kernel/include')
|
|
|
|
\ )
|
|
|
|
|
2018-07-29 18:24:19 +00:00
|
|
|
Execute(FlagsFromCompileCommands should tolerate empty values):
|
|
|
|
AssertEqual '', ale#c#FlagsFromCompileCommands(bufnr(''), '')
|
|
|
|
|
|
|
|
Execute(ParseCompileCommandsFlags should tolerate empty values):
|
2019-01-07 02:17:32 +00:00
|
|
|
AssertEqual '', ale#c#ParseCompileCommandsFlags(bufnr(''), {}, {})
|
2018-07-29 18:24:19 +00:00
|
|
|
|
|
|
|
Execute(ParseCompileCommandsFlags should parse some basic flags):
|
2019-04-15 20:38:11 +00:00
|
|
|
silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'))
|
2018-07-29 18:24:19 +00:00
|
|
|
|
2020-08-27 10:44:35 +00:00
|
|
|
" We should read the absolute path filename entry, not the other ones.
|
2018-07-29 18:24:19 +00:00
|
|
|
AssertEqual
|
2020-08-27 20:17:24 +00:00
|
|
|
\ '-I ' . ale#Escape(ale#path#Simplify('/usr/include/xmms2')),
|
2020-08-27 10:44:35 +00:00
|
|
|
\ ale#c#ParseCompileCommandsFlags(
|
|
|
|
\ bufnr(''),
|
2018-07-29 18:24:19 +00:00
|
|
|
\ {
|
2020-08-27 10:44:35 +00:00
|
|
|
\ ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'): [
|
|
|
|
\ {
|
|
|
|
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'),
|
|
|
|
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/xmms2')
|
|
|
|
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
|
|
|
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
|
|
|
\ 'file': ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ "xmms2-mpris.c": [
|
|
|
|
\ {
|
|
|
|
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'),
|
|
|
|
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/ignoreme')
|
|
|
|
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
|
|
|
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
|
|
|
\ 'file': ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
|
|
|
\ },
|
|
|
|
\ ],
|
2018-07-29 18:24:19 +00:00
|
|
|
\ },
|
2020-08-27 10:44:35 +00:00
|
|
|
\ {
|
|
|
|
\ ale#path#Simplify('/foo/bar/xmms2-mpris/src'): [
|
|
|
|
\ {
|
|
|
|
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris/src'),
|
|
|
|
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/ignoreme')
|
|
|
|
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
|
|
|
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
|
|
|
\ 'file': 'other.c',
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ "src": [
|
|
|
|
\ {
|
|
|
|
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'),
|
|
|
|
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/ignoreme')
|
|
|
|
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
|
|
|
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
|
|
|
\ 'file': ale#path#Simplify((has('win32') ? 'C:' : '') . '/foo/bar/xmms2-mpris/src/xmms2-other.c'),
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ },
|
|
|
|
\ )
|
2018-12-17 04:47:35 +00:00
|
|
|
|
2020-08-27 10:44:35 +00:00
|
|
|
Execute(ParseCompileCommandsFlags should fall back to files with the same name):
|
2019-04-15 20:38:11 +00:00
|
|
|
silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'))
|
2019-01-27 09:12:59 +00:00
|
|
|
|
2020-08-27 10:44:35 +00:00
|
|
|
" We should prefer the basename file flags, not the base dirname flags.
|
2019-01-27 09:12:59 +00:00
|
|
|
AssertEqual
|
2020-08-27 20:17:24 +00:00
|
|
|
\ '-I ' . ale#Escape(ale#path#Simplify('/usr/include/xmms2')),
|
2020-08-27 10:44:35 +00:00
|
|
|
\ ale#c#ParseCompileCommandsFlags(
|
|
|
|
\ bufnr(''),
|
2019-01-27 09:12:59 +00:00
|
|
|
\ {
|
2020-08-27 10:44:35 +00:00
|
|
|
\ "xmms2-mpris.c": [
|
|
|
|
\ {
|
|
|
|
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'),
|
|
|
|
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/xmms2')
|
|
|
|
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
|
|
|
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
|
|
|
\ 'file': ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
|
|
|
\ },
|
|
|
|
\ ],
|
2019-01-27 09:12:59 +00:00
|
|
|
\ },
|
2020-08-27 10:44:35 +00:00
|
|
|
\ {
|
|
|
|
\ "src": [
|
|
|
|
\ {
|
|
|
|
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'),
|
|
|
|
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/ignoreme')
|
|
|
|
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
|
|
|
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
|
|
|
\ 'file': ale#path#Simplify((has('win32') ? 'C:' : '') . '/foo/bar/xmms2-mpris/src/xmms2-other.c'),
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ },
|
|
|
|
\ )
|
|
|
|
|
|
|
|
Execute(ParseCompileCommandsFlags should parse flags for exact directory matches):
|
|
|
|
silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'))
|
|
|
|
|
|
|
|
" We should ues the exact directory flags, not the file basename flags.
|
|
|
|
AssertEqual
|
2020-08-27 20:17:24 +00:00
|
|
|
\ '-I ' . ale#Escape(ale#path#Simplify('/usr/include/xmms2')),
|
2020-08-27 10:44:35 +00:00
|
|
|
\ ale#c#ParseCompileCommandsFlags(
|
|
|
|
\ bufnr(''),
|
|
|
|
\ {
|
|
|
|
\ "xmms2-mpris.c": [
|
|
|
|
\ {
|
|
|
|
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'),
|
|
|
|
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/ignoreme')
|
|
|
|
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
|
|
|
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
|
|
|
\ 'file': ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ ale#path#Simplify('/foo/bar/xmms2-mpris/src'): [
|
|
|
|
\ {
|
|
|
|
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris/src'),
|
|
|
|
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/xmms2')
|
|
|
|
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
|
|
|
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
|
|
|
\ 'file': 'other.c',
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ "src": [
|
|
|
|
\ {
|
|
|
|
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'),
|
|
|
|
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/ignoreme')
|
|
|
|
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
|
|
|
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
|
|
|
\ 'file': ale#path#Simplify((has('win32') ? 'C:' : '') . '/foo/bar/xmms2-mpris/src/xmms2-other.c'),
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ },
|
|
|
|
\ )
|
2019-01-27 09:12:59 +00:00
|
|
|
|
2018-12-17 04:47:35 +00:00
|
|
|
Execute(ParseCompileCommandsFlags should fall back to files in the same directory):
|
2019-04-15 20:38:11 +00:00
|
|
|
silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'))
|
2018-12-17 04:47:35 +00:00
|
|
|
|
|
|
|
AssertEqual
|
2020-08-27 20:17:24 +00:00
|
|
|
\ '-I ' . ale#Escape(ale#path#Simplify('/usr/include/xmms2')),
|
2020-08-27 10:44:35 +00:00
|
|
|
\ ale#c#ParseCompileCommandsFlags(
|
|
|
|
\ bufnr(''),
|
|
|
|
\ {},
|
2018-12-17 04:47:35 +00:00
|
|
|
\ {
|
2020-08-27 10:44:35 +00:00
|
|
|
\ "src": [
|
|
|
|
\ {
|
|
|
|
\ 'directory': ale#path#Simplify('/foo/bar/xmms2-mpris'),
|
|
|
|
\ 'command': '/usr/bin/cc -I' . ale#path#Simplify('/usr/include/xmms2')
|
|
|
|
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
|
|
|
\ . ' -c ' . ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'),
|
|
|
|
\ 'file': ale#path#Simplify((has('win32') ? 'C:' : '') . '/foo/bar/xmms2-mpris/src/xmms2-other.c'),
|
|
|
|
\ },
|
|
|
|
\ ],
|
2018-12-17 04:47:35 +00:00
|
|
|
\ },
|
2020-08-27 10:44:35 +00:00
|
|
|
\ )
|
|
|
|
|
|
|
|
Execute(ParseCompileCommandsFlags should tolerate items without commands):
|
|
|
|
silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.c'))
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ '',
|
|
|
|
\ ale#c#ParseCompileCommandsFlags(
|
|
|
|
\ bufnr(''),
|
|
|
|
\ {
|
|
|
|
\ "xmms2-mpris.c": [
|
|
|
|
\ {
|
|
|
|
\ 'directory': '/foo/bar/xmms2-mpris',
|
|
|
|
\ 'file': '/foo/bar/xmms2-mpris/src/xmms2-mpris.c',
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ },
|
|
|
|
\ {},
|
|
|
|
\ )
|
2018-12-29 11:13:23 +00:00
|
|
|
|
2019-04-15 20:38:11 +00:00
|
|
|
Execute(ParseCompileCommandsFlags should take commands from matching .c files for .h files):
|
|
|
|
silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.h'))
|
|
|
|
|
|
|
|
AssertEqual
|
2020-08-27 20:17:24 +00:00
|
|
|
\ '-I ' . ale#Escape('/usr/include/xmms2'),
|
2019-04-15 20:38:11 +00:00
|
|
|
\ ale#c#ParseCompileCommandsFlags(
|
|
|
|
\ bufnr(''),
|
|
|
|
\ {
|
|
|
|
\ 'xmms2-mpris.c': [
|
|
|
|
\ {
|
|
|
|
\ 'directory': '/foo/bar/xmms2-mpris',
|
|
|
|
\ 'file': (has('win32') ? 'C:' : '') . '/foo/bar/xmms2-mpris/src/xmms2-mpris.c',
|
|
|
|
\ 'command': '/usr/bin/cc -I' . '/usr/include/xmms2'
|
|
|
|
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
|
|
|
\ . ' -c ' . '/foo/bar/xmms2-mpris/src/xmms2-mpris.c',
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ },
|
2020-08-27 10:44:35 +00:00
|
|
|
\ {},
|
2019-04-15 20:38:11 +00:00
|
|
|
\ )
|
|
|
|
|
|
|
|
Execute(ParseCompileCommandsFlags should take commands from matching .cpp files for .hpp files):
|
|
|
|
silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.hpp'))
|
|
|
|
|
|
|
|
AssertEqual
|
2020-08-27 20:17:24 +00:00
|
|
|
\ '-I ' . ale#Escape('/usr/include/xmms2'),
|
2019-04-15 20:38:11 +00:00
|
|
|
\ ale#c#ParseCompileCommandsFlags(
|
|
|
|
\ bufnr(''),
|
|
|
|
\ {
|
|
|
|
\ 'xmms2-mpris.cpp': [
|
|
|
|
\ {
|
|
|
|
\ 'directory': '/foo/bar/xmms2-mpris',
|
|
|
|
\ 'file': (has('win32') ? 'C:' : '') . '/foo/bar/xmms2-mpris/src/xmms2-mpris.cpp',
|
|
|
|
\ 'command': '/usr/bin/cc -I' . '/usr/include/xmms2'
|
|
|
|
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
|
|
|
\ . ' -c ' . '/foo/bar/xmms2-mpris/src/xmms2-mpris.cpp',
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ },
|
|
|
|
\ )
|
|
|
|
|
|
|
|
Execute(ParseCompileCommandsFlags should take commands from matching .cpp files for .h files):
|
|
|
|
silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/xmms2-mpris.h'))
|
|
|
|
|
|
|
|
AssertEqual
|
2020-08-27 20:17:24 +00:00
|
|
|
\ '-I ' . ale#Escape('/usr/include/xmms2'),
|
2019-04-15 20:38:11 +00:00
|
|
|
\ ale#c#ParseCompileCommandsFlags(
|
|
|
|
\ bufnr(''),
|
|
|
|
\ {
|
|
|
|
\ 'xmms2-mpris.cpp': [
|
|
|
|
\ {
|
|
|
|
\ 'directory': '/foo/bar/xmms2-mpris',
|
|
|
|
\ 'file': (has('win32') ? 'C:' : '') . '/foo/bar/xmms2-mpris/src/xmms2-mpris.cpp',
|
|
|
|
\ 'command': '/usr/bin/cc -I' . '/usr/include/xmms2'
|
|
|
|
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
|
|
|
\ . ' -c ' . '/foo/bar/xmms2-mpris/src/xmms2-mpris.cpp',
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ },
|
|
|
|
\ )
|
|
|
|
|
|
|
|
Execute(ParseCompileCommandsFlags should not take commands from .c files for .h files with different names):
|
|
|
|
silent noautocmd execute 'file! ' . fnameescape(ale#path#Simplify('/foo/bar/xmms2-mpris/src/other.h'))
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ '',
|
|
|
|
\ ale#c#ParseCompileCommandsFlags(
|
|
|
|
\ bufnr(''),
|
|
|
|
\ {
|
|
|
|
\ 'xmms2-mpris.c': [
|
|
|
|
\ {
|
|
|
|
\ 'directory': '/foo/bar/xmms2-mpris',
|
|
|
|
\ 'file': (has('win32') ? 'C:' : '') . '/foo/bar/xmms2-mpris/src/xmms2-mpris.c',
|
|
|
|
\ 'command': '/usr/bin/cc -I' . '/usr/include/xmms2'
|
|
|
|
\ . ' -o CMakeFiles/xmms2-mpris.dir/src/xmms2-mpris.c.o'
|
|
|
|
\ . ' -c ' . '/foo/bar/xmms2-mpris/src/xmms2-mpris.c',
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ },
|
|
|
|
\ )
|
|
|
|
|
2020-08-27 18:33:43 +00:00
|
|
|
Execute(ShellSplit should not merge flags):
|
2019-08-17 18:08:14 +00:00
|
|
|
AssertEqual
|
2020-08-27 18:33:43 +00:00
|
|
|
\ [
|
|
|
|
\ 'gcc',
|
|
|
|
\ '-Dgoal=9',
|
|
|
|
\ '-Tlinkerfile.ld',
|
|
|
|
\ 'blabla',
|
|
|
|
\ '-Isubdir',
|
|
|
|
\ 'subdir/somedep1.o',
|
|
|
|
\ 'subdir/somedep2.o',
|
|
|
|
\ '-I''dir with spaces''',
|
|
|
|
\ '-Idir-with-dash',
|
|
|
|
\ 'subdir/somedep3.o',
|
|
|
|
\ 'subdir/somedep4.o',
|
2020-08-27 19:18:13 +00:00
|
|
|
\ '-I' . ale#path#Simplify('kernel/include'),
|
2020-08-27 18:33:43 +00:00
|
|
|
\ 'subdir/somedep5.o',
|
|
|
|
\ 'subdir/somedep6.o',
|
|
|
|
\ ],
|
|
|
|
\ ale#c#ShellSplit(
|
2019-08-17 18:08:14 +00:00
|
|
|
\ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla -Isubdir '
|
|
|
|
\ . 'subdir/somedep1.o ' . 'subdir/somedep2.o '
|
|
|
|
\ . '-I''dir with spaces''' . ' -Idir-with-dash '
|
|
|
|
\ . 'subdir/somedep3.o ' . 'subdir/somedep4.o '
|
|
|
|
\ . ' -I'. ale#path#Simplify('kernel/include') . ' '
|
2020-08-27 18:33:43 +00:00
|
|
|
\ . 'subdir/somedep5.o ' . 'subdir/somedep6.o'
|
2019-08-17 18:08:14 +00:00
|
|
|
\ )
|
|
|
|
|
2020-08-27 18:33:43 +00:00
|
|
|
Execute(ShellSplit should handle parenthesis and quotes):
|
2019-01-09 15:39:05 +00:00
|
|
|
AssertEqual
|
2020-08-27 18:33:43 +00:00
|
|
|
\ [
|
|
|
|
\ 'gcc',
|
|
|
|
\ '-Dgoal=9',
|
|
|
|
\ '-Tlinkerfile.ld',
|
|
|
|
\ 'blabla',
|
|
|
|
\ '-Dtest1="('' '')"',
|
|
|
|
\ 'file1.o',
|
|
|
|
\ '-Dtest2=''(` `)''',
|
|
|
|
\ 'file2.o',
|
|
|
|
\ '-Dtest3=`(" ")`',
|
|
|
|
\ 'file3.o',
|
|
|
|
\ ] ,
|
|
|
|
\ ale#c#ShellSplit(
|
2019-08-17 18:08:14 +00:00
|
|
|
\ 'gcc -Dgoal=9 -Tlinkerfile.ld blabla '
|
2019-01-09 15:39:05 +00:00
|
|
|
\ . '-Dtest1="('' '')" file1.o '
|
|
|
|
\ . '-Dtest2=''(` `)'' file2.o '
|
2020-08-27 18:33:43 +00:00
|
|
|
\ . '-Dtest3=`(" ")` file3.o'
|
2019-01-09 15:39:05 +00:00
|
|
|
\ )
|
2019-08-17 18:08:14 +00:00
|
|
|
|
2020-08-27 12:15:04 +00:00
|
|
|
Execute(We should include several important flags):
|
2019-08-17 18:08:14 +00:00
|
|
|
AssertEqual
|
2020-08-27 12:05:50 +00:00
|
|
|
\ '-I ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/inc'))
|
|
|
|
\ . ' -I ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/include'))
|
|
|
|
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incquote'))
|
|
|
|
\ . ' -isystem ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incsystem'))
|
2019-08-17 18:08:14 +00:00
|
|
|
\ . ' -idirafter ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/incafter'))
|
2020-08-27 12:05:50 +00:00
|
|
|
\ . ' -iframework ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incframework'))
|
|
|
|
\ . ' -include ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/foo bar'))
|
2020-12-21 13:59:08 +00:00
|
|
|
\ . ' -imacros ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incmacros'))
|
2020-08-27 20:17:24 +00:00
|
|
|
\ . ' -Dmacro="value"'
|
2020-08-27 18:33:43 +00:00
|
|
|
\ . ' -DGoal=9'
|
|
|
|
\ . ' -D macro2'
|
2020-08-27 20:17:24 +00:00
|
|
|
\ . ' -D macro3="value"'
|
2020-08-27 18:33:43 +00:00
|
|
|
\ . ' -Bbdir'
|
|
|
|
\ . ' -B bdir2'
|
2019-08-17 18:08:14 +00:00
|
|
|
\ . ' -iprefix prefix -iwithprefix prefix2 -iwithprefixbefore prefix3'
|
|
|
|
\ . ' -isysroot sysroot --sysroot=test --no-sysroot-suffix -imultilib multidir'
|
|
|
|
\ . ' -Wsome-warning -std=c89 -pedantic -pedantic-errors -ansi'
|
|
|
|
\ . ' -foption -O2 -C -CC -trigraphs -nostdinc -nostdinc++'
|
|
|
|
\ . ' -iplugindir=dir -march=native -w',
|
|
|
|
\ ale#c#ParseCFlags(
|
|
|
|
\ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
|
2020-08-27 18:33:43 +00:00
|
|
|
\ 0,
|
|
|
|
\ [
|
|
|
|
\ 'gcc',
|
|
|
|
\ '-Iinc',
|
|
|
|
\ '-I',
|
|
|
|
\ 'include',
|
|
|
|
\ '-iquote',
|
|
|
|
\ 'incquote',
|
|
|
|
\ '-isystem',
|
|
|
|
\ 'incsystem',
|
|
|
|
\ '-idirafter',
|
|
|
|
\ 'incafter',
|
|
|
|
\ '-iframework',
|
|
|
|
\ 'incframework',
|
|
|
|
\ '-include',
|
|
|
|
\ '''foo bar''',
|
2020-12-21 13:59:08 +00:00
|
|
|
\ '-imacros',
|
|
|
|
\ 'incmacros',
|
2020-08-27 20:17:24 +00:00
|
|
|
\ '-Dmacro="value"',
|
2020-08-27 18:33:43 +00:00
|
|
|
\ '-DGoal=9',
|
|
|
|
\ '-D',
|
|
|
|
\ 'macro2',
|
2020-08-27 20:17:24 +00:00
|
|
|
\ '-D',
|
|
|
|
\ 'macro3="value"',
|
|
|
|
\ '-Bbdir',
|
|
|
|
\ '-B',
|
|
|
|
\ 'bdir2',
|
|
|
|
\ '-iprefix',
|
|
|
|
\ 'prefix',
|
|
|
|
\ '-iwithprefix',
|
|
|
|
\ 'prefix2',
|
|
|
|
\ '-iwithprefixbefore',
|
|
|
|
\ 'prefix3',
|
|
|
|
\ '-isysroot',
|
|
|
|
\ 'sysroot',
|
|
|
|
\ '--sysroot=test',
|
|
|
|
\ '--no-sysroot-suffix',
|
|
|
|
\ '-imultilib',
|
|
|
|
\ 'multidir',
|
|
|
|
\ '-Wsome-warning',
|
|
|
|
\ '-std=c89',
|
|
|
|
\ '-pedantic',
|
|
|
|
\ '-pedantic-errors',
|
|
|
|
\ '-ansi',
|
|
|
|
\ '-foption',
|
|
|
|
\ '-O2',
|
|
|
|
\ '-C',
|
|
|
|
\ '-CC',
|
|
|
|
\ '-trigraphs',
|
|
|
|
\ '-nostdinc',
|
|
|
|
\ '-nostdinc++',
|
|
|
|
\ '-iplugindir=dir',
|
|
|
|
\ '-march=native',
|
|
|
|
\ '-w',
|
|
|
|
\ ],
|
|
|
|
\ )
|
|
|
|
|
|
|
|
Execute(We should quote the flags we need to quote):
|
|
|
|
AssertEqual
|
|
|
|
\ '-I ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/inc'))
|
|
|
|
\ . ' -I ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/include'))
|
|
|
|
\ . ' -iquote ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incquote'))
|
|
|
|
\ . ' -isystem ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incsystem'))
|
|
|
|
\ . ' -idirafter ' . ale#Escape(ale#path#Simplify(g:dir. '/test_c_projects/makefile_project/incafter'))
|
|
|
|
\ . ' -iframework ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incframework'))
|
|
|
|
\ . ' -include ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/foo bar'))
|
2020-12-21 13:59:08 +00:00
|
|
|
\ . ' -imacros ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incmacros'))
|
2020-08-27 20:17:24 +00:00
|
|
|
\ . ' ' . ale#Escape('-Dmacro="value"')
|
|
|
|
\ . ' -DGoal=9'
|
|
|
|
\ . ' -D macro2'
|
|
|
|
\ . ' -D ' . ale#Escape('macro3="value"')
|
|
|
|
\ . ' -Bbdir'
|
|
|
|
\ . ' -B bdir2'
|
|
|
|
\ . ' -iprefix prefix -iwithprefix prefix2 -iwithprefixbefore prefix3'
|
|
|
|
\ . ' -isysroot sysroot --sysroot=test'
|
|
|
|
\ . ' ' . ale#Escape('--sysroot="quoted"')
|
|
|
|
\ . ' ' . ale#Escape('--sysroot=foo bar')
|
|
|
|
\ . ' --no-sysroot-suffix -imultilib multidir'
|
|
|
|
\ . ' -Wsome-warning -std=c89 -pedantic -pedantic-errors -ansi'
|
|
|
|
\ . ' -foption -O2 -C -CC -trigraphs -nostdinc -nostdinc++'
|
|
|
|
\ . ' -iplugindir=dir -march=native -w',
|
|
|
|
\ ale#c#ParseCFlags(
|
|
|
|
\ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
|
|
|
|
\ 1,
|
|
|
|
\ [
|
|
|
|
\ 'gcc',
|
|
|
|
\ '-Iinc',
|
|
|
|
\ '-I',
|
|
|
|
\ 'include',
|
|
|
|
\ '-iquote',
|
|
|
|
\ 'incquote',
|
|
|
|
\ '-isystem',
|
|
|
|
\ 'incsystem',
|
|
|
|
\ '-idirafter',
|
|
|
|
\ 'incafter',
|
|
|
|
\ '-iframework',
|
|
|
|
\ 'incframework',
|
|
|
|
\ '-include',
|
|
|
|
\ '''foo bar''',
|
2020-12-21 13:59:08 +00:00
|
|
|
\ '-imacros',
|
|
|
|
\ 'incmacros',
|
2020-08-27 20:17:24 +00:00
|
|
|
\ '-Dmacro="value"',
|
|
|
|
\ '-DGoal=9',
|
|
|
|
\ '-D',
|
|
|
|
\ 'macro2',
|
|
|
|
\ '-D',
|
|
|
|
\ 'macro3="value"',
|
2020-08-27 18:33:43 +00:00
|
|
|
\ '-Bbdir',
|
|
|
|
\ '-B',
|
|
|
|
\ 'bdir2',
|
|
|
|
\ '-iprefix',
|
|
|
|
\ 'prefix',
|
|
|
|
\ '-iwithprefix',
|
|
|
|
\ 'prefix2',
|
|
|
|
\ '-iwithprefixbefore',
|
|
|
|
\ 'prefix3',
|
|
|
|
\ '-isysroot',
|
|
|
|
\ 'sysroot',
|
|
|
|
\ '--sysroot=test',
|
2020-08-27 20:17:24 +00:00
|
|
|
\ '--sysroot="quoted"',
|
|
|
|
\ '--sysroot=foo bar',
|
2020-08-27 18:33:43 +00:00
|
|
|
\ '--no-sysroot-suffix',
|
|
|
|
\ '-imultilib',
|
|
|
|
\ 'multidir',
|
|
|
|
\ '-Wsome-warning',
|
|
|
|
\ '-std=c89',
|
|
|
|
\ '-pedantic',
|
|
|
|
\ '-pedantic-errors',
|
|
|
|
\ '-ansi',
|
|
|
|
\ '-foption',
|
|
|
|
\ '-O2',
|
|
|
|
\ '-C',
|
|
|
|
\ '-CC',
|
|
|
|
\ '-trigraphs',
|
|
|
|
\ '-nostdinc',
|
|
|
|
\ '-nostdinc++',
|
|
|
|
\ '-iplugindir=dir',
|
|
|
|
\ '-march=native',
|
|
|
|
\ '-w',
|
|
|
|
\ ],
|
2019-08-17 18:08:14 +00:00
|
|
|
\ )
|
|
|
|
|
2020-08-27 12:15:04 +00:00
|
|
|
Execute(We should exclude other flags that cause problems):
|
2019-08-17 18:08:14 +00:00
|
|
|
AssertEqual
|
|
|
|
\ '',
|
|
|
|
\ ale#c#ParseCFlags(
|
|
|
|
\ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
|
2020-08-27 18:33:43 +00:00
|
|
|
\ 0,
|
|
|
|
\ [
|
|
|
|
\ 'gcc',
|
|
|
|
\ '-Wl,option',
|
|
|
|
\ '-Wa,option',
|
|
|
|
\ '-Wp,option',
|
|
|
|
\ '-c',
|
|
|
|
\ 'filename.c',
|
|
|
|
\ 'somelib.a',
|
|
|
|
\ '-fdump-file=name',
|
|
|
|
\ '-fdiagnostics-arg',
|
|
|
|
\ '-fno-show-column',
|
|
|
|
\ '-fstack-usage',
|
|
|
|
\ '-Tlinkerfile.ld',
|
|
|
|
\ ],
|
2019-08-17 18:08:14 +00:00
|
|
|
\ )
|
2020-04-02 22:49:03 +00:00
|
|
|
|
2020-08-27 12:15:04 +00:00
|
|
|
Execute(We should expand @file in CFlags):
|
2020-04-02 22:49:03 +00:00
|
|
|
AssertEqual
|
|
|
|
\ '-DARGS1 -DARGS2 -O2',
|
|
|
|
\ ale#c#ParseCFlags(
|
|
|
|
\ ale#path#Simplify(g:dir. '/test_c_projects/makefile_project'),
|
2020-08-27 18:33:43 +00:00
|
|
|
\ 0,
|
|
|
|
\ [
|
|
|
|
\ 'gcc',
|
|
|
|
\ '-g',
|
|
|
|
\ '@./args',
|
|
|
|
\ '-O2',
|
|
|
|
\ ],
|
2020-04-02 22:49:03 +00:00
|
|
|
\ )
|