diff options
author | Jon Turney <jon.turney@dronecode.org.uk> | 2017-12-30 18:53:26 +0000 |
---|---|---|
committer | Jon Turney <jon.turney@dronecode.org.uk> | 2017-12-30 20:10:15 +0000 |
commit | ad5cc2ce5523d38578e9ca19179687434d050f3d (patch) | |
tree | 9fb44aa76cdd66e1c81f0afa7ac422e4a91b9675 | |
parent | dd1de073f4c9e643090b1cfdcbfb6b25bbd9dc49 (diff) | |
download | meson-ad5cc2ce5523d38578e9ca19179687434d050f3d.zip meson-ad5cc2ce5523d38578e9ca19179687434d050f3d.tar.gz meson-ad5cc2ce5523d38578e9ca19179687434d050f3d.tar.bz2 |
Append warning location to warning output by warning()
-rw-r--r-- | mesonbuild/interpreter.py | 2 | ||||
-rwxr-xr-x | run_unittests.py | 2 | ||||
-rw-r--r-- | test cases/unit/20 warning location/meson.build | 1 | ||||
-rw-r--r-- | test cases/unit/20 warning location/sub/meson.build | 1 |
4 files changed, 5 insertions, 1 deletions
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index e5238a7..e8fb081 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 036ddd2..ccc4d22 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 7a2e5a7..e26c6c9 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 c23d8e7..27f6778 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') |