Skip to content

Commit e063706

Browse files
committed
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?)
1 parent ec21b35 commit e063706

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

mesonbuild/compilers/asm.py

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@
2727
}
2828

2929

30-
class NasmCompiler(Compiler):
30+
class ASMCompiler(Compiler):
31+
32+
"""Shared base class for all ASM Compilers (Assemblers)"""
33+
34+
35+
class NasmCompiler(ASMCompiler):
3136
language = 'nasm'
3237
id = 'nasm'
3338

@@ -151,7 +156,7 @@ def get_dependency_gen_args(self, outtarget: str, outfile: str) -> T.List[str]:
151156
return ['--depfile', outfile]
152157

153158
# https://learn.microsoft.com/en-us/cpp/assembler/masm/ml-and-ml64-command-line-reference
154-
class MasmCompiler(Compiler):
159+
class MasmCompiler(ASMCompiler):
155160
language = 'masm'
156161
id = 'ml'
157162

@@ -209,7 +214,7 @@ def depfile_for_object(self, objfile: str) -> T.Optional[str]:
209214

210215

211216
# https://learn.microsoft.com/en-us/cpp/assembler/arm/arm-assembler-command-line-reference
212-
class MasmARMCompiler(Compiler):
217+
class MasmARMCompiler(ASMCompiler):
213218
language = 'masm'
214219
id = 'armasm'
215220

@@ -260,14 +265,14 @@ def depfile_for_object(self, objfile: str) -> T.Optional[str]:
260265

261266

262267
# https://downloads.ti.com/docs/esd/SPRUI04/
263-
class TILinearAsmCompiler(TICompiler, Compiler):
268+
class TILinearAsmCompiler(TICompiler, ASMCompiler):
264269
language = 'linearasm'
265270

266271
def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str,
267272
for_machine: MachineChoice, info: MachineInfo,
268273
linker: T.Optional[DynamicLinker] = None,
269274
full_version: T.Optional[str] = None, is_cross: bool = False):
270-
Compiler.__init__(self, ccache, exelist, version, for_machine, info, linker, full_version, is_cross)
275+
ASMCompiler.__init__(self, ccache, exelist, version, for_machine, info, linker, full_version, is_cross)
271276
TICompiler.__init__(self)
272277

273278
def needs_static_linker(self) -> bool:
@@ -287,14 +292,14 @@ def get_depfile_suffix(self) -> str:
287292
return 'd'
288293

289294

290-
class MetrowerksAsmCompiler(MetrowerksCompiler, Compiler):
295+
class MetrowerksAsmCompiler(MetrowerksCompiler, ASMCompiler):
291296
language = 'nasm'
292297

293298
def __init__(self, ccache: T.List[str], exelist: T.List[str], version: str,
294299
for_machine: 'MachineChoice', info: 'MachineInfo',
295300
linker: T.Optional['DynamicLinker'] = None,
296301
full_version: T.Optional[str] = None, is_cross: bool = False):
297-
Compiler.__init__(self, ccache, exelist, version, for_machine, info, linker, full_version, is_cross)
302+
ASMCompiler.__init__(self, ccache, exelist, version, for_machine, info, linker, full_version, is_cross)
298303
MetrowerksCompiler.__init__(self)
299304

300305
self.warn_args: T.Dict[str, T.List[str]] = {

0 commit comments

Comments
 (0)