diff options
Diffstat (limited to 'libbuild2')
-rw-r--r-- | libbuild2/parser.cxx | 37 |
1 files changed, 29 insertions, 8 deletions
diff --git a/libbuild2/parser.cxx b/libbuild2/parser.cxx index 64652d7..578d3dd 100644 --- a/libbuild2/parser.cxx +++ b/libbuild2/parser.cxx @@ -7258,7 +7258,9 @@ namespace build2 (root_ != nullptr && root_->root_extra != nullptr && m.to_directory () && - exists (d.sp / m / root_->root_extra->buildignore_file))) + exists (m.relative () + ? d.sp / m / root_->root_extra->buildignore_file + : m / root_->root_extra->buildignore_file))) return !interm; // Note that we have to make copies of the extension since there will @@ -7314,9 +7316,11 @@ namespace build2 return true; }); + path pat (move (p)); + try { - path_search (path (move (p)), + path_search (pat, process, *sp, path_match_flags::follow_symlinks, @@ -7324,7 +7328,8 @@ namespace build2 } catch (const system_error& e) { - fail (l) << "unable to scan " << *sp << ": " << e; + fail (l) << "unable to scan for '" + << (pat.relative () ? *sp / pat : pat) << "': " << e; } }; @@ -7571,7 +7576,8 @@ namespace build2 // are going to ask parse_names() to detect for us if the first name is // a pattern. And if it is, to refrain from adding pair/dir/type (note: // for the pattern inclusions and exclusions the name's type member will - // be set to "+" and "-", respectively). + // be set to "+" and "-", respectively, and will later be cleared by + // expand_name_pattern()). // optional<const target_type*> pat_tt ( parse_names ( @@ -8317,9 +8323,12 @@ namespace build2 // Note that for a pattern inclusion group (see above) we make sure // that the resulting patterns are simple names, passing NULL as the - // directory path (see the parse_names_trailer::parse() lambda + // directory path (the names' type members will still be set to "+" + // thought; see the parse_names_trailer::parse() lambda // implementation for details). // + assert (!pinc || (tp1 != nullptr && *tp1 == "+")); + count = parse_names_trailer ( t, tt, ns, @@ -8329,13 +8338,25 @@ namespace build2 *pp1, (!pinc ? dp1 : nullptr), tp1, cross); - // If empty group or empty name, then this is not a pattern - // inclusion group. + // If empty group, then this is not a pattern inclusion group. // if (pinc) { - if (count != 0 && (count > 1 || !ns.back ().empty ())) + if (count != 0) + { + // Note that we can never end up with the empty name here. For + // example, for the below constructs the above + // parse_names_trailer() call would fail with the 'typed empty + // name' error, since the empty name's type will be set to "+" + // (see above for details): + // + // foo/{hxx cxx}{+{}} + // foo/{+{}} + // + assert (count > 1 || !ns.back ().empty ()); + pattern_detected (ttp); + } ppat = pinc = false; } |