/* we must have -c */
if (str_eq(argv[i], "-c")) {
- args_add(stripped_args, argv[i]);
found_c_opt = true;
continue;
}
*compiler_args = args_copy(*preprocessor_args);
}
+ if (found_c_opt) {
+ args_add(*compiler_args, "-c");
+ }
+
/*
* Only pass dependency arguments to the preprocesor since Intel's C++
* compiler doesn't produce a correct .d file when compiling preprocessed
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
TEST(dependency_flags_should_only_be_sent_to_the_preprocessor)
{
#define CMD \
- "cc -c -MD -MMD -MP -MF foo.d -MT mt1 -MT mt2 -MQ mq1 -MQ mq2" \
+ "cc -MD -MMD -MP -MF foo.d -MT mt1 -MT mt2 -MQ mq1 -MQ mq2" \
" -Wp,-MD,wpmd -Wp,-MMD,wpmmd"
- struct args *orig = args_init_from_string(CMD " foo.c -o foo.o");
+ struct args *orig = args_init_from_string(CMD " -c foo.c -o foo.o");
struct args *exp_cpp = args_init_from_string(CMD);
#undef CMD
struct args *exp_cc = args_init_from_string("cc -c");
struct args *orig = args_init_from_string(
"cc -c -MMD -MFfoo.d -MTmt -MQmq foo.c -o foo.o");
struct args *exp_cpp = args_init_from_string(
- "cc -c -MMD -MFfoo.d -MTmt -MQmq");
+ "cc -MMD -MFfoo.d -MTmt -MQmq");
struct args *exp_cc = args_init_from_string("cc -c");
struct args *act_cpp = NULL, *act_cc = NULL;
create_file("foo.c", "");