// Files referenced by -fsanitize-blacklist options.
std::vector<std::string> sanitize_blacklists;
- // Array for storing -arch options.
- static constexpr int max_arch_args = 10;
- size_t arch_args_size = 0;
- char* arch_args[max_arch_args] = {nullptr};
+ // Architectures from -arch options.
+ std::vector<std::string> arch_args;
// Relocating debuginfo in the format old=new.
char** debug_prefix_maps = nullptr;
// Handle -arch options.
if (str_eq(argv[i], "-arch")) {
- if (args_info.arch_args_size == ArgsInfo::max_arch_args - 1) {
- cc_log("Too many -arch compiler options; ccache supports at most %d",
- ArgsInfo::max_arch_args);
- return STATS_UNSUPPORTED_OPTION;
- }
-
++i;
- args_info.arch_args[args_info.arch_args_size] =
- x_strdup(argv[i]); // It will leak.
- ++args_info.arch_args_size;
- if (args_info.arch_args_size == 2) {
+ args_info.arch_args.emplace_back(argv[i]);
+ if (args_info.arch_args.size() == 2) {
config.set_run_second_cpp(true);
}
return nullopt;
args_add(*compiler_args, "-dc");
}
- for (size_t i = 0; i < args_info.arch_args_size; ++i) {
+ for (const auto& arch : args_info.arch_args) {
args_add(*compiler_args, "-arch");
- args_add(*compiler_args, args_info.arch_args[i]);
+ args_add(*compiler_args, arch);
}
*preprocessor_args = args_copy(state.common_args);
}
// Adding -arch to hash since cpp output is affected.
- for (size_t i = 0; i < ctx.args_info.arch_args_size; ++i) {
+ for (const auto& arch : ctx.args_info.arch_args) {
hash_delimiter(hash, "-arch");
- hash_string(hash, ctx.args_info.arch_args[i]);
+ hash_string(hash, arch);
}
struct digest* result_name = nullptr;
cc_log("Did not find result name in manifest");
}
} else {
- if (ctx.args_info.arch_args_size == 0) {
+ if (ctx.args_info.arch_args.empty()) {
result_name = get_result_name_from_cpp(ctx, preprocessor_args, hash);
cc_log("Got result name from preprocessor");
} else {
args_add(preprocessor_args, "-arch");
- for (size_t i = 0; i < ctx.args_info.arch_args_size; ++i) {
+ for (size_t i = 0; i < ctx.args_info.arch_args.size(); ++i) {
args_add(preprocessor_args, ctx.args_info.arch_args[i]);
result_name = get_result_name_from_cpp(ctx, preprocessor_args, hash);
cc_log("Got result name from preprocessor with -arch %s",
- ctx.args_info.arch_args[i]);
- if (i != ctx.args_info.arch_args_size - 1) {
+ ctx.args_info.arch_args[i].c_str());
+ if (i != ctx.args_info.arch_args.size() - 1) {
free(result_name);
result_name = nullptr;
}