From 5cc1bebc467fdc5b965628f0ca2c47ecdafeea2d Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Tue, 7 Jan 2003 06:39:37 +0100 Subject: [PATCH] added CCACHE_HASHDIR option updated ready for 2.0 release --- ccache.1 | 11 +++++++++++ ccache.h | 1 + ccache.yo | 10 ++++++++++ util.c | 18 ++++++++++++++++++ web/ccache-man.html | 9 +++++++++ web/index.html | 18 ++++++++++++++++-- 6 files changed, 65 insertions(+), 2 deletions(-) diff --git a/ccache.1 b/ccache.1 index aafb3bba0..8bada69e1 100644 --- a/ccache.1 +++ b/ccache.1 @@ -179,6 +179,17 @@ This forces ccache to not use any cached results, even if it finds them\&. New results are still cached, but existing cache entries are ignored\&. .IP +.IP "\fBCCACHE_HASHDIR\fP" +This tells ccache to hash the current working +directory when calculating the hash that is used to distinguish two +compiles\&. This prevents a problem with the storage of the current +working directory in the debug info of a object file, which can lead +ccache to give a cached object file that has the working directory in +the debug info set incorrectly\&. This option is off by default as the +incorrect setting of this debug info rarely causes problems\&. If you +strike problems with gdb not using the correct directory then enable +this option\&. +.IP .IP "\fBCCACHE_UNIFY\fP" If you set the environment variable CCACHE_UNIFY then ccache will use the C/C++ unifier when hashing the pre-processor diff --git a/ccache.h b/ccache.h index f90505d05..1fbd9a2f7 100644 --- a/ccache.h +++ b/ccache.h @@ -89,6 +89,7 @@ int lock_fd(int fd); size_t file_size(struct stat *st); int safe_open(const char *fname); char *x_realpath(const char *path); +char *gnu_getcwd(void); void stats_update(enum stats stat); void stats_zero(void); diff --git a/ccache.yo b/ccache.yo index 7b1731e6a..e9ee74999 100644 --- a/ccache.yo +++ b/ccache.yo @@ -152,6 +152,16 @@ dit(bf(CCACHE_RECACHE)) This forces ccache to not use any cached results, even if it finds them. New results are still cached, but existing cache entries are ignored. +dit(bf(CCACHE_HASHDIR)) This tells ccache to hash the current working +directory when calculating the hash that is used to distinguish two +compiles. This prevents a problem with the storage of the current +working directory in the debug info of a object file, which can lead +ccache to give a cached object file that has the working directory in +the debug info set incorrectly. This option is off by default as the +incorrect setting of this debug info rarely causes problems. If you +strike problems with gdb not using the correct directory then enable +this option. + dit(bf(CCACHE_UNIFY)) If you set the environment variable CCACHE_UNIFY then ccache will use the C/C++ unifier when hashing the pre-processor output if -g is not used in the compile. The unifier is slower than a diff --git a/util.c b/util.c index c42a79287..7e4c240b1 100644 --- a/util.c +++ b/util.c @@ -343,3 +343,21 @@ char *x_realpath(const char *path) free(ret); return NULL; } + +/* a getcwd that will returns an allocated buffer */ +char *gnu_getcwd(void) +{ + unsigned size = 128; + + while (1) { + char *buffer = (char *)x_malloc(size); + if (getcwd(buffer, size) == buffer) { + return buffer; + } + free(buffer); + if (errno != ERANGE) { + return 0; + } + size *= 2; + } +} diff --git a/web/ccache-man.html b/web/ccache-man.html index 27d73d7c0..c80dea509 100644 --- a/web/ccache-man.html +++ b/web/ccache-man.html @@ -143,6 +143,15 @@ the same compilation in a different directory.

CCACHE_RECACHE
This forces ccache to not use any cached results, even if it finds them. New results are still cached, but existing cache entries are ignored. +

CCACHE_HASHDIR
This tells ccache to hash the current working +directory when calculating the hash that is used to distinguish two +compiles. This prevents a problem with the storage of the current +working directory in the debug info of a object file, which can lead +ccache to give a cached object file that has the working directory in +the debug info set incorrectly. This option is off by default as the +incorrect setting of this debug info rarely causes problems. If you +strike problems with gdb not using the correct directory then enable +this option.

CCACHE_UNIFY
If you set the environment variable CCACHE_UNIFY then ccache will use the C/C++ unifier when hashing the pre-processor output if -g is not used in the compile. The unifier is slower than a diff --git a/web/index.html b/web/index.html index f6d9a74fe..6c76ee22e 100644 --- a/web/index.html +++ b/web/index.html @@ -18,12 +18,26 @@ in C with more features and better performance.

Latest release

-The latest release is ccache 1.9. This release adds: +The latest release is ccache 2.0. This release adds: +See the manual page for details +on the new options. + You can get this release from the download directory

Why bother?

-- 2.47.3