aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/interpreterbase/decorators.py16
-rw-r--r--test cases/common/129 build by default/meson.build1
-rw-r--r--test cases/frameworks/7 gnome/gir/meson.build4
-rw-r--r--test cases/unit/22 warning location/meson.build2
-rw-r--r--unittests/allplatformstests.py6
5 files changed, 10 insertions, 19 deletions
diff --git a/mesonbuild/interpreterbase/decorators.py b/mesonbuild/interpreterbase/decorators.py
index a95dd15..d8551aa 100644
--- a/mesonbuild/interpreterbase/decorators.py
+++ b/mesonbuild/interpreterbase/decorators.py
@@ -102,11 +102,11 @@ class permittedKwargs:
def __call__(self, f: TV_func) -> TV_func:
@wraps(f)
def wrapped(*wrapped_args: T.Any, **wrapped_kwargs: T.Any) -> T.Any:
- node, args, kwargs, _ = get_callee_args(wrapped_args)
- for k in kwargs:
- if k not in self.permitted:
- mlog.warning(f'''Passed invalid keyword argument "{k}".''', location=node)
- mlog.warning('This will become a hard error in the future.')
+ kwargs = get_callee_args(wrapped_args)[2]
+ unknowns = set(kwargs).difference(self.permitted)
+ if unknowns:
+ ustr = ', '.join([f'"{u}"' for u in sorted(unknowns)])
+ raise InvalidArguments(f'Got unknown keyword arguments {ustr}')
return f(*wrapped_args, **wrapped_kwargs)
return T.cast(TV_func, wrapped)
@@ -406,12 +406,8 @@ def typed_kwargs(name: str, *types: KwargInfo) -> T.Callable[..., T.Any]:
all_names = {t.name for t in types}
unknowns = set(kwargs).difference(all_names)
if unknowns:
- # Warn about unknown argumnts, delete them and continue. This
- # keeps current behavior
ustr = ', '.join([f'"{u}"' for u in sorted(unknowns)])
- mlog.warning(f'{name} got unknown keyword arguments {ustr}')
- for u in unknowns:
- del kwargs[u]
+ raise InvalidArguments(f'{name} got unknown keyword arguments {ustr}')
for info in types:
value = kwargs.get(info.name)
diff --git a/test cases/common/129 build by default/meson.build b/test cases/common/129 build by default/meson.build
index b28b634..b797f76 100644
--- a/test cases/common/129 build by default/meson.build
+++ b/test cases/common/129 build by default/meson.build
@@ -9,7 +9,6 @@ executable('fooprog', 'foo.c',
executable('barprog', 'foo.c',
build_by_default : false,
- build_always : true,
)
comp = files('mygen.py')
diff --git a/test cases/frameworks/7 gnome/gir/meson.build b/test cases/frameworks/7 gnome/gir/meson.build
index 64c49f7..fbff206 100644
--- a/test cases/frameworks/7 gnome/gir/meson.build
+++ b/test cases/frameworks/7 gnome/gir/meson.build
@@ -46,10 +46,6 @@ gnome.generate_gir(
dependencies : [[fake_dep, dep1_dep]],
install : true,
build_by_default : true,
- # Test that unknown kwargs do not crash the parser.
- # Unknown kwargs will eventually become a hard error.
- # Once that happens remove this.
- unknown_kwarg : true,
)
test('gobject introspection/c', girexe)
diff --git a/test cases/unit/22 warning location/meson.build b/test cases/unit/22 warning location/meson.build
index 52a93d1..132939e 100644
--- a/test cases/unit/22 warning location/meson.build
+++ b/test cases/unit/22 warning location/meson.build
@@ -1,4 +1,4 @@
-project('warning location', 'c', invalid: 'cheese')
+project('warning location', 'c')
a = library('liba', 'a.c')
b = library('libb', 'b.c')
executable('main', 'main.c', link_with: a, link_with: b)
diff --git a/unittests/allplatformstests.py b/unittests/allplatformstests.py
index 911613e..ee199f1 100644
--- a/unittests/allplatformstests.py
+++ b/unittests/allplatformstests.py
@@ -1777,7 +1777,6 @@ class AllPlatformTests(BasePlatformTests):
r'sub' + os.path.sep + r'meson.build:4: WARNING: subdir warning',
r'meson.build:7: WARNING: Module unstable-simd has no backwards or forwards compatibility and might not exist in future releases.',
r"meson.build:11: WARNING: The variable(s) 'MISSING' in the input file 'conf.in' are not present in the given configuration data.",
- r'meson.build:1: WARNING: Passed invalid keyword argument "invalid".',
]:
self.assertRegex(out, re.escape(expected))
@@ -1827,8 +1826,9 @@ class AllPlatformTests(BasePlatformTests):
def test_permitted_method_kwargs(self):
tdir = os.path.join(self.unit_test_dir, '25 non-permitted kwargs')
- out = self.init(tdir, allow_fail=True)
- self.assertIn('Function does not take keyword arguments.', out)
+ with self.assertRaises(subprocess.CalledProcessError) as cm:
+ self.init(tdir)
+ self.assertIn('ERROR: compiler.has_header_symbol got unknown keyword arguments "prefixxx"', cm.exception.output)
def test_templates(self):
ninja = mesonbuild.environment.detect_ninja()