summaryrefslogtreecommitdiff
path: root/SConstruct
diff options
context:
space:
mode:
authorJosef Ahmad <josef.ahmad@mongodb.com>2022-09-15 06:14:58 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2022-09-19 22:58:45 +0000
commit6ed754b0f4b4eb29c74d5b942e1b7ee005e91ed6 (patch)
treebe915e11c3db0a6042bc4749924e8980a27e6eef /SConstruct
parentcfe4fe45d31644ff6bfda613169245c7f9a7e2e9 (diff)
downloadmongo-6ed754b0f4b4eb29c74d5b942e1b7ee005e91ed6.tar.gz
SERVER-69611 Set the -ffp-contract=off compiler option by default
(cherry picked from commit d8901a2835d3f464d394631d85dc7aa9493fc095)
Diffstat (limited to 'SConstruct')
-rwxr-xr-xSConstruct9
1 files changed, 9 insertions, 0 deletions
diff --git a/SConstruct b/SConstruct
index 6478ce68460..f1479a8890b 100755
--- a/SConstruct
+++ b/SConstruct
@@ -1837,6 +1837,15 @@ if debugBuild:
else:
env.AppendUnique( CPPDEFINES=[ 'NDEBUG' ] )
+# Disable floating-point contractions such as forming of fused multiply-add operations.
+if env.ToolchainIs('clang', 'gcc'):
+ env.Append(CCFLAGS=["-ffp-contract=off"])
+else:
+ # msvc defaults to /fp:precise. Visual Studio 2022 does not emit floating-point contractions
+ # with /fp:precise, but previous versions can. Disable contractions altogether by using
+ # /fp:strict.
+ env.Append(CCFLAGS=["/fp:strict"])
+
if env.TargetOSIs('linux'):
env.Append( LIBS=["m"] )
if not env.TargetOSIs('android'):