]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Add -c if missing when compiling a header file
authorJoel Rosdahl <joel@rosdahl.net>
Wed, 1 Feb 2012 21:12:29 +0000 (22:12 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Wed, 1 Feb 2012 21:12:29 +0000 (22:12 +0100)
This is to please g++ 4.1.

ccache.c
test.sh

index d89c076d1ed52df9f020c4e8c493d2557fa902cb..25f206fd50992db906d79405334b6ee523cb1ec4 100644 (file)
--- 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 5f33a6711e12fe85bcbbdc2b677ea3b89767c7cf..eb32b9d00f47fdc9af3a7096012d505d44a18093 100755 (executable)
--- 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