Skip to content

Commit

Permalink
Merge pull request #563 from sifive/ignore-enumeration-failures
Browse files Browse the repository at this point in the history
Ignore enumeration failures
  • Loading branch information
terpstra committed Feb 19, 2021
1 parent eb5a00a commit c6bcea8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
18 changes: 13 additions & 5 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -332,9 +332,13 @@ int main(int argc, char **argv) {

if (noparse) return 0;

bool ok = true;
auto wakefiles = find_all_wakefiles(ok, workspace, verbose);
if (!ok) std::cerr << "Workspace wake file enumeration failed" << std::endl;
bool enumok = true;
auto wakefiles = find_all_wakefiles(enumok, workspace, verbose);
if (!enumok) {
if (verbose) std::cerr << "Workspace wake file enumeration failed" << std::endl;
// Try to run the build anyway; if wake files are missing, it will fail later
// The unreadable location might be irrelevant to the build
}

uint64_t target_hash = 0;
if (hash) {
Expand All @@ -349,14 +353,18 @@ int main(int argc, char **argv) {
Profile tree;
Runtime runtime(profile ? &tree : nullptr, profileh, heap_factor, target_hash);
bool sources = find_all_sources(runtime, workspace);
if (!sources) std::cerr << "Source file enumeration failed" << std::endl;
ok &= sources;
if (!sources) {
if (verbose) std::cerr << "Source file enumeration failed" << std::endl;
// Try to run the build anyway; if sources are missing, it will fail later
// The unreadable location might be irrelevant to the build
}

// Select a default package
int longest_src_dir = -1;
bool warned_conflict = false;

// Read all wake build files
bool ok = true;
Scope::debug = debug;
std::unique_ptr<Top> top(new Top);
for (auto &i : wakefiles) {
Expand Down
6 changes: 3 additions & 3 deletions src/sources.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -569,8 +569,8 @@ std::vector<std::string> find_all_wakefiles(bool &ok, bool workspace, bool verbo
std::string rel_libdir = make_relative(get_cwd(), make_canonical(abs_libdir));

std::vector<std::string> acc;
ok = ok && !push_files(acc, rel_libdir, exp, 0);
if (workspace) ok = ok && !push_files(acc, ".", exp, 0);
if (push_files(acc, rel_libdir, exp, 0)) ok = false;
if (workspace && push_files(acc, ".", exp, 0)) ok = false;

// make the output distinct
std::sort(acc.begin(), acc.end());
Expand Down Expand Up @@ -669,7 +669,7 @@ static PRIMFN(prim_files) {

std::vector<std::string> match;
bool fail = push_files(match, root, *arg1->exp, skip);
if (fail) match.clear(); // !!! There's a hole in the API
(void)fail; // !!! There's a hole in the API

size_t need = reserve_list(match.size());
for (auto &x : match) need += String::reserve(x.size());
Expand Down

0 comments on commit c6bcea8

Please sign in to comment.