commit:     3e49f724d090d65b739be1a67f6c40574337a2f7
Author:     Sam James <sam <AT> gentoo <DOT> org>
AuthorDate: Thu Sep 29 22:12:12 2022 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Thu Sep 29 22:35:57 2022 +0000
URL:        https://gitweb.gentoo.org/proj/gcc-config.git/commit/?id=3e49f724

gcc-config: set CCACHE_COMPILERCHECK to major GCC version

This avoids invalidating caches on every GCC snapshot bump for the same
major version (e.g. 12.2.1_p*), but also for 12.1 -> 12.2. It should be fine
to mix objects between such versions.

If needed, we can swap this to just stripping .1_p* but that's a bit
more awkward.

Bug: https://bugs.gentoo.org/872971
Signed-off-by: Sam James <sam <AT> gentoo.org>

 gcc-config | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/gcc-config b/gcc-config
index 44a3869..dfc01d0 100755
--- a/gcc-config
+++ b/gcc-config
@@ -747,6 +747,14 @@ switch_profile() {
                        echo "LDPATH=\"${MY_LDPATH}\"" >> "${envd}.tmp"
                fi
 
+               # Avoid ccache cache invalidations where possible between
+               # snapshots and minor GCC versions, bug #872971.
+               # For GCC 10, we changed the slotting from e.g. 10.4 -> 10.
+               local gcc_major_version="${CC_COMP_VERSION%%.*}"
+               if [[ "${gcc_major_version}" -ge 10 ]] ; then
+                       echo 
"CCACHE_COMPILERCHECK=\"string:gcc-${gcc_major_version}\"" >> "${envd}.tmp"
+               fi
+
                # Punt old files; maybe globs too much, but oh well
                # 'NATIVE' and '.NATIVE' were used by gcc-wrapper before Aug 
2018
                # and are not used as wrapper is removed.

Reply via email to