aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/cc
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-06-23 16:01:41 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-06-23 16:01:41 +0200
commit2ba8614d268290d3b18964d83bde1a785b66b2bb (patch)
treeb6f2fb480e0fb6598ef87a03f1a97754c07e5c94 /libbuild2/cc
parente872913956c05c6fe1826ff3f2a3e67953e31064 (diff)
Handle empty entries in GCC -print-search-dirs
Diffstat (limited to 'libbuild2/cc')
-rw-r--r--libbuild2/cc/gcc.cxx19
1 files changed, 12 insertions, 7 deletions
diff --git a/libbuild2/cc/gcc.cxx b/libbuild2/cc/gcc.cxx
index 2c844b6..7999c82 100644
--- a/libbuild2/cc/gcc.cxx
+++ b/libbuild2/cc/gcc.cxx
@@ -370,17 +370,22 @@ namespace build2
{
string ds (l, b, (e != string::npos ? e - b : e));
+ // Skip empty entries (sometimes found in random MinGW toolchains).
+ //
+ if (!ds.empty ())
+ {
#ifdef _WIN32
- if (path_traits::is_separator (ds[0]))
- add_current_drive (ds);
+ if (path_traits::is_separator (ds[0]))
+ add_current_drive (ds);
#endif
- d = dir_path (move (ds));
+ d = dir_path (move (ds));
- if (d.relative ())
- throw invalid_path (move (d).string ());
+ if (d.relative ())
+ throw invalid_path (move (d).string ());
- d.normalize ();
+ d.normalize ();
+ }
}
catch (const invalid_path& e)
{
@@ -388,7 +393,7 @@ namespace build2
<< args[0] << " -print-search-dirs output";
}
- if (find (r.begin (), r.end (), d) == r.end ())
+ if (!d.empty () && find (r.begin (), r.end (), d) == r.end ())
r.emplace_back (move (d));
if (e == string::npos)