diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2023-02-07 14:04:44 -0800 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek.chauhan@gmail.com> | 2023-02-08 15:31:58 +0530 |
commit | d55d7bc45dc8660f99d8084a1a793e3776ded807 (patch) | |
tree | bd66ecaed54dd33f84822fc4ef4f2def5c13cb44 /mesonbuild | |
parent | ee8e7ada1da1327e91dba8d50b9cf21c63168a04 (diff) | |
download | meson-d55d7bc45dc8660f99d8084a1a793e3776ded807.zip meson-d55d7bc45dc8660f99d8084a1a793e3776ded807.tar.gz meson-d55d7bc45dc8660f99d8084a1a793e3776ded807.tar.bz2 |
compilers: Remove /utf-8 from Visual Studio command args once
Instead of looking at it each time get_always_args() is called, do it
once. Also avoid mutating global state.
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/compilers/mixins/visualstudio.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/mesonbuild/compilers/mixins/visualstudio.py b/mesonbuild/compilers/mixins/visualstudio.py index de179af..864d3b4 100644 --- a/mesonbuild/compilers/mixins/visualstudio.py +++ b/mesonbuild/compilers/mixins/visualstudio.py @@ -420,6 +420,15 @@ class MSVCCompiler(VisualStudioLikeCompiler): id = 'msvc' + def __init__(self, target: str): + super().__init__(target) + + # Visual Studio 2013 and erlier don't support the /utf-8 argument. + # We want to remove it. We also want to make an explicit copy so we + # don't mutate class constant state + if mesonlib.version_compare(self.version, '<19.00') and '/utf-8' in self.always_args: + self.always_args = [r for r in self.always_args if r != '/utf-8'] + def get_compile_debugfile_args(self, rel_obj: str, pch: bool = False) -> T.List[str]: args = super().get_compile_debugfile_args(rel_obj, pch) # When generating a PDB file with PCH, all compile commands write @@ -435,9 +444,6 @@ class MSVCCompiler(VisualStudioLikeCompiler): # Override CCompiler.get_always_args # We want to drop '/utf-8' for Visual Studio 2013 and earlier def get_always_args(self) -> T.List[str]: - if mesonlib.version_compare(self.version, '<19.00'): - if '/utf-8' in self.always_args: - self.always_args.remove('/utf-8') return self.always_args def get_instruction_set_args(self, instruction_set: str) -> T.Optional[T.List[str]]: |