From 34cb503c854e9afe2f3e13e9d4a5788c47b830a9 Mon Sep 17 00:00:00 2001 From: chitranjali Date: Fri, 23 Mar 2018 22:18:27 +0530 Subject: PR review changes closes #2865 --- mesonbuild/build.py | 4 +++- run_unittests.py | 11 +++++------ test cases/unit/25 shared_mod linking/installed_files.txt | 1 - test cases/unit/25 shared_mod linking/meson.build | 5 ++--- 4 files changed, 10 insertions(+), 11 deletions(-) delete mode 100644 test cases/unit/25 shared_mod linking/installed_files.txt diff --git a/mesonbuild/build.py b/mesonbuild/build.py index fac0c42..d6b737e 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -1034,7 +1034,9 @@ You probably should put it in link_with instead.''') ''' for link_target in self.link_targets: if isinstance(link_target, SharedModule): - mlog.warning('''Linking shared modules to targets is not recommended''') + mlog.warning('''target links against shared modules. This is not +recommended as it can lead to undefined behaviour on some platforms''') + return class Generator: def __init__(self, args, kwargs): diff --git a/run_unittests.py b/run_unittests.py index 65ededf..cf60c11 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -1898,15 +1898,14 @@ int main(int argc, char **argv) { self.assertTrue(exception_raised, 'Double locking did not raise exception.') def test_check_module_linking(self): - ''' + """ Test that shared modules are not linked with targets(link_with:) #2865 - ''' + """ tdir = os.path.join(self.unit_test_dir, '25 shared_mod linking') out = self.init(tdir) - for expected in [ - r'WARNING: Linking shared modules to targets is not recommended' - ]: - self.assertRegex(out, re.escape(expected)) + msg = ('''WARNING: target links against shared modules. This is not +recommended as it can lead to undefined behaviour on some platforms''') + self.assertIn(msg, out) def test_ndebug_if_release_disabled(self): testdir = os.path.join(self.unit_test_dir, '25 ndebug if-release') diff --git a/test cases/unit/25 shared_mod linking/installed_files.txt b/test cases/unit/25 shared_mod linking/installed_files.txt deleted file mode 100644 index c7dab9f..0000000 --- a/test cases/unit/25 shared_mod linking/installed_files.txt +++ /dev/null @@ -1 +0,0 @@ -usr/bin/prog?exe diff --git a/test cases/unit/25 shared_mod linking/meson.build b/test cases/unit/25 shared_mod linking/meson.build index d8934e9..2df16fc 100644 --- a/test cases/unit/25 shared_mod linking/meson.build +++ b/test cases/unit/25 shared_mod linking/meson.build @@ -1,6 +1,5 @@ project('shared library linking test', 'c', 'cpp') -lib = shared_module('mylib', - 'libfile.c' # Split to different lines before and after the comma to test parser. - , install : false) # Don't install libraries in common tests; the path is platform-specific +lib = shared_module('mylib', 'libfile.c') + exe = executable('prog', 'main.c', link_with : lib, install : true) \ No newline at end of file -- cgit v1.1