Fixed issue #8412: '-nostdinc'/'-nostdinc++' become '/X' and '-nostdlib' becomes '/NODEFAULTLIB' in MSVC

pull/8851/head
Schmitz Manuel (LBC) 4 years ago
parent c3f5c2e745
commit 72cbc3b005
  1. 5
      mesonbuild/compilers/c.py
  2. 5
      mesonbuild/compilers/cpp.py
  3. 10
      mesonbuild/compilers/mixins/clike.py

@ -73,7 +73,10 @@ class CCompiler(CLikeCompiler, Compiler):
CLikeCompiler.__init__(self, exe_wrapper)
def get_no_stdinc_args(self) -> T.List[str]:
return ['-nostdinc']
if self.get_id() == 'msvc':
return ['/X']
else:
return ['-nostdinc']
def sanity_check(self, work_dir: str, environment: 'Environment') -> None:
code = 'int main(void) { int class=0; return class; }\n'

@ -85,7 +85,10 @@ class CPPCompiler(CLikeCompiler, Compiler):
return 'C++'
def get_no_stdinc_args(self) -> T.List[str]:
return ['-nostdinc++']
if self.get_id() == 'msvc':
return ['/X']
else:
return ['-nostdinc++']
def sanity_check(self, work_dir: str, environment: 'Environment') -> None:
code = 'class breakCCompiler;int main(void) { return 0; }\n'

@ -159,10 +159,16 @@ class CLikeCompiler(Compiler):
return self.get_largefile_args()
def get_no_stdinc_args(self) -> T.List[str]:
return ['-nostdinc']
if self.get_id() == 'msvc':
return ['/X']
else:
return ['-nostdinc']
def get_no_stdlib_link_args(self) -> T.List[str]:
return ['-nostdlib']
if self.get_id() == 'msvc':
return ['/NODEFAULTLIB']
else:
return ['-nostdlib']
def get_warn_args(self, level: str) -> T.List[str]:
# TODO: this should be an enum

Loading…
Cancel
Save