/* the main ccache driver function */
static void
-ccache(int argc, char *argv[])
+ccache(char *argv[])
{
bool put_object_in_manifest = false;
struct file_hash *object_hash;
/* Arguments to send to the real compiler. */
struct args *compiler_args;
- find_compiler(argc, argv);
setup_uncached_err();
- if (getenv("CCACHE_DISABLE")) {
- cc_log("ccache is disabled");
- failed();
- }
-
if (!getenv("CCACHE_READONLY")) {
if (create_cachedirtag(cache_dir) != 0) {
cc_log("failed to create %s/CACHEDIR.TAG (%s)\n",
}
free(program_name);
+ /* find_compiler sets up orig_args, needed by failed(), so do it early. */
+ find_compiler(argc, argv);
+
+ if (getenv("CCACHE_DISABLE")) {
+ cc_log("ccache is disabled");
+ failed();
+ }
+
check_cache_dir();
temp_dir = getenv("CCACHE_TEMPDIR");
exit(1);
}
- ccache(argc, argv);
+ ccache(argv);
return 1;
}
checkstat 'no input file' 1
testname="CCACHE_DISABLE"
+ mv $CCACHE_DIR $CCACHE_DIR.saved
CCACHE_DISABLE=1 $CCACHE_COMPILE -c test1.c 2> /dev/null
+ if [ -d $CCACHE_DIR ]; then
+ test_failed "$CCACHE_DIR created dispite CCACHE_DISABLE being set"
+ fi
+ mv $CCACHE_DIR.saved $CCACHE_DIR
checkstat 'cache hit (preprocessed)' 3
$CCACHE_COMPILE -c test1.c
checkstat 'cache hit (preprocessed)' 4