Correctly update "called for link" when linking a single object file

This fixes bug #7529.
This commit is contained in:
Joel Rosdahl 2010-06-24 20:59:34 +02:00
parent 11ec900409
commit b8982f4b88
2 changed files with 16 additions and 12 deletions

View File

@ -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);

View File

@ -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