aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/compilers/compilers.py3
-rw-r--r--mesonbuild/compilers/java.py3
-rwxr-xr-xrun_unittests.py6
3 files changed, 8 insertions, 4 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index 67552ee..4b48e31 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -1091,8 +1091,9 @@ class Compiler(metaclass=abc.ABCMeta):
def get_werror_args(self) -> T.List[str]:
return []
+ @abc.abstractmethod
def get_optimization_args(self, optimization_level: str) -> T.List[str]:
- raise EnvironmentError('{} does not implement get_optimization_args'.format(self.id))
+ pass
def get_module_incdir_args(self) -> T.Tuple[str, ...]:
raise EnvironmentError('{} does not implement get_module_incdir_args'.format(self.id))
diff --git a/mesonbuild/compilers/java.py b/mesonbuild/compilers/java.py
index 895173e..77e1a9b 100644
--- a/mesonbuild/compilers/java.py
+++ b/mesonbuild/compilers/java.py
@@ -99,3 +99,6 @@ class JavaCompiler(BasicLinkerIsCompilerMixin, Compiler):
def needs_static_linker(self) -> bool:
return False
+
+ def get_optimization_args(self, optimization_level: str) -> T.List[str]:
+ return []
diff --git a/run_unittests.py b/run_unittests.py
index db61ca6..7ddf17d 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -360,7 +360,7 @@ class InternalTests(unittest.TestCase):
stat.S_IRGRP | stat.S_IXGRP)
def test_compiler_args_class_none_flush(self):
- cc = mesonbuild.compilers.CCompiler([], 'fake', False, MachineChoice.HOST, mock.Mock())
+ cc = mesonbuild.compilers.ClangCCompiler([], 'fake', MachineChoice.HOST, False, mock.Mock())
a = cc.compiler_args(['-I.'])
#first we are checking if the tree construction deduplicates the correct -I argument
a += ['-I..']
@@ -383,8 +383,8 @@ class InternalTests(unittest.TestCase):
a += ['-Ifirst']
self.assertEqual(a, ['-Ifirst', '-Isecond', '-Ithird'])
- def test_compiler_args_class(self):
- cc = mesonbuild.compilers.CCompiler([], 'fake', False, MachineChoice.HOST, mock.Mock())
+ def test_compiler_args_class_clike(self):
+ cc = mesonbuild.compilers.ClangCCompiler([], 'fake', MachineChoice.HOST, False, mock.Mock())
# Test that empty initialization works
a = cc.compiler_args()
self.assertEqual(a, [])