summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2022-10-04 21:31:12 +0200
committerJoel Rosdahl <joel@rosdahl.net>2022-10-04 21:34:55 +0200
commitd097f32f671b07dccb1b36ebe0fcc4c435211508 (patch)
treeca0224db38bf212497d4da285c98019916fe4ca6
parent923e0b95a3833a17adf889a9a2abec3396b2524e (diff)
downloadccache-d097f32f671b07dccb1b36ebe0fcc4c435211508.tar.gz
feat: Improve handling of -frandom-seed and description of sloppiness
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.
-rw-r--r--doc/MANUAL.adoc5
-rw-r--r--src/ccache.cpp5
-rw-r--r--src/core/Sloppiness.hpp2
3 files changed, 5 insertions, 7 deletions
diff --git a/doc/MANUAL.adoc b/doc/MANUAL.adoc
index d979818e..fd67d169 100644
--- a/doc/MANUAL.adoc
+++ b/doc/MANUAL.adoc
@@ -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.
diff --git a/src/ccache.cpp b/src/ccache.cpp
index 29e90de7..b065f829 100644
--- a/src/ccache.cpp
+++ b/src/ccache.cpp
@@ -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 {};
}
diff --git a/src/core/Sloppiness.hpp b/src/core/Sloppiness.hpp
index a7aa08ee..ef45907d 100644
--- a/src/core/Sloppiness.hpp
+++ b/src/core/Sloppiness.hpp
@@ -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,
};