From 3702b4bdb3645a2e7ef5a067ed21ad6accf0bc93 Mon Sep 17 00:00:00 2001 From: Kacper Michajłow Date: Mon, 13 May 2024 15:38:50 +0200 Subject: compilers: change get_argument_syntax to static method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows to get this fixed value before the class is initialized. Signed-off-by: Kacper Michajłow --- mesonbuild/compilers/asm.py | 3 ++- mesonbuild/compilers/compilers.py | 3 ++- mesonbuild/compilers/mixins/gnu.py | 3 ++- mesonbuild/compilers/mixins/visualstudio.py | 3 ++- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/mesonbuild/compilers/asm.py b/mesonbuild/compilers/asm.py index cefda765f..8cd5e28dc 100644 --- a/mesonbuild/compilers/asm.py +++ b/mesonbuild/compilers/asm.py @@ -158,7 +158,8 @@ class MasmCompiler(Compiler): def get_compile_only_args(self) -> T.List[str]: return ['/c'] - def get_argument_syntax(self) -> str: + @staticmethod + def get_argument_syntax() -> str: return 'msvc' def needs_static_linker(self) -> bool: diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 3dcf496d4..b9605ccae 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -963,7 +963,8 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta): def get_pie_link_args(self) -> T.List[str]: return self.linker.get_pie_args() - def get_argument_syntax(self) -> str: + @staticmethod + def get_argument_syntax() -> str: """Returns the argument family type. Compilers fall into families if they try to emulate the command line diff --git a/mesonbuild/compilers/mixins/gnu.py b/mesonbuild/compilers/mixins/gnu.py index 7b72496ef..62f55543a 100644 --- a/mesonbuild/compilers/mixins/gnu.py +++ b/mesonbuild/compilers/mixins/gnu.py @@ -420,7 +420,8 @@ class GnuLikeCompiler(Compiler, metaclass=abc.ABCMeta): # For other targets, discard the .def file. return [] - def get_argument_syntax(self) -> str: + @staticmethod + def get_argument_syntax() -> str: return 'gcc' def get_profile_generate_args(self) -> T.List[str]: diff --git a/mesonbuild/compilers/mixins/visualstudio.py b/mesonbuild/compilers/mixins/visualstudio.py index 4ec22a0f2..f095b95e2 100644 --- a/mesonbuild/compilers/mixins/visualstudio.py +++ b/mesonbuild/compilers/mixins/visualstudio.py @@ -362,7 +362,8 @@ class VisualStudioLikeCompiler(Compiler, metaclass=abc.ABCMeta): # false without compiling anything return name in {'dllimport', 'dllexport'}, False - def get_argument_syntax(self) -> str: + @staticmethod + def get_argument_syntax() -> str: return 'msvc' def symbols_have_underscore_prefix(self, env: 'Environment') -> bool: -- cgit v1.2.3