]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
Remove now redundant resetting of config
authorJoel Rosdahl <joel@rosdahl.net>
Sun, 16 Feb 2020 18:40:58 +0000 (19:40 +0100)
committerJoel Rosdahl <joel@rosdahl.net>
Sun, 16 Feb 2020 20:19:31 +0000 (21:19 +0100)
Since the configuation no longer is global there is no need to reset the
unmodified Config object passed by cct_test_begin to cc_reset.

src/Config.cpp
src/Config.hpp
src/ccache.cpp
src/ccache.hpp
unittest/framework.cpp

index d3bead7d48a1b061b16380179bc2035ef4ef2a46..682efe9b2cc6e8c6c5d66ee253b41c11243e7f2b 100644 (file)
@@ -650,12 +650,6 @@ Config::set_value_in_file(const std::string& path,
   output.commit();
 }
 
-void
-Config::clear_and_reset()
-{
-  *this = Config();
-}
-
 void
 Config::visit_items(const ItemVisitor& item_visitor) const
 {
index ba16f10e43358687dcf8dec949e847b29a16128f..aea66db17b27fa7b9cf698b955d47c5a66fbf8b7 100644 (file)
@@ -20,6 +20,7 @@
 
 #include "system.hpp"
 
+#include "NonCopyable.hpp"
 #include "legacy_util.hpp"
 
 #include "third_party/fmt/core.h"
@@ -32,7 +33,7 @@
 
 class Config;
 
-class Config
+class Config : NonCopyable
 {
 public:
   Config() = default;
@@ -115,9 +116,6 @@ public:
                                 const std::string& key,
                                 const std::string& value);
 
-  // Clear the Config object and reset all values to defaults.
-  void clear_and_reset();
-
 private:
   std::string m_primary_config_path;
   std::string m_secondary_config_path;
@@ -164,10 +162,6 @@ private:
                 const nonstd::optional<std::string>& env_var_key,
                 bool negate,
                 const std::string& origin);
-
-  // These exist, but are private to be used in clear_and_reset()
-  Config(const Config&) = default;
-  Config& operator=(const Config&) = default;
 };
 
 inline const std::string&
index 9d5dedd31b32de89d005ece28b2cb73a3dac2f5f..da294b3b79da5b167dfc513f21460f9276f657ea 100644 (file)
@@ -3549,10 +3549,8 @@ free_and_nullify(T*& ptr)
 
 // Reset the global state. Used by the test suite.
 void
-cc_reset(Config& config)
+cc_reset()
 {
-  config.clear_and_reset();
-
   free_and_nullify(current_working_dir);
   free_and_nullify(included_pch_file);
   free_and_nullify(cached_result_name);
index fbe779bc5253dc146a643cc29e450bd0d78a9d29..8d0bf256970b258f28bbe6d1aed57ce4eda3abd1 100644 (file)
@@ -70,5 +70,5 @@ bool cc_process_args(Context& ctx,
                      struct args** preprocessor_args,
                      struct args** extra_args_to_hash,
                      struct args** compiler_args);
-void cc_reset(Config& config);
+void cc_reset();
 bool is_precompiled_header(const char* path);
index 04f21d2a1f1b0bcfff25ee69ffea02a0c8d3f236..298ec3cc239fdc641f2727276998e65485f8ed63 100644 (file)
@@ -129,7 +129,6 @@ cct_suite_end()
 void
 cct_test_begin(const char* name)
 {
-  Config config;
   ++total_tests;
   if (verbose) {
     printf("--- TEST: %s ---\n", name);
@@ -140,7 +139,6 @@ cct_test_begin(const char* name)
   current_test = name;
 
   x_setenv("CCACHE_CONFIG_PATH", "/dev/null");
-  cc_reset(config);
 }
 
 void