]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Add comment about why SLOPPY_INCLUDE_FILE_[CM]TIME compares using >=t
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>
Thu, 15 Jun 2017 12:49:28 +0000 (14:49 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Thu, 15 Jun 2017 18:29:25 +0000 (20:29 +0200)
ccache.c

index 01e18218df3ea4db76949669af9ca3b1dfced074..4d7d8052cc76e3ec31cf63560809995723e5d934 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -560,12 +560,16 @@ remember_include_file(char *path, struct mdfour *cpp_hash, bool system)
                }
        }
 
+       // The comparison using >= is intentional, due to a possible race
+       // between starting compilation and writing the include file.
+       // See https://github.com/ccache/ccache/blob/master/MANUAL.txt
        if (!(conf->sloppiness & SLOPPY_INCLUDE_FILE_MTIME)
            && st.st_mtime >= time_of_compilation) {
                cc_log("Include file %s too new", path);
                goto failure;
        }
 
+       // The same >= logic as above applies to the change time of the file.
        if (!(conf->sloppiness & SLOPPY_INCLUDE_FILE_CTIME)
            && st.st_ctime >= time_of_compilation) {
                cc_log("Include file %s ctime too new", path);