diff options
author | Daniel Mensinger <daniel@mensinger-ka.de> | 2019-09-29 20:37:11 +0200 |
---|---|---|
committer | Daniel Mensinger <daniel@mensinger-ka.de> | 2019-10-03 10:06:04 +0200 |
commit | b1b8a7a7e356297741c3c8e5996928ff244578c8 (patch) | |
tree | 7c801cfa53825732245a6bdf486b29e71367dd54 /mesonbuild | |
parent | a7c4682be1e379ba655b7ea25e68d73f1605d62d (diff) | |
download | meson-b1b8a7a7e356297741c3c8e5996928ff244578c8.zip meson-b1b8a7a7e356297741c3c8e5996928ff244578c8.tar.gz meson-b1b8a7a7e356297741c3c8e5996928ff244578c8.tar.bz2 |
Use -isystem instead of -idirafter
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/compilers/compilers.py | 18 | ||||
-rw-r--r-- | mesonbuild/dependencies/base.py | 6 |
2 files changed, 18 insertions, 6 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 2c9508b..5fb58ac 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -420,7 +420,7 @@ class CompilerArgs(list): # Arg prefixes that override by prepending instead of appending prepend_prefixes = ('-I', '-L') # Arg prefixes and args that must be de-duped by returning 2 - dedup2_prefixes = ('-I', '-L', '-D', '-U') + dedup2_prefixes = ('-I', '-isystem', '-L', '-D', '-U') dedup2_suffixes = () dedup2_args = () # Arg prefixes and args that must be de-duped by returning 1 @@ -548,6 +548,22 @@ class CompilerArgs(list): # Last occurrence of a library new.insert(group_end + 1, '-Wl,--end-group') new.insert(group_start, '-Wl,--start-group') + # Remove system/default include paths added with -isystem + if hasattr(self.compiler, 'get_default_include_dirs'): + default_dirs = self.compiler.get_default_include_dirs() + bad_idx_list = [] + for i, each in enumerate(new): + # Remove the -isystem and the path if the path is a dafault path + if (each == '-isystem' and + i < (len(new) - 1) and + new[i + 1] in default_dirs): + bad_idx_list += [i, i + 1] + elif each.startswith('-isystem=') and each[9:] in default_dirs: + bad_idx_list += [i] + elif each.startswith('-isystem') and each[8:] in default_dirs: + bad_idx_list += [i] + for i in reversed(bad_idx_list): + new.pop(i) return self.compiler.unix_args_to_native(new) def append_direct(self, arg): diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py index cbf9c44..5584fbc 100644 --- a/mesonbuild/dependencies/base.py +++ b/mesonbuild/dependencies/base.py @@ -139,11 +139,7 @@ class Dependency: system_args = [] for i in self.compile_args: if i.startswith('-I') or i.startswith('/I'): - # -isystem and -idirafter, both mark directories as system - # directories. However, both affect the search oder, which - # can lead to nasty bugs with -isystem: - # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70129 - system_args += ['-idirafter' + i[2:]] + system_args += ['-isystem' + i[2:]] else: system_args += [i] |