]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Correctly update "called for link" when linking a single object file
authorJoel Rosdahl <joel@rosdahl.net>
Thu, 24 Jun 2010 18:59:34 +0000 (20:59 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Thu, 24 Jun 2010 18:59:34 +0000 (20:59 +0200)
This fixes bug #7529.

ccache.c
test.sh

index 58bfdd5c31a2639fae20778927924ac033fa70b4..945cf1b0ed454ef74d80ccd57487997531bfebaa 100644 (file)
--- a/ccache.c
+++ b/ccache.c
@@ -1678,6 +1678,18 @@ static void process_args(int argc, char **argv, ARGS **preprocessor_args,
                failed();
        }
 
+       if (!found_c_opt) {
+               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);
+               }
+               failed();
+       }
+
        if (explicit_language && strcmp(explicit_language, "none") == 0) {
                explicit_language = NULL;
        }
@@ -1705,18 +1717,6 @@ static void process_args(int argc, char **argv, ARGS **preprocessor_args,
                i_extension = extension_for_language(p_language) + 1;
        }
 
-       if (!found_c_opt) {
-               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);
-               }
-               failed();
-       }
-
        /* don't try to second guess the compilers heuristics for stdout handling */
        if (output_obj && strcmp(output_obj, "-") == 0) {
                stats_update(STATS_OUTSTDOUT);
diff --git a/test.sh b/test.sh
index 5ea5cbf52238ac0c61a44a87c7c7e6b1fbf6d430..305174b14c2cc483f28ec6c8f0831205c1035dad 100755 (executable)
--- a/test.sh
+++ b/test.sh
@@ -169,6 +169,10 @@ base_tests() {
     $CCACHE_COMPILE test1.c -o test 2> /dev/null
     checkstat 'called for link' 1
 
+    testname="linkobj"
+    $CCACHE_COMPILE foo.o -o test 2> /dev/null
+    checkstat 'called for link' 2
+
     testname="multiple"
     $CCACHE_COMPILE -c test1.c test2.c
     checkstat 'multiple source files' 1