aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2017-12-04 13:24:37 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2017-12-04 13:24:37 +0200
commit7c3eada02a3a22ff109ef0631e75586308ab2587 (patch)
tree3e8452d5f25cb3124508deaca9d14842a0ced0f4
parentad770fe609d1958a64e7364861296ac5407611d9 (diff)
Recognize empty cc.pattern
-rw-r--r--build2/cc/guess.cxx4
-rw-r--r--build2/cc/guess.hxx6
-rw-r--r--build2/cc/module.cxx2
-rw-r--r--build2/utility.cxx2
-rw-r--r--build2/utility.hxx4
5 files changed, 9 insertions, 9 deletions
diff --git a/build2/cc/guess.cxx b/build2/cc/guess.cxx
index 627283f..df7899b 100644
--- a/build2/cc/guess.cxx
+++ b/build2/cc/guess.cxx
@@ -1189,7 +1189,7 @@ namespace build2
}
path
- guess_default (lang xl, const string& c, const string* pat)
+ guess_default (lang xl, const string& c, const string& pat)
{
const char* s (nullptr);
@@ -1217,7 +1217,7 @@ namespace build2
}
}
- return path (apply_pattern (s, pat));
+ return path (apply_pattern (s, &pat));
}
}
}
diff --git a/build2/cc/guess.hxx b/build2/cc/guess.hxx
index e3a4d8c..86c9793 100644
--- a/build2/cc/guess.hxx
+++ b/build2/cc/guess.hxx
@@ -166,13 +166,13 @@ namespace build2
const strings* c_coptions,
const strings* x_coptions);
- // Given a language, toolchain id, and optionally a pattern, return an
- // appropriate default compiler path.
+ // Given a language, toolchain id, and optionally (empty) a pattern,
+ // return an appropriate default compiler path.
//
// For example, for (lang::cxx, gcc, *-4.9) we will get g++-4.9.
//
path
- guess_default (lang, const string& cid, const string* pattern);
+ guess_default (lang, const string& cid, const string& pattern);
}
}
diff --git a/build2/cc/module.cxx b/build2/cc/module.cxx
index d806583..196c2ce 100644
--- a/build2/cc/module.cxx
+++ b/build2/cc/module.cxx
@@ -88,7 +88,7 @@ namespace build2
path d (cc_loaded
? guess_default (x_lang,
cast<string> (rs["cc.id"]),
- cast_null<string> (rs["cc.pattern"]))
+ cast<string> (rs["cc.pattern"]))
: path (x_default));
// If this value was hinted, save it as commented out so that if the
diff --git a/build2/utility.cxx b/build2/utility.cxx
index 36f8a4d..4945514 100644
--- a/build2/utility.cxx
+++ b/build2/utility.cxx
@@ -452,7 +452,7 @@ namespace build2
string
apply_pattern (const char* s, const string* p)
{
- if (p == nullptr)
+ if (p == nullptr || p->empty ())
return s;
size_t i (p->find ('*'));
diff --git a/build2/utility.hxx b/build2/utility.hxx
index af26acd..7d1ffc6 100644
--- a/build2/utility.hxx
+++ b/build2/utility.hxx
@@ -469,8 +469,8 @@ namespace build2
const cstrings&,
bool = false);
- // Apply the specified substitution (stem) to a '*'-pattern. If pattern
- // is NULL, then return the stem itself. Assume the pattern is valid,
+ // Apply the specified substitution (stem) to a '*'-pattern. If pattern is
+ // NULL or empty, then return the stem itself. Assume the pattern is valid,
// i.e., contains a single '*' character.
//
string