aboutsummaryrefslogtreecommitdiff
path: root/build2/context.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'build2/context.cxx')
-rw-r--r--build2/context.cxx9
1 files changed, 7 insertions, 2 deletions
diff --git a/build2/context.cxx b/build2/context.cxx
index e08fb52..f756bfc 100644
--- a/build2/context.cxx
+++ b/build2/context.cxx
@@ -97,7 +97,12 @@ namespace build2
{
istringstream is (s);
is.exceptions (istringstream::failbit | istringstream::badbit);
- lexer l (is, path ("<cmdline>"));
+
+ // Similar to buildspec we do "effective escaping" and only for ['"\$(]
+ // (basically what's necessary inside a double-quoted literal plus the
+ // single quote).
+ //
+ lexer l (is, path ("<cmdline>"), "\'\"\\$(");
// The first token should be a name, either the variable name or the
// scope qualification.
@@ -143,7 +148,7 @@ namespace build2
if (c == '!' && !dir.empty ())
fail << "scope-qualified global override of variable " << n;
- variable_visibility v (c == '/' ? variable_visibility::scope :
+ variable_visibility v (c == '/' ? variable_visibility::scope :
c == '%' ? variable_visibility::project :
variable_visibility::normal);