From: Thomas Otto Date: Sat, 25 Jan 2020 09:40:47 +0000 (+0100) Subject: Context: move arch_args X-Git-Tag: v4.0~613^2~14 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=68fef769210705cabe22b269a43738533ab73839;p=thirdparty%2Fccache.git Context: move arch_args --- diff --git a/src/ccache.cpp b/src/ccache.cpp index 7d4f5764e..3b01c1875 100644 --- a/src/ccache.cpp +++ b/src/ccache.cpp @@ -1927,9 +1927,9 @@ calculate_result_name(Context& ctx, } // Adding -arch to hash since cpp output is affected. - for (size_t i = 0; i < arch_args_size; ++i) { + for (size_t i = 0; i < ctx.args_info.arch_args_size; ++i) { hash_delimiter(hash, "-arch"); - hash_string(hash, arch_args[i]); + hash_string(hash, ctx.args_info.arch_args[i]); } struct digest* result_name = NULL; @@ -1998,16 +1998,17 @@ calculate_result_name(Context& ctx, } } else { assert(preprocessor_args); - if (arch_args_size == 0) { + if (ctx.args_info.arch_args_size == 0) { 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 < arch_args_size; ++i) { - args_add(preprocessor_args, arch_args[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", arch_args[i]); - if (i != arch_args_size - 1) { + 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) { free(result_name); result_name = NULL; } @@ -3684,11 +3685,6 @@ do_cache_compilation(Context& ctx, char* argv[]) failed(); // stats_update is called in cc_process_args. } - arch_args_size = ctx.args_info.arch_args_size; - for (size_t i = 0; i < ctx.args_info.arch_args_size; ++i) { - arch_args[i] = x_strdup(ctx.args_info.arch_args[i]); - } - MTR_END("main", "process_args"); if (ctx.config.depend_mode() diff --git a/src/legacy_globals.cpp b/src/legacy_globals.cpp index 468ed6d8e..51088f4a2 100644 --- a/src/legacy_globals.cpp +++ b/src/legacy_globals.cpp @@ -18,14 +18,6 @@ #include "legacy_globals.hpp" -// The original argument list. -extern struct args* orig_args; -struct args* orig_args = nullptr; - -// Array for storing -arch options. -size_t arch_args_size = 0; -char* arch_args[MAX_ARCH_ARGS] = {nullptr}; - // Name (represented as a struct digest) of the file containing the cached // result. struct digest* cached_result_name; diff --git a/src/legacy_globals.hpp b/src/legacy_globals.hpp index fb0bd27c0..bc51d2249 100644 --- a/src/legacy_globals.hpp +++ b/src/legacy_globals.hpp @@ -30,10 +30,6 @@ extern unsigned lock_staleness_limit; -#define MAX_ARCH_ARGS 10 -extern size_t arch_args_size; -extern char* arch_args[MAX_ARCH_ARGS]; - extern struct digest* cached_result_name; extern char* cached_result_path;