summaryrefslogtreecommitdiff
path: root/site_scons
diff options
context:
space:
mode:
authorRyan Egesdahl <ryan.egesdahl@mongodb.com>2020-05-27 17:50:32 -0700
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2020-06-01 16:13:46 +0000
commitbe44b28afa8503ad0c88c5db9f3e08fef8a30c46 (patch)
tree83ebbe1fc8c25ef3f84d3ea95ed10d2bcde49f15 /site_scons
parent8890c183c33af19a179028bbf94c2d25ee357527 (diff)
downloadmongo-be44b28afa8503ad0c88c5db9f3e08fef8a30c46.tar.gz
SERVER-48289 Ignore unused compiler flags
Some compiler flags passed in from the environment can cause icecc to only build locally because the compiler gives an error saying the flag is not supported. It may also have been causing problems with using ccache in general. There may be other negative behaviors that we don't know of that haven't been reported yet. This wasn't a problem in the older Ninja build system, but it is in the newer one. (cherry picked from commit 1248eaec6e4d73484af9c2220ea9d22730ecbe44)
Diffstat (limited to 'site_scons')
-rw-r--r--site_scons/site_tools/ccache.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/site_scons/site_tools/ccache.py b/site_scons/site_tools/ccache.py
index 541998b2acb..13a49463c46 100644
--- a/site_scons/site_tools/ccache.py
+++ b/site_scons/site_tools/ccache.py
@@ -87,6 +87,15 @@ def generate(env):
if var.startswith("CCACHE_"):
env["ENV"][var] = host_value
+ # SERVER-48289: Adding roll-your-own CFLAGS and CXXFLAGS can cause some very "weird" issues
+ # with using icecc and ccache if they turn out not to be supported by the compiler. Rather
+ # than try to filter each and every flag someone might try for the ones we know don't
+ # work, we'll just let the compiler ignore them. A better approach might be to pre-filter
+ # flags coming in from the environment by passing them through the appropriate *IfSupported
+ # method, but that's a much larger effort.
+ if env.ToolchainIs("clang"):
+ env.AppendUnique(CCFLAGS=["-Qunused-arguments"])
+
# Record our found CCACHE_VERSION. Other tools that need to know
# about ccache (like iecc) should query this variable to determine
# if ccache is active. Looking at the CCACHE variable in the