return args;
}
+void args_free(ARGS *args)
+{
+ int i;
+ for (i = 0; i < args->argc; ++i) {
+ if (args->argv[i]) {
+ free(args->argv[i]);
+ }
+ }
+ free(args->argv);
+ free(args);
+}
void args_add(ARGS *args, const char *s)
{
* the conversion otherwise will happen twice.
*/
if (input_charset) {
- *preprocessor_args = args_init(stripped_args->argc,
- stripped_args->argv);
+ *preprocessor_args = args_init(stripped_args->argc, stripped_args->argv);
args_add(*preprocessor_args, input_charset);
+ if (compile_preprocessed_source_code) {
+ *compiler_args = stripped_args;
+ } else {
+ *compiler_args = args_init(stripped_args->argc, stripped_args->argv);
+ args_add(*compiler_args, input_charset);
+ args_free(stripped_args);
+ }
} else {
*preprocessor_args = stripped_args;
+ *compiler_args = stripped_args;
}
- *compiler_args = stripped_args;
}
static unsigned parse_sloppiness(char *p)
ARGS *args_init(int , char **);
+void args_free(ARGS *args);
void args_add(ARGS *args, const char *s);
void args_add_prefix(ARGS *args, const char *s);
void args_pop(ARGS *args, int n);
checkstat 'cache miss' 39
if [ -x /usr/bin/printf ]; then
- /usr/bin/printf 'char foo[] = "\xa3";\n' >cp1250.c
- if CCACHE_DISABLE=1 $COMPILER -c -finput-charset=cp1250 cp1250.c >/dev/null 2>&1; then
+ /usr/bin/printf '#include <wchar.h>\nwchar_t foo[] = L"\xbf";\n' >latin1.c
+ if CCACHE_DISABLE=1 $COMPILER -c -finput-charset=latin1 latin1.c >/dev/null 2>&1; then
testname="-finput-charset"
- $CCACHE_COMPILE -c -finput-charset=cp1250 cp1250.c
+ CCACHE_CPP2=1 $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c
checkstat 'cache hit (preprocessed)' 10
checkstat 'cache miss' 40
- $CCACHE_COMPILE -c -finput-charset=cp1250 cp1250.c
+ $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c
checkstat 'cache hit (preprocessed)' 11
checkstat 'cache miss' 40
fi