diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 8170357e0..85c3f7711 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1574,7 +1574,7 @@ class Interpreter(InterpreterBase): modname = args[0] if modname.startswith('unstable-'): plainname = modname.split('-', 1)[1] - mlog.warning('Module %s has no backwards or forwards compatibility and might not exist in future releases.' % modname) + mlog.warning('Module %s has no backwards or forwards compatibility and might not exist in future releases' % modname, location=node) modname = 'unstable_' + plainname if modname not in self.environment.coredata.modules: try: @@ -2732,7 +2732,7 @@ root and issuing %s. mlog.warning( "The variable(s) %s in the input file %s are not " "present in the given configuration data" % ( - var_list, inputfile)) + var_list, inputfile), location=node) else: mesonlib.dump_conf_header(ofile_abs, conf.held_object) conf.mark_used() diff --git a/run_unittests.py b/run_unittests.py index dc2429af0..11f16a24d 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -1710,10 +1710,15 @@ int main(int argc, char **argv) { def test_warning_location(self): tdir = os.path.join(self.unit_test_dir, '20 warning location') out = self.init(tdir) - self.assertRegex(out, r'WARNING: Keyword argument "link_with" defined multiple times in file meson.build, line 4') - self.assertRegex(out, r'WARNING: Keyword argument "link_with" defined multiple times in file sub' + re.escape(os.path.sep) + r'meson.build, line 3') - self.assertRegex(out, r'WARNING: a warning of some sort in file meson.build, line 6') - self.assertRegex(out, r'WARNING: subdir warning in file sub' + re.escape(os.path.sep) + r'meson.build, line 4') + for expected in [ + r'WARNING: Keyword argument "link_with" defined multiple times in file meson.build, line 4', + r'WARNING: Keyword argument "link_with" defined multiple times in file sub' + os.path.sep + r'meson.build, line 3', + r'WARNING: a warning of some sort in file meson.build, line 6', + r'WARNING: subdir warning in file sub' + os.path.sep + r'meson.build, line 4', + r'WARNING: Module unstable-simd has no backwards or forwards compatibility and might not exist in future releases in file meson.build, line 7', + r"WARNING: The variable(s) 'MISSING' in the input file conf.in are not present in the given configuration data in file meson.build, line 10", + ]: + self.assertRegex(out, re.escape(expected)) def test_templates(self): ninja = detect_ninja() diff --git a/test cases/unit/20 warning location/conf.in b/test cases/unit/20 warning location/conf.in new file mode 100644 index 000000000..a2903ed38 --- /dev/null +++ b/test cases/unit/20 warning location/conf.in @@ -0,0 +1 @@ +@MISSING@ diff --git a/test cases/unit/20 warning location/meson.build b/test cases/unit/20 warning location/meson.build index e26c6c9df..0b14b8be9 100644 --- a/test cases/unit/20 warning location/meson.build +++ b/test cases/unit/20 warning location/meson.build @@ -1,6 +1,10 @@ -project('duplicate kwarg', 'c') +project('warning location', 'c') a = library('liba', 'a.c') b = library('libb', 'b.c') executable('main', 'main.c', link_with: a, link_with: b) subdir('sub') warning('a warning of some sort') +import('unstable-simd') + +conf_data = configuration_data() +configure_file(input: 'conf.in' , output: 'conf', configuration: conf_data)