diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index e5238a7ea..e8fb08154 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1935,7 +1935,7 @@ to directly access options of other subprojects.''') @noKwargs def func_warning(self, node, args, kwargs): argstr = self.get_message_string_arg(node) - mlog.warning(argstr) + mlog.warning('%s in file %s, line %d' % (argstr, os.path.join(node.subdir, 'meson.build'), node.lineno)) @noKwargs def func_error(self, node, args, kwargs): diff --git a/run_unittests.py b/run_unittests.py index 036ddd2c8..ccc4d2207 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -1712,6 +1712,8 @@ int main(int argc, char **argv) { 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') class FailureTests(BasePlatformTests): diff --git a/test cases/unit/20 warning location/meson.build b/test cases/unit/20 warning location/meson.build index 7a2e5a7bd..e26c6c9df 100644 --- a/test cases/unit/20 warning location/meson.build +++ b/test cases/unit/20 warning location/meson.build @@ -3,3 +3,4 @@ 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') diff --git a/test cases/unit/20 warning location/sub/meson.build b/test cases/unit/20 warning location/sub/meson.build index c23d8e7ab..27f67783c 100644 --- a/test cases/unit/20 warning location/sub/meson.build +++ b/test cases/unit/20 warning location/sub/meson.build @@ -1,3 +1,4 @@ c = library('libc', 'c.c') d = library('libd', 'd.c') executable('sub', 'sub.c', link_with: c, link_with: d) +warning('subdir warning')