mirror of
https://github.com/ziglang/zig.git
synced 2026-02-21 16:54:52 +00:00
cache_add_dep_file: handle ErrorFileNotFound specially
This commit is contained in:
parent
f3db3b3c13
commit
7330a6102f
@ -470,6 +470,11 @@ Error cache_add_dep_file(CacheHash *ch, Buf *dep_file_path, bool verbose) {
|
||||
Error err;
|
||||
Buf *contents = buf_alloc();
|
||||
if ((err = os_fetch_file_path(dep_file_path, contents))) {
|
||||
if (err == ErrorFileNotFound)
|
||||
return err;
|
||||
if (verbose) {
|
||||
fprintf(stderr, "unable to read .d file: %s\n", err_str(err));
|
||||
}
|
||||
return ErrorReadingDepFile;
|
||||
}
|
||||
SplitIterator it = memSplit(buf_to_slice(contents), str("\r\n"));
|
||||
|
||||
@ -8732,12 +8732,14 @@ static void gen_c_object(CodeGen *g, Buf *self_exe_path, CFile *c_file) {
|
||||
if ((err = cache_add_dep_file(cache_hash, out_dep_path, true))) {
|
||||
// Don't treat the absence of the .d file as a fatal error, the
|
||||
// compiler may not produce one eg. when compiling .s files
|
||||
if (err != ErrorReadingDepFile) {
|
||||
if (err != ErrorFileNotFound) {
|
||||
fprintf(stderr, "Failed to add C source dependencies to cache: %s\n", err_str(err));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
os_delete_file(out_dep_path);
|
||||
if (err != ErrorFileNotFound) {
|
||||
os_delete_file(out_dep_path);
|
||||
}
|
||||
|
||||
if ((err = cache_final(cache_hash, &digest))) {
|
||||
fprintf(stderr, "Unable to finalize cache hash: %s\n", err_str(err));
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user