Hi Yoav,

> I've dug a bit deeper, and found that when doing a diff between the output
> of the preprocessor the resolved include path is emitted as part of the
> output as a comment, in our case it's
>
> # 1 "a/a.h" 1
>
> There's a flag -P to the preprocessor to remove these comments.

It sounds good to not include names of included files in the hash, I think.

> [...]
> I think this should be default, do you think there's a safety issue with
> adding -P?

I see two problems:

1. -P is likely not supported by all compilers that can be used with ccache.
2. Using -P discards #line directives that may have been put there by code
generator tools, for instance yacc/bison. This would lead to incorrect file
name references when the compiler generates warnings when compiling the
preprocessed output.

However, it's possible to get more or less the same effect (not hashing
filenames) like this:

diff --git a/ccache.c b/ccache.c
index 23103ee..dd11927 100644
--- a/ccache.c
+++ b/ccache.c
@@ -863,7 +863,6 @@ process_preprocessed_file(struct mdfour *hash, const
char *path)
  has_absolute_include_headers = is_absolute_path(path);
  }
  path = make_relative_path(path);
- hash_string(hash, path);
  remember_include_file(path, hash, system);
  p = r;
  } else {

What do you think?

-- Joel
_______________________________________________
ccache mailing list
ccache@lists.samba.org
https://lists.samba.org/mailman/listinfo/ccache

Reply via email to