aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-02-14 11:27:23 -0800
committerDylan Baker <dylan@pnwbakers.com>2018-02-14 11:34:07 -0800
commitb11035693c4d10b233cac0a0afaac923592b1053 (patch)
tree0bae4641cee0535cd98594b710f5aa8a11fbcc33
parentd3d0d4affb8880ff46c152dccb54d12851f3ca4c (diff)
downloadmeson-b11035693c4d10b233cac0a0afaac923592b1053.zip
meson-b11035693c4d10b233cac0a0afaac923592b1053.tar.gz
meson-b11035693c4d10b233cac0a0afaac923592b1053.tar.bz2
backends: Only add pch args that are appropriate for the compiler
Currently we try both C and C++ when determining which PCH files to include. The problem with this approach is that if there are no C or C++ files (only headers) and the target has both C and C++ sources then the PCHs will be passed to the wrong compiler. The solution is less code, we already have the compiler, the compiler knows what language it is, so we don't need to walk both C and C++. Fixes #3068
-rw-r--r--mesonbuild/backend/backends.py14
1 files changed, 4 insertions, 10 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 292b027..215d73b 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -407,16 +407,10 @@ class Backend:
args = []
pchpath = self.get_target_private_dir(target)
includeargs = compiler.get_include_args(pchpath, False)
- for lang in ['c', 'cpp']:
- p = target.get_pch(lang)
- if not p:
- continue
- if compiler.can_compile(p[-1]):
- header = p[0]
- args += compiler.get_pch_use_args(pchpath, header)
- if len(args) > 0:
- args = includeargs + args
- return args
+ p = target.get_pch(compiler.get_language())
+ if p:
+ args += compiler.get_pch_use_args(pchpath, p[0])
+ return includeargs + args
@staticmethod
def escape_extra_args(compiler, args):