Append warning location to warning output by warning()

pull/2852/head
Jon Turney 7 years ago
parent dd1de073f4
commit ad5cc2ce55
  1. 2
      mesonbuild/interpreter.py
  2. 2
      run_unittests.py
  3. 1
      test cases/unit/20 warning location/meson.build
  4. 1
      test cases/unit/20 warning location/sub/meson.build

@ -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):

@ -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):

@ -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')

@ -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')

Loading…
Cancel
Save