summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHoracio Sanson <hsanson@gmail.com>2021-01-20 20:42:18 +0900
committerGitHub <noreply@github.com>2021-01-20 20:42:18 +0900
commit8de0e7b9ba43ed8b3d5697f2f0a14b0d3e399e68 (patch)
tree4ed7f380cafcaa8f23f14bfcf1ca48275f5fbd5b
parent783cf4ab8295ef5ff5b443c045dcdfee6f6dbac7 (diff)
parent02255dd967cd127d4910bf489a655009fa66ba14 (diff)
downloadale-8de0e7b9ba43ed8b3d5697f2f0a14b0d3e399e68.zip
Merge pull request #3430 from mbrunnen/mbn/fix-macros-include-c-flag
Add -imacros to C flags
-rw-r--r--autoload/ale/c.vim1
-rw-r--r--test/test_c_flag_parsing.vader6
2 files changed, 7 insertions, 0 deletions
diff --git a/autoload/ale/c.vim b/autoload/ale/c.vim
index cff53125..c7b1e20a 100644
--- a/autoload/ale/c.vim
+++ b/autoload/ale/c.vim
@@ -152,6 +152,7 @@ function! ale#c#ParseCFlags(path_prefix, should_quote, raw_arguments) abort
\ || stridx(l:option, '-idirafter') == 0
\ || stridx(l:option, '-iframework') == 0
\ || stridx(l:option, '-include') == 0
+ \ || stridx(l:option, '-imacros') == 0
if stridx(l:option, '-I') == 0 && l:option isnot# '-I'
let l:arg = join(split(l:option, '\zs')[2:], '')
let l:option = '-I'
diff --git a/test/test_c_flag_parsing.vader b/test/test_c_flag_parsing.vader
index 99722b17..8b02f2b9 100644
--- a/test/test_c_flag_parsing.vader
+++ b/test/test_c_flag_parsing.vader
@@ -482,6 +482,7 @@ Execute(We should include several important flags):
\ . ' -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'))
+ \ . ' -imacros ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incmacros'))
\ . ' -Dmacro="value"'
\ . ' -DGoal=9'
\ . ' -D macro2'
@@ -511,6 +512,8 @@ Execute(We should include several important flags):
\ 'incframework',
\ '-include',
\ '''foo bar''',
+ \ '-imacros',
+ \ 'incmacros',
\ '-Dmacro="value"',
\ '-DGoal=9',
\ '-D',
@@ -559,6 +562,7 @@ Execute(We should quote the flags we need to quote):
\ . ' -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'))
+ \ . ' -imacros ' . ale#Escape(ale#path#Simplify(g:dir . '/test_c_projects/makefile_project/incmacros'))
\ . ' ' . ale#Escape('-Dmacro="value"')
\ . ' -DGoal=9'
\ . ' -D macro2'
@@ -591,6 +595,8 @@ Execute(We should quote the flags we need to quote):
\ 'incframework',
\ '-include',
\ '''foo bar''',
+ \ '-imacros',
+ \ 'incmacros',
\ '-Dmacro="value"',
\ '-DGoal=9',
\ '-D',