aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/functions-filesystem.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2020-12-04 08:39:35 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2020-12-04 08:39:35 +0200
commit4168cda2363f3d796d0b9922852e249aac3131ba (patch)
tree3e74f8926ad2efe57ac8ffbeb03a8585f285e618 /libbuild2/functions-filesystem.cxx
parent864d84abcf1579b81f54d8d3f79520137d81f629 (diff)
Mark Buildfile functions as pure or impure
Diffstat (limited to 'libbuild2/functions-filesystem.cxx')
-rw-r--r--libbuild2/functions-filesystem.cxx42
1 files changed, 26 insertions, 16 deletions
diff --git a/libbuild2/functions-filesystem.cxx b/libbuild2/functions-filesystem.cxx
index 54c5315..696b1cf 100644
--- a/libbuild2/functions-filesystem.cxx
+++ b/libbuild2/functions-filesystem.cxx
@@ -78,6 +78,9 @@ namespace build2
void
filesystem_functions (function_map& m)
{
+ // @@ Maybe we should have the ability to mark the whole family as not
+ // pure?
+
function_family f (m, "filesystem");
// path_search
@@ -86,25 +89,32 @@ namespace build2
// absolute path, then the start directory is ignored (if present).
// Otherwise, the start directory must be specified and be absolute.
//
- f["path_search"] = [](path pattern, optional<dir_path> start)
+ // Note that this function is not pure.
+ //
{
- return path_search (pattern, start);
- };
+ auto e (f.insert ("path_search", false));
- f["path_search"] = [](path pattern, names start)
- {
- return path_search (pattern, convert<dir_path> (move (start)));
- };
+ e += [](path pattern, optional<dir_path> start)
+ {
+ return path_search (pattern, start);
+ };
- f["path_search"] = [](names pattern, optional<dir_path> start)
- {
- return path_search (convert<path> (move (pattern)), start);
- };
+ e += [](path pattern, names start)
+ {
+ return path_search (pattern, convert<dir_path> (move (start)));
+ };
+
+ e += [](names pattern, optional<dir_path> start)
+ {
+ return path_search (convert<path> (move (pattern)), start);
+ };
+
+ e += [](names pattern, names start)
+ {
+ return path_search (convert<path> (move (pattern)),
+ convert<dir_path> (move (start)));
+ };
+ }
- f["path_search"] = [](names pattern, names start)
- {
- return path_search (convert<path> (move (pattern)),
- convert<dir_path> (move (start)));
- };
}
}