From 4168cda2363f3d796d0b9922852e249aac3131ba Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 4 Dec 2020 08:39:35 +0200 Subject: Mark Buildfile functions as pure or impure --- libbuild2/functions-filesystem.cxx | 42 +++++++++++++++++++++++--------------- 1 file changed, 26 insertions(+), 16 deletions(-) (limited to 'libbuild2/functions-filesystem.cxx') 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 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 (move (start))); - }; + e += [](path pattern, optional start) + { + return path_search (pattern, start); + }; - f["path_search"] = [](names pattern, optional start) - { - return path_search (convert (move (pattern)), start); - }; + e += [](path pattern, names start) + { + return path_search (pattern, convert (move (start))); + }; + + e += [](names pattern, optional start) + { + return path_search (convert (move (pattern)), start); + }; + + e += [](names pattern, names start) + { + return path_search (convert (move (pattern)), + convert (move (start))); + }; + } - f["path_search"] = [](names pattern, names start) - { - return path_search (convert (move (pattern)), - convert (move (start))); - }; } } -- cgit v1.1