]>
git.ipfire.org Git - thirdparty/systemd.git/blob - .ycm_extra_conf.py
5 def GetFlagsFromMakefile(varname
):
6 return subprocess
.check_output([
7 "make", "-s", "print-%s" % varname
]).decode().split()
11 return list(itertools
.chain
.from_iterable(lists
))
14 def DirectoryOfThisScript():
15 return os
.path
.dirname(os
.path
.abspath(__file__
))
18 def MakeRelativePathsInFlagsAbsolute(flags
, working_directory
):
19 if not working_directory
:
22 make_next_absolute
= False
23 path_flags
= [ '-isystem', '-I', '-iquote', '--sysroot=' ]
27 if make_next_absolute
:
28 make_next_absolute
= False
29 if not flag
.startswith('/'):
30 new_flag
= os
.path
.join(working_directory
, flag
)
32 for path_flag
in path_flags
:
34 make_next_absolute
= True
37 if flag
.startswith(path_flag
):
38 path
= flag
[ len(path_flag
): ]
39 new_flag
= path_flag
+ os
.path
.join(working_directory
, path
)
43 new_flags
.append(new_flag
)
47 def FlagsForFile(filename
):
48 relative_to
= DirectoryOfThisScript()
51 'flags': MakeRelativePathsInFlagsAbsolute(flags
, relative_to
),
55 flags
= Flatten(map(GetFlagsFromMakefile
, [
62 # these flags cause crashes in libclang, so remove them
63 flags
.remove('-Wlogical-op')
64 flags
.remove('-Wsuggest-attribute=noreturn')
65 flags
.remove('-Wdate-time')
67 # vim: set et ts=2 sw=2: