summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorADAM David Alan Martin <adam.martin@10gen.com>2017-04-20 16:20:03 -0400
committerADAM David Alan Martin <adam.martin@10gen.com>2017-04-20 16:20:13 -0400
commit4d6ac4793f023dfc7b393068ee14f6425fe7e3d2 (patch)
treefd6dd05575631356c6f5252b6462f1fec47ac6a5
parent5bdd2f49c02e5fe2812ccc6f21502799fa5a3268 (diff)
downloadmongo-4d6ac4793f023dfc7b393068ee14f6425fe7e3d2.tar.gz
SERVER-28691 Disable MSVC warning C4373
The MSVC compiler has warnings which alert users that the behavior of the compiler has changed. In the case of C4383, the compiler used to have non-conforming behavior to C++98. At some point this behavior was fixed. MongoDB's code base should not have any code which would be adversely affected by this change, as the code is also compiled on platforms where the native compiler is conformant to the standard in this point. Therefore it should be safe to disable this warning. The specific warning cautions that a derived class's inline definition of a virtual function will now override a parent's implementation, where formerly it would not. This would happen when the derived class's implementation specified at least one of the parameters `const` (in such a way that the actual signature of the function isn't changed). MSVC incorrectly determines that if there are two functions that differ only in a non-observable `const` specifier, then they would have different signatures, in many circumstances. This would mean that the compiler resorts to treating such functions as overloads. The compiler now behaves correctly for the case of override in a derived class; however, it issues a warning. The warning is irrelevant to us.
-rw-r--r--SConstruct8
1 files changed, 7 insertions, 1 deletions
diff --git a/SConstruct b/SConstruct
index 6ff444f2c43..3fe03bade85 100644
--- a/SConstruct
+++ b/SConstruct
@@ -1449,8 +1449,14 @@ elif env.TargetOSIs('windows'):
# on extremely old versions of MSVC (pre 2k5), default constructing an array member in a
# constructor's initialization list would not zero the array members "in some cases".
# since we don't target MSVC versions that old, this warning is safe to ignore.
+ # c4373
+ # Older versions of MSVC would fail to make a function in a derived class override a virtual
+ # function in the parent, when defined inline and at least one of the parameters is made const.
+ # The behavior is incorrect under the standard. MSVC is fixed now, and the warning exists
+ # merely to alert users who may have relied upon the older, non-compliant behavior. Our code
+ # should not have any problems with the older behavior, so we can just disable this warning.
env.Append( CCFLAGS=["/wd4355", "/wd4800", "/wd4267", "/wd4244",
- "/wd4290", "/wd4068", "/wd4351"] )
+ "/wd4290", "/wd4068", "/wd4351", "/wd4373"] )
# some warnings we should treat as errors:
# c4013