aboutsummaryrefslogtreecommitdiff
path: root/run_unittests.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2021-02-16 12:01:36 -0800
committerJussi Pakkanen <jpakkane@gmail.com>2021-02-17 18:06:52 +0200
commit6c1467db272c4700ae79f74c3541f6ccc4814138 (patch)
tree4602952f770ad183039983aae59ac99791f175a1 /run_unittests.py
parent867963f1315023673abbe3cc823eb6d332ed8f86 (diff)
downloadmeson-6c1467db272c4700ae79f74c3541f6ccc4814138.zip
meson-6c1467db272c4700ae79f74c3541f6ccc4814138.tar.gz
meson-6c1467db272c4700ae79f74c3541f6ccc4814138.tar.bz2
compilers: Only insert -flto-jobs in clang's link arguments
Clang has a hand `-Wunused-command-line-argument` switch, which when turned to an error, gets very grump about `-flto-jobs=0` being set in the compiler arguments (although `-flto=` belongs there). We'll refactor a bit to put that only in the link arguments. GCC doesn't have this probably because, a) it doesn't have an equivalent warning, and b) it uses `-flto=<$numthreads. Fixes: #8347
Diffstat (limited to 'run_unittests.py')
-rwxr-xr-xrun_unittests.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/run_unittests.py b/run_unittests.py
index 73be9b7..a41559f 100755
--- a/run_unittests.py
+++ b/run_unittests.py
@@ -3062,10 +3062,14 @@ class AllPlatformTests(BasePlatformTests):
env = get_fake_env(testdir, self.builddir, self.prefix)
cc = env.detect_c_compiler(MachineChoice.HOST)
- if cc.get_id() == 'clang' and is_windows():
- raise unittest.SkipTest('LTO not (yet) supported by windows clang')
+ extra_args: T.List[str] = []
+ if cc.get_id() == 'clang':
+ if is_windows():
+ raise unittest.SkipTest('LTO not (yet) supported by windows clang')
+ else:
+ extra_args.append('-D_cargs=-Werror=unused-command-line-argument')
- self.init(testdir, extra_args=['-Db_lto=true', '-Db_lto_threads=8'])
+ self.init(testdir, extra_args=['-Db_lto=true', '-Db_lto_threads=8'] + extra_args)
self.build()
self.run_tests()
@@ -3091,7 +3095,7 @@ class AllPlatformTests(BasePlatformTests):
elif is_windows():
raise unittest.SkipTest('LTO not (yet) supported by windows clang')
- self.init(testdir, extra_args=['-Db_lto=true', '-Db_lto_mode=thin', '-Db_lto_threads=8'])
+ self.init(testdir, extra_args=['-Db_lto=true', '-Db_lto_mode=thin', '-Db_lto_threads=8', '-Dc_args=-Werror=unused-command-line-argument'])
self.build()
self.run_tests()
@@ -3100,7 +3104,7 @@ class AllPlatformTests(BasePlatformTests):
# This assumes all of the targets support lto
for t in targets:
for s in t['target_sources']:
- assert expected.issubset(set(s['parameters'])), f'Incorrect values for {t["name"]}'
+ self.assertTrue(expected.issubset(set(s['parameters'])), f'Incorrect values for {t["name"]}')
def test_dist_git(self):
if not shutil.which('git'):