aboutsummaryrefslogtreecommitdiff
path: root/build2/rule
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-01-23 13:58:42 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-01-23 13:58:42 +0200
commit0d7c7f2c8bc044519b2936c9891d65701b7762bb (patch)
treeac7a8e6fa338353595589ea8b554486deba260a3 /build2/rule
parentc6a07db01dd75c9d39a54b8bcc01ce262245ad52 (diff)
Make rules const throughout
Diffstat (limited to 'build2/rule')
-rw-r--r--build2/rule12
1 files changed, 8 insertions, 4 deletions
diff --git a/build2/rule b/build2/rule
index 015cf1a..fbf3dcc 100644
--- a/build2/rule
+++ b/build2/rule
@@ -29,6 +29,10 @@ namespace build2
match_result (bool r, action a): result (r), recipe_action (a) {}
};
+ // Once a rule is registered (for a scope), it is treated as immutable. If
+ // you need to modify some state (e.g., counters or some such), then make
+ // sure it is MT-safe.
+ //
class rule
{
public:
@@ -50,7 +54,7 @@ namespace build2
virtual recipe
apply (action, target&) const override;
- static file_rule instance;
+ static const file_rule instance;
};
class alias_rule: public rule
@@ -62,7 +66,7 @@ namespace build2
virtual recipe
apply (action, target&) const override;
- static alias_rule instance;
+ static const alias_rule instance;
};
class fsdir_rule: public rule
@@ -80,7 +84,7 @@ namespace build2
static target_state
perform_clean (action, target&);
- static fsdir_rule instance;
+ static const fsdir_rule instance;
};
// Fallback rule that always matches and does nothing.
@@ -94,7 +98,7 @@ namespace build2
virtual recipe
apply (action, target&) const override {return noop_recipe;}
- static fallback_rule instance;
+ static const fallback_rule instance;
};
}