aboutsummaryrefslogtreecommitdiff
path: root/libbuild2
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-08-22 11:16:29 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-08-22 11:16:29 +0200
commit8f34de5c103e9e4d2c27583020f2975907b626ad (patch)
tree8d9930863a6d129eb5b857ca7de14e28a0392af4 /libbuild2
parent5fb9f8b808b9d235d3e30db33f8a9630edac525f (diff)
Manually check values for NULL when using low-level function interface
Diffstat (limited to 'libbuild2')
-rw-r--r--libbuild2/cc/functions.cxx12
-rw-r--r--libbuild2/function.hxx3
2 files changed, 14 insertions, 1 deletions
diff --git a/libbuild2/cc/functions.cxx b/libbuild2/cc/functions.cxx
index bba8fbb..94900ee 100644
--- a/libbuild2/cc/functions.cxx
+++ b/libbuild2/cc/functions.cxx
@@ -61,6 +61,9 @@ namespace build2
// We can assume these are present due to function's types signature.
//
+ if (vs[0].null)
+ throw invalid_argument ("null value");
+
names& ts_ns (vs[0].as<names> ()); // <targets>
// In a somewhat hackish way strip the outer operation to match how we
@@ -137,6 +140,9 @@ namespace build2
// We can assume this is present due to function's types signature.
//
+ if (vs[0].null)
+ throw invalid_argument ("null value");
+
names& ts_ns (vs[0].as<names> ()); // <targets>
optional<linfo> li;
@@ -369,6 +375,9 @@ namespace build2
bool rel (true);
if (vs.size () > 2)
{
+ if (vs[2].null)
+ throw invalid_argument ("null value");
+
for (const name& f: vs[2].as<names> ())
{
string s (convert<string> (name (f)));
@@ -520,6 +529,9 @@ namespace build2
// We can assume the argument is present due to function's types
// signature.
//
+ if (vs[0].null)
+ throw invalid_argument ("null value");
+
names& r (vs[0].as<names> ());
m->deduplicate_export_libs (*bs,
vector<name> (r.begin (), r.end ()),
diff --git a/libbuild2/function.hxx b/libbuild2/function.hxx
index 81ece89..323ac41 100644
--- a/libbuild2/function.hxx
+++ b/libbuild2/function.hxx
@@ -952,7 +952,8 @@ namespace build2
// Low-level interface that can be used to pass additional data.
//
- // Note that the call to this function sidesteps the thunk.
+ // Note that the call to this function sidesteps the thunk. One notable
+ // consequence of this is that the values are not checked for NULL.
//
template <typename D, typename... A>
void