summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2025-09-25 13:42:22 -0700
committerDylan Baker <dylan@pnwbakers.com>2025-10-29 07:57:26 -0700
commite0637066cf2bdc697ecee6fa382f6f00cda1c276 (patch)
tree641e440a66a09a4f1a6581684032834c68ee7fac
parentec21b35ac0f28e679efe42e6d55b39930a60693d (diff)
downloadmeson-e0637066cf2bdc697ecee6fa382f6f00cda1c276.tar.gz
compilers/asm: Introduce an ASMCompiler base class
This will be able to hold some shared state between the different ASM compilers (or should that be assemblers?)
-rw-r--r--mesonbuild/compilers/asm.py19
1 files changed, 12 insertions, 7 deletions
diff --git a/mesonbuild/compilers/asm.py b/mesonbuild/compilers/asm.py
index d4bd32579..d0bea57ec 100644
--- a/mesonbuild/compilers/asm.py
+++ b/mesonbuild/compilers/asm.py
@@ -27,7 +27,12 @@ nasm_optimization_args: T.Dict[str, T.List[str]] = {
}
-class NasmCompiler(Compiler):
+class ASMCompiler(Compiler):
+
+ """Shared base class for all ASM Compilers (Assemblers)"""
+
+
+class NasmCompiler(ASMCompiler):
language = 'nasm'
id = 'nasm'
@@ -151,7 +156,7 @@ class YasmCompiler(NasmCompiler):
return ['--depfile', outfile]
# https://learn.microsoft.com/en-us/cpp/assembler/masm/ml-and-ml64-command-line-reference
-class MasmCompiler(Compiler):
+class MasmCompiler(ASMCompiler):
language = 'masm'
id = 'ml'
@@ -209,7 +214,7 @@ class MasmCompiler(Compiler):
# https://learn.microsoft.com/en-us/cpp/assembler/arm/arm-assembler-command-line-reference
-class MasmARMCompiler(Compiler):
+class MasmARMCompiler(ASMCompiler):
language = 'masm'
id = 'armasm'
@@ -260,14 +265,14 @@ class MasmARMCompiler(Compiler):
# https://downloads.ti.com/docs/esd/SPRUI04/
-class TILinearAsmCompiler(TICompiler, Compiler):
+class TILinearAsmCompiler(TICompiler, ASMCompiler):
language = 'linearasm'
def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str,
for_machine: MachineChoice, info: MachineInfo,
linker: T.Optional[DynamicLinker] = None,
full_version: T.Optional[str] = None, is_cross: bool = False):
- Compiler.__init__(self, ccache, exelist, version, for_machine, info, linker, full_version, is_cross)
+ ASMCompiler.__init__(self, ccache, exelist, version, for_machine, info, linker, full_version, is_cross)
TICompiler.__init__(self)
def needs_static_linker(self) -> bool:
@@ -287,14 +292,14 @@ class TILinearAsmCompiler(TICompiler, Compiler):
return 'd'
-class MetrowerksAsmCompiler(MetrowerksCompiler, Compiler):
+class MetrowerksAsmCompiler(MetrowerksCompiler, ASMCompiler):
language = 'nasm'
def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str,
for_machine: 'MachineChoice', info: 'MachineInfo',
linker: T.Optional['DynamicLinker'] = None,
full_version: T.Optional[str] = None, is_cross: bool = False):
- Compiler.__init__(self, ccache, exelist, version, for_machine, info, linker, full_version, is_cross)
+ ASMCompiler.__init__(self, ccache, exelist, version, for_machine, info, linker, full_version, is_cross)
MetrowerksCompiler.__init__(self)
self.warn_args: T.Dict[str, T.List[str]] = {