aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2016-12-30 22:00:52 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2017-01-04 00:40:54 +0530
commit6e5c87e3803ae49c694d4663616365ab193a45c2 (patch)
tree5ef15e39ad41ad10a984e5280f9856827cb9401f
parente31d067fedb3508d933a22fb66491942cbe24003 (diff)
downloadmeson-6e5c87e3803ae49c694d4663616365ab193a45c2.zip
meson-6e5c87e3803ae49c694d4663616365ab193a45c2.tar.gz
meson-6e5c87e3803ae49c694d4663616365ab193a45c2.tar.bz2
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.
-rw-r--r--mesonbuild/compilers.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py
index daae2b3..b36f285 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,