From: Joel Rosdahl Date: Wed, 1 Feb 2012 21:12:29 +0000 (+0100) Subject: Add -c if missing when compiling a header file X-Git-Tag: v3.1.8~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4520fd7cb0bb01eea00b6fd57f40c174a0c4e6be;p=thirdparty%2Fccache.git Add -c if missing when compiling a header file This is to please g++ 4.1. --- diff --git a/ccache.c b/ccache.c index d89c076d1..25f206fd5 100644 --- a/ccache.c +++ b/ccache.c @@ -1639,17 +1639,21 @@ cc_process_args(struct args *orig_args, struct args **preprocessor_args, output_is_precompiled_header = actual_language && strstr(actual_language, "-header") != NULL; - if (!found_c_opt && !output_is_precompiled_header) { - cc_log("No -c option found"); - /* I find that having a separate statistic for autoconf tests is useful, - as they are the dominant form of "called for link" in many cases */ - if (strstr(input_file, "conftest.")) { - stats_update(STATS_CONFTEST); + if (!found_c_opt) { + if (output_is_precompiled_header) { + args_add(stripped_args, "-c"); } else { - stats_update(STATS_LINK); + cc_log("No -c option found"); + /* I find that having a separate statistic for autoconf tests is useful, + as they are the dominant form of "called for link" in many cases */ + if (strstr(input_file, "conftest.")) { + stats_update(STATS_CONFTEST); + } else { + stats_update(STATS_LINK); + } + result = false; + goto out; } - result = false; - goto out; } if (!actual_language) { diff --git a/test.sh b/test.sh index 5f33a6711..eb32b9d00 100755 --- a/test.sh +++ b/test.sh @@ -1686,7 +1686,7 @@ EOF fi testname="create .gch, no -c, -o" - $CCACHE -z >/dev/null + $CCACHE -Cz >/dev/null $CCACHE $COMPILER pch.h -o pch.gch checkstat 'cache hit (direct)' 0 checkstat 'cache hit (preprocessed)' 0