diff options
-rw-r--r-- | mesonbuild/interpreter.py | 2 | ||||
-rw-r--r-- | mesonbuild/mparser.py | 4 | ||||
-rwxr-xr-x | run_unittests.py | 9 | ||||
-rw-r--r-- | test cases/unit/20 warning location/a.c | 0 | ||||
-rw-r--r-- | test cases/unit/20 warning location/b.c | 0 | ||||
-rw-r--r-- | test cases/unit/20 warning location/main.c | 0 | ||||
-rw-r--r-- | test cases/unit/20 warning location/meson.build | 6 | ||||
-rw-r--r-- | test cases/unit/20 warning location/sub/c.c | 0 | ||||
-rw-r--r-- | test cases/unit/20 warning location/sub/d.c | 0 | ||||
-rw-r--r-- | test cases/unit/20 warning location/sub/meson.build | 4 | ||||
-rw-r--r-- | test cases/unit/20 warning location/sub/sub.c | 0 |
11 files changed, 22 insertions, 3 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/mesonbuild/mparser.py b/mesonbuild/mparser.py index 0465d24..782b7a7 100644 --- a/mesonbuild/mparser.py +++ b/mesonbuild/mparser.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import re +import os, re from .mesonlib import MesonException from . import mlog @@ -368,7 +368,7 @@ class ArgumentNode: def set_kwarg(self, name, value): if name in self.kwargs: - mlog.warning('Keyword argument "%s" defined multiple times. This will be a an error in future Meson releases.' % name) + mlog.warning('Keyword argument "%s" defined multiple times in file %s, line %d. This will be an error in future Meson releases.' % (name, os.path.join(self.subdir, 'meson.build'), self.lineno)) self.kwargs[name] = value def num_args(self): diff --git a/run_unittests.py b/run_unittests.py index cbdcda0..dc2429a 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -1707,6 +1707,14 @@ int main(int argc, char **argv) { self.init(workdir) self.build() + 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') + def test_templates(self): ninja = detect_ninja() if ninja is None: @@ -1721,6 +1729,7 @@ int main(int argc, char **argv) { self._run(ninja, workdir=os.path.join(tmpdir, 'builddir')) + class FailureTests(BasePlatformTests): ''' Tests that test failure conditions. Build files here should be dynamically diff --git a/test cases/unit/20 warning location/a.c b/test cases/unit/20 warning location/a.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/unit/20 warning location/a.c diff --git a/test cases/unit/20 warning location/b.c b/test cases/unit/20 warning location/b.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/unit/20 warning location/b.c diff --git a/test cases/unit/20 warning location/main.c b/test cases/unit/20 warning location/main.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/unit/20 warning location/main.c diff --git a/test cases/unit/20 warning location/meson.build b/test cases/unit/20 warning location/meson.build new file mode 100644 index 0000000..e26c6c9 --- /dev/null +++ b/test cases/unit/20 warning location/meson.build @@ -0,0 +1,6 @@ +project('duplicate kwarg', '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') diff --git a/test cases/unit/20 warning location/sub/c.c b/test cases/unit/20 warning location/sub/c.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/unit/20 warning location/sub/c.c diff --git a/test cases/unit/20 warning location/sub/d.c b/test cases/unit/20 warning location/sub/d.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/unit/20 warning location/sub/d.c diff --git a/test cases/unit/20 warning location/sub/meson.build b/test cases/unit/20 warning location/sub/meson.build new file mode 100644 index 0000000..27f6778 --- /dev/null +++ b/test cases/unit/20 warning location/sub/meson.build @@ -0,0 +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') diff --git a/test cases/unit/20 warning location/sub/sub.c b/test cases/unit/20 warning location/sub/sub.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/unit/20 warning location/sub/sub.c |