diff options
-rw-r--r-- | mesonbuild/msetup.py | 6 | ||||
-rw-r--r-- | unittests/platformagnostictests.py | 9 |
2 files changed, 10 insertions, 5 deletions
diff --git a/mesonbuild/msetup.py b/mesonbuild/msetup.py index ac0ea7f..90ef4b5 100644 --- a/mesonbuild/msetup.py +++ b/mesonbuild/msetup.py @@ -204,8 +204,10 @@ class MesonApp: if opt.subproject and opt.subproject not in all_subprojects: continue if coredata.optstore.is_compiler_option(opt): + permitlist.append(opt.name) continue - if opt.name in permitted_unknowns: + # Ditto for base options. + if coredata.optstore.is_base_option(opt): permitlist.append(opt.name) continue keystr = str(opt) @@ -222,7 +224,7 @@ class MesonApp: # support it, this option gets silently swallowed. # So at least print a message about it. optstr = ','.join(permitlist) - mlog.warning(f'Some command line options went unused: {optstr}', fatal=False) + mlog.warning(f'The following command line option(s) were not used: {optstr}', fatal=False) coredata.optstore.clear_pending() diff --git a/unittests/platformagnostictests.py b/unittests/platformagnostictests.py index f787805..0d8180c 100644 --- a/unittests/platformagnostictests.py +++ b/unittests/platformagnostictests.py @@ -415,9 +415,12 @@ class PlatformAgnosticTests(BasePlatformTests): def test_setup_with_unknown_option(self): testdir = os.path.join(self.common_test_dir, '1 trivial') - for option in ('not_an_option', 'b_not_an_option'): - out = self.init(testdir, extra_args=['--wipe', f'-D{option}=1'], allow_fail=True) - self.assertIn(f'ERROR: Unknown options: "{option}"', out) + out = self.init(testdir, extra_args=['--wipe', f'-Dnot_an_option=1'], allow_fail=True) + self.assertIn('ERROR: Unknown options: "not_an_option"', out) + + out = self.init(testdir, extra_args=['--wipe', f'-Db_not_an_option=1']) + self.assertIn('WARNING: The following command line option(s) were not used: b_not_an_option', out) + def test_configure_new_option(self) -> None: """Adding a new option without reconfiguring should work.""" |