summaryrefslogtreecommitdiff
path: root/mesonbuild
diff options
context:
space:
mode:
authorEli Schwartz <eschwartz@archlinux.org>2023-07-17 23:02:56 -0400
committerXavier Claessens <xclaesse@gmail.com>2023-10-20 18:07:05 -0400
commit34ac2e4af6e5b4c86e8fcfef86042621d55dd141 (patch)
treee06e84cb458677bed98885b85ce863d4308c41a4 /mesonbuild
parent1cf0ed0997de355d15d9418448423ecf06a62467 (diff)
downloadmeson-34ac2e4af6e5b4c86e8fcfef86042621d55dd141.tar.gz
fix ninja backend rules containing internal enum reprs
Partially reverts commit 1624354f33bf0a33f0e715ba1ca391ae0154ad19 which moved a bunch of stuff from strings to enums. The issue here is that Compiler.mode is not just, or primarily, something we compare, but is instead written in as e.g. `rule c_{compiler.mode}` to build.ninja, so this identifier needs to be a string. Ultimately, the issue is that the commit tried to rewrite a bunch of things called "mode" that had a couple of TODOs saying to use enums... but it rewrote everything called "mode" regardless of whether it was a function kwarg or a compiler property, even though the TODO only applied to one of them.
Diffstat (limited to 'mesonbuild')
-rw-r--r--mesonbuild/compilers/compilers.py2
-rw-r--r--mesonbuild/compilers/mixins/clike.py4
-rw-r--r--mesonbuild/compilers/mixins/visualstudio.py2
3 files changed, 4 insertions, 4 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index abf4ef430..fb399b114 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -527,7 +527,7 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta):
language: str
id: str
warn_args: T.Dict[str, T.List[str]]
- mode = CompileCheckMode.COMPILE
+ mode = 'COMPILER'
def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str,
for_machine: MachineChoice, info: 'MachineInfo',
diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py
index b3c80d440..ca909998b 100644
--- a/mesonbuild/compilers/mixins/clike.py
+++ b/mesonbuild/compilers/mixins/clike.py
@@ -1359,7 +1359,7 @@ class CLikeCompiler(Compiler):
@functools.lru_cache(maxsize=None)
def can_compile(self, src: 'mesonlib.FileOrString') -> bool:
# Files we preprocess can be anything, e.g. .in
- if self.mode == CompileCheckMode.PREPROCESS:
+ if self.mode == 'PREPROCESSOR':
return True
return super().can_compile(src)
@@ -1367,6 +1367,6 @@ class CLikeCompiler(Compiler):
if not self.preprocessor:
self.preprocessor = copy.copy(self)
self.preprocessor.exelist = self.exelist + self.get_preprocess_to_file_args()
- self.preprocessor.mode = CompileCheckMode.PREPROCESS
+ self.preprocessor.mode = 'PREPROCESSOR'
self.modes.append(self.preprocessor)
return self.preprocessor
diff --git a/mesonbuild/compilers/mixins/visualstudio.py b/mesonbuild/compilers/mixins/visualstudio.py
index 3dd75754e..810dddd9d 100644
--- a/mesonbuild/compilers/mixins/visualstudio.py
+++ b/mesonbuild/compilers/mixins/visualstudio.py
@@ -182,7 +182,7 @@ class VisualStudioLikeCompiler(Compiler, metaclass=abc.ABCMeta):
return ['/fsanitize=address']
def get_output_args(self, outputname: str) -> T.List[str]:
- if self.mode == CompileCheckMode.PREPROCESS:
+ if self.mode == 'PREPROCESSOR':
return ['/Fi' + outputname]
if outputname.endswith('.exe'):
return ['/Fe' + outputname]