aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJon Turney <jon.turney@dronecode.org.uk>2020-01-23 18:47:43 +0000
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2020-09-10 07:20:41 +0000
commit79b2eeb1baae4097335997c191e1eb9626f27ce5 (patch)
treee5262bedea3c9df3eccaef87d1c6ee7a7d95c904
parent7996ca3d5506c401756a29e9ed3c6969eb96f116 (diff)
downloadmeson-79b2eeb1baae4097335997c191e1eb9626f27ce5.zip
meson-79b2eeb1baae4097335997c191e1eb9626f27ce5.tar.gz
meson-79b2eeb1baae4097335997c191e1eb9626f27ce5.tar.bz2
Identify machine in error accesing compiler object for missing language
Also add a failing test case for that error.
-rw-r--r--mesonbuild/interpreter.py2
-rw-r--r--test cases/failing/109 compiler no lang/meson.build2
-rw-r--r--test cases/failing/109 compiler no lang/test.json7
3 files changed, 10 insertions, 1 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index 5771c65..fc09fa0 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -2093,7 +2093,7 @@ class MesonMain(InterpreterObject):
clist = self.interpreter.coredata.compilers[for_machine]
if cname in clist:
return CompilerHolder(clist[cname], self.build.environment, self.interpreter.subproject)
- raise InterpreterException('Tried to access compiler for unspecified language "%s".' % cname)
+ raise InterpreterException('Tried to access compiler for language "%s", not specified for %s machine.' % (cname, for_machine.get_lower_case_name()))
@noPosargs
@permittedKwargs({})
diff --git a/test cases/failing/109 compiler no lang/meson.build b/test cases/failing/109 compiler no lang/meson.build
new file mode 100644
index 0000000..366bbdd
--- /dev/null
+++ b/test cases/failing/109 compiler no lang/meson.build
@@ -0,0 +1,2 @@
+project('compiler without lang')
+meson.get_compiler('c')
diff --git a/test cases/failing/109 compiler no lang/test.json b/test cases/failing/109 compiler no lang/test.json
new file mode 100644
index 0000000..c613d5d
--- /dev/null
+++ b/test cases/failing/109 compiler no lang/test.json
@@ -0,0 +1,7 @@
+{
+ "stdout": [
+ {
+ "line": "test cases/failing/109 compiler no lang/meson.build:2:6: ERROR: Tried to access compiler for language \"c\", not specified for host machine."
+ }
+ ]
+}