From 6e5c87e3803ae49c694d4663616365ab193a45c2 Mon Sep 17 00:00:00 2001 From: Nirbheek Chauhan Date: Fri, 30 Dec 2016 22:00:52 +0530 Subject: [PATCH] icc: Always specify the language to use for PCH usage Without this, ICC sometimes gets confused and thinks that the included header is a C header instead of a C++ header. --- mesonbuild/compilers.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index daae2b3c2..b36f2854c 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -2396,6 +2396,7 @@ class IntelCompiler: def __init__(self, icc_type): self.id = 'intel' self.icc_type = icc_type + self.lang_header = 'none' self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize', 'b_coverage', 'b_colorout', 'b_ndebug', 'b_staticpic', 'b_lundef', 'b_asneeded'] # Assembly @@ -2414,7 +2415,8 @@ class IntelCompiler: return 'pchi' def get_pch_use_args(self, pch_dir, header): - return ['-pch', '-pch_dir', os.path.join(pch_dir), '-include', header] + return ['-pch', '-pch_dir', os.path.join(pch_dir), '-x', + self.lang_header, '-include', header, '-x', 'none'] def get_pch_name(self, header_name): return os.path.split(header_name)[-1] + '.' + self.get_pch_suffix() @@ -2444,6 +2446,7 @@ class IntelCCompiler(IntelCompiler, CCompiler): def __init__(self, exelist, version, icc_type, is_cross, exe_wrapper=None): CCompiler.__init__(self, exelist, version, is_cross, exe_wrapper) IntelCompiler.__init__(self, icc_type) + self.lang_header = 'c-header' default_warn_args = ['-Wall', '-w3', '-diag-disable:remark', '-Wpch-messages'] self.warn_args = {'1': default_warn_args, '2': default_warn_args + ['-Wextra'], @@ -2477,6 +2480,7 @@ class IntelCPPCompiler(IntelCompiler, CPPCompiler): def __init__(self, exelist, version, icc_type, is_cross, exe_wrap): CPPCompiler.__init__(self, exelist, version, is_cross, exe_wrap) IntelCompiler.__init__(self, icc_type) + self.lang_header = 'c++-header' default_warn_args = ['-Wall', '-w3', '-diag-disable:remark', '-Wpch-messages', '-Wnon-virtual-dtor'] self.warn_args = {'1': default_warn_args,