]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Add section markers, to the text file
authorAnders F Björklund <anders.f.bjorklund@gmail.com>
Sun, 12 Aug 2018 14:24:54 +0000 (16:24 +0200)
committerAnders F Björklund <anders.f.bjorklund@gmail.com>
Sun, 12 Aug 2018 14:24:54 +0000 (16:24 +0200)
src/ccache.c
src/ccache.h
src/hash.c

index 1c597ad147551e106432d5ae18529ee95d95f50f..6aac782c5fec1794eed2f2d5d5b43fa751be0561 100644 (file)
@@ -3390,11 +3390,13 @@ ccache(int argc, char *argv[])
        struct mdfour common_hash;
        hash_start(&common_hash);
        mdfour_identify(&common_hash, 'c');
+       hash_section(&common_hash, "COMMON");
        calculate_common_hash(preprocessor_args, &common_hash);
 
        // Try to find the hash using the manifest.
        struct mdfour direct_hash = common_hash;
        mdfour_identify(&direct_hash, 'd');
+       hash_section(&direct_hash, "DIRECT MODE");
        bool put_object_in_manifest = false;
        struct file_hash *object_hash = NULL;
        struct file_hash *object_hash_from_manifest = NULL;
@@ -3426,6 +3428,7 @@ ccache(int argc, char *argv[])
        // Find the hash using the preprocessed output. Also updates included_files.
        struct mdfour cpp_hash = common_hash;
        mdfour_identify(&cpp_hash, 'p');
+       hash_section(&cpp_hash, "PREPROCESSOR MODE");
        object_hash = calculate_object_hash(preprocessor_args, &cpp_hash, 0);
        if (!object_hash) {
                fatal("internal error: object hash from cpp returned NULL");
index a7730fea62fb70d6c2989dbaa43b103b3fda3f2d..a767ef323da9349171a1c030d3262f8eae4ad67e 100644 (file)
@@ -121,6 +121,7 @@ bool args_equal(struct args *args1, struct args *args2);
 void hash_debug_init(const char *bin, const char *txt);
 void hash_debug_end(void);
 void hash_start(struct mdfour *md);
+void hash_section(struct mdfour *md, const char *name);
 void hash_buffer(struct mdfour *md, const void *s, size_t len);
 char *hash_result(struct mdfour *md);
 void hash_result_as_bytes(struct mdfour *md, unsigned char *out);
index f49dfd7f8eb70365ce458e3bcf60bc122d59964a..4b3cdeea8d14d4c4dff7aeced8f95b25244b381a 100644 (file)
@@ -83,6 +83,15 @@ hash_start(struct mdfour *md)
        mdfour_begin(md);
 }
 
+void
+hash_section(struct mdfour *md, const char *name)
+{
+       hash_debug_buffer(md, "=== ", 4);
+       hash_debug_buffer(md, name, strlen(name));
+       hash_debug_buffer(md, " ===", 4);
+       hash_debug_buffer(md, "\n", 1);
+}
+
 void
 hash_buffer(struct mdfour *md, const void *s, size_t len)
 {