From b11035693c4d10b233cac0a0afaac923592b1053 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 14 Feb 2018 11:27:23 -0800 Subject: 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 --- mesonbuild/backend/backends.py | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'mesonbuild/backend') 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): -- cgit v1.1