]> git.ipfire.org Git - thirdparty/ccache.git/commitdiff
feat: Improve handling of -frandom-seed and description of sloppiness
authorJoel Rosdahl <joel@rosdahl.net>
Tue, 4 Oct 2022 19:31:12 +0000 (21:31 +0200)
committerJoel Rosdahl <joel@rosdahl.net>
Tue, 4 Oct 2022 19:34:55 +0000 (21:34 +0200)
I should not be necessary to distinguish between existence and
non-existence of -frandom-seed if random_seed sloppiness is requested,
so don't hash the "-frandom-seed=" part either.

doc/MANUAL.adoc
src/ccache.cpp
src/core/Sloppiness.hpp

index d979818e0c63c91929ab5090b88f13ed32fb1ae3..fd67d16937e4aa48267d2127b6122b56479b91c9 100644 (file)
@@ -1003,8 +1003,9 @@ preprocessing first.
     Ignore `+__DATE__+`, `+__TIME__+` and `+__TIMESTAMP__+` being present in the
     source code.
 *random_seed*::
-    By default, ccache will respect argument changes with `-frandom-seed`. This
-    sloppiness will allow cache hits even if the seed value is different.
+    Ignore the `-frandom-seed` option and its arguments when computing the input
+    hash. This is useful if your build system generates different seeds between
+    builds and you are OK with reusing cached results.
 --
 +
 See the discussion under _<<Troubleshooting>>_ for more information.
index 29e90de7b1e8b9ae6685a00f37ed06b2ed515aca..b065f829a10d401e957b7afe074e463a6b28d87c 100644 (file)
@@ -1555,12 +1555,9 @@ hash_argument(const Context& ctx,
     return {};
   }
 
-  // If we treat random_seed sloppily we ignore the argument when
-  // hashing.
   if (util::starts_with(args[i], "-frandom-seed=")
       && ctx.config.sloppiness().is_enabled(core::Sloppy::random_seed)) {
-    hash.hash_delimiter("arg");
-    hash.hash("-frandom-seed=");
+    LOG("Ignoring {} since random_seed sloppiness is requested", args[i]);
     return {};
   }
 
index a7aa08eead6ae880d3c5e7c9290aa13c3d25b1cf..ef45907dd87258ae28dc6e0a8c5d5c6c7ecbaae1 100644 (file)
@@ -49,7 +49,7 @@ enum class Sloppy : uint32_t {
   ivfsoverlay = 1U << 10,
   // Allow us to include incorrect working directory in .gcno files.
   gcno_cwd = 1U << 11,
-  // Ignore changes in -frandom-seed
+  // Ignore -frandom-seed=*string*.
   random_seed = 1U << 12,
 };