aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/interpreter/interpreter.py2
-rw-r--r--mesonbuild/interpreter/type_checking.py2
-rw-r--r--mesonbuild/modules/pkgconfig.py2
-rw-r--r--test cases/failing/47 pkgconfig variables zero length value/meson.build16
-rw-r--r--test cases/failing/47 pkgconfig variables zero length value/simple.c5
-rw-r--r--test cases/failing/47 pkgconfig variables zero length value/simple.h6
-rw-r--r--test cases/failing/47 pkgconfig variables zero length value/test.json7
7 files changed, 4 insertions, 36 deletions
diff --git a/mesonbuild/interpreter/interpreter.py b/mesonbuild/interpreter/interpreter.py
index aaffec0..99c4f96 100644
--- a/mesonbuild/interpreter/interpreter.py
+++ b/mesonbuild/interpreter/interpreter.py
@@ -702,6 +702,8 @@ class Interpreter(InterpreterBase, HoldableObject):
srcdir = Path(self.environment.source_dir)
# convert variables which refer to an -uninstalled.pc style datadir
for k, v in variables.items():
+ if not v:
+ FeatureNew.single_use('empty variable value in declare_dependency', '1.4.0', self.subproject, location=node)
try:
p = Path(v)
except ValueError:
diff --git a/mesonbuild/interpreter/type_checking.py b/mesonbuild/interpreter/type_checking.py
index 616f4ef..2ec7d58 100644
--- a/mesonbuild/interpreter/type_checking.py
+++ b/mesonbuild/interpreter/type_checking.py
@@ -144,8 +144,6 @@ def variables_validator(contents: T.Union[str, T.List[str], T.Dict[str, str]]) -
for k, v in variables.items():
if not k:
return 'empty variable name'
- if not v:
- return 'empty variable value'
if any(c.isspace() for c in k):
return f'invalid whitespace in variable name {k!r}'
return None
diff --git a/mesonbuild/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py
index 3f9ce7b..ebe0d92 100644
--- a/mesonbuild/modules/pkgconfig.py
+++ b/mesonbuild/modules/pkgconfig.py
@@ -680,6 +680,8 @@ class PkgConfigModule(NewExtensionModule):
reserved = ['prefix', 'libdir', 'includedir']
variables = []
for name, value in vardict.items():
+ if not value:
+ FeatureNew.single_use('empty variable value in pkg.generate', '1.4.0', state.subproject, location=state.current_node)
if not dataonly and name in reserved:
raise mesonlib.MesonException(f'Variable "{name}" is reserved')
variables.append((name, value))
diff --git a/test cases/failing/47 pkgconfig variables zero length value/meson.build b/test cases/failing/47 pkgconfig variables zero length value/meson.build
deleted file mode 100644
index 33977b2..0000000
--- a/test cases/failing/47 pkgconfig variables zero length value/meson.build
+++ /dev/null
@@ -1,16 +0,0 @@
-project('variables-zero-length-value-test', 'c', version : '1.0')
-
-pkgg = import('pkgconfig')
-lib = shared_library('simple', 'simple.c')
-libver = '1.0'
-h = install_headers('simple.h')
-
-pkgg.generate(
- libraries : [lib, '-lz'],
- subdirs : '.',
- version : libver,
- name : 'libsimple',
- filebase : 'simple',
- description : 'A simple demo library.',
- variables : [ 'key=' ]
-)
diff --git a/test cases/failing/47 pkgconfig variables zero length value/simple.c b/test cases/failing/47 pkgconfig variables zero length value/simple.c
deleted file mode 100644
index e8a6d83..0000000
--- a/test cases/failing/47 pkgconfig variables zero length value/simple.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include"simple.h"
-
-int simple_function() {
- return 42;
-}
diff --git a/test cases/failing/47 pkgconfig variables zero length value/simple.h b/test cases/failing/47 pkgconfig variables zero length value/simple.h
deleted file mode 100644
index bb52e6d..0000000
--- a/test cases/failing/47 pkgconfig variables zero length value/simple.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef SIMPLE_H_
-#define SIMPLE_H_
-
-int simple_function();
-
-#endif
diff --git a/test cases/failing/47 pkgconfig variables zero length value/test.json b/test cases/failing/47 pkgconfig variables zero length value/test.json
deleted file mode 100644
index 0be5725..0000000
--- a/test cases/failing/47 pkgconfig variables zero length value/test.json
+++ /dev/null
@@ -1,7 +0,0 @@
-{
- "stdout": [
- {
- "line": "test cases/failing/47 pkgconfig variables zero length value/meson.build:8:5: ERROR: pkgconfig.generate keyword argument \"variables\" empty variable value"
- }
- ]
-}