0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 09:32:32 +01:00

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.
This commit is contained in:
ADAM David Alan Martin 2017-04-20 16:20:03 -04:00
parent 5bdd2f49c0
commit 4d6ac4793f
No known key found for this signature in database
GPG Key ID: D860F95FD1BEEA08

View File

@ -1449,8 +1449,14 @@ elif env.TargetOSIs('windows'):
# on extremely old versions of MSVC (pre 2k5), default constructing an array member in a # 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". # 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. # 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", env.Append( CCFLAGS=["/wd4355", "/wd4800", "/wd4267", "/wd4244",
"/wd4290", "/wd4068", "/wd4351"] ) "/wd4290", "/wd4068", "/wd4351", "/wd4373"] )
# some warnings we should treat as errors: # some warnings we should treat as errors:
# c4013 # c4013