aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/script/script.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/script/script.cxx')
-rw-r--r--libbuild2/script/script.cxx28
1 files changed, 22 insertions, 6 deletions
diff --git a/libbuild2/script/script.cxx b/libbuild2/script/script.cxx
index db53418..298d71f 100644
--- a/libbuild2/script/script.cxx
+++ b/libbuild2/script/script.cxx
@@ -818,18 +818,34 @@ namespace build2
//
void
verify_environment_var_name (const string& name,
- const char* opt,
const char* prefix,
- const location& l)
+ const location& l,
+ const char* opt)
{
if (name.empty ())
- fail (l) << prefix << "empty value for option " << opt;
+ {
+ diag_record dr (fail (l));
+ dr << prefix << "empty ";
+
+ if (opt == nullptr)
+ dr << "variable name";
+ else
+ dr << "value for option " << opt;
+ }
if (name.find ('=') != string::npos)
- fail (l) << prefix << "invalid value '" << name << "' for option "
- << opt << ": contains '='";
- }
+ {
+ diag_record dr (fail (l));
+ dr << prefix << "invalid ";
+
+ if (opt == nullptr)
+ dr << "variable name '" << name << "'";
+ else
+ dr << "value '" << name << "' for option " << opt;
+ dr << ": contains '='";
+ }
+ }
void
verify_environment_var_assignment (const string& var,