0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-11-29 16:47:28 +01:00

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.
This commit is contained in:
Ryan Egesdahl 2020-05-27 17:50:32 -07:00 committed by Evergreen Agent
parent 09eb59d64f
commit 1248eaec6e

View File

@ -95,6 +95,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