authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-05-13 12:15:55-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-05-13 12:15:55-04:00
log7330a6102f7a8108ee364b9de79efe4a70049167
tree5b695c1cc8f10d1d153411d5ee6ff0ddf7e56dc2
parentf3db3b3c1319e2e86bf5eabd2c2eaef58e4dd783
signature Commit is signed but in an unrecognized format.

cache_add_dep_file: handle ErrorFileNotFound specially


2 files changed, 9 insertions(+), 2 deletions(-)

src/cache_hash.cpp+5
......@@ -470,6 +470,11 @@ Error cache_add_dep_file(CacheHash *ch, Buf *dep_file_path, bool verbose) {
470470 Error err;
471471 Buf *contents = buf_alloc();
472472 if ((err = os_fetch_file_path(dep_file_path, contents))) {
473 if (err == ErrorFileNotFound)
474 return err;
475 if (verbose) {
476 fprintf(stderr, "unable to read .d file: %s\n", err_str(err));
477 }
473478 return ErrorReadingDepFile;
474479 }
475480 SplitIterator it = memSplit(buf_to_slice(contents), str("\r\n"));
src/codegen.cpp+4-2
......@@ -8732,12 +8732,14 @@ static void gen_c_object(CodeGen *g, Buf *self_exe_path, CFile *c_file) {
87328732 if ((err = cache_add_dep_file(cache_hash, out_dep_path, true))) {
87338733 // Don't treat the absence of the .d file as a fatal error, the
87348734 // compiler may not produce one eg. when compiling .s files
8735 if (err != ErrorReadingDepFile) {
8735 if (err != ErrorFileNotFound) {
87368736 fprintf(stderr, "Failed to add C source dependencies to cache: %s\n", err_str(err));
87378737 exit(1);
87388738 }
87398739 }
8740 os_delete_file(out_dep_path);
8740 if (err != ErrorFileNotFound) {
8741 os_delete_file(out_dep_path);
8742 }
87418743
87428744 if ((err = cache_final(cache_hash, &digest))) {
87438745 fprintf(stderr, "Unable to finalize cache hash: %s\n", err_str(err));