MSVC Warnings Notes
This chapter gives details on MSVC configuration regarding compiler warnings.
Overview
To accomodate our customers configurations, we followed a strict policy about warnings. Warnings are always treated as errors, so that flip must compile without generating any warnings.
To provide that, the following MSVS settings are used for the cl compiler :
WarningLevel: 4 |
WarnAsError: true |
AdditionalOptions: /Wall |
We do not advise using this last warning line. In practice, it will activate all possible warnings, and in particular warnings that MSVS turns off by default.
Those additional warnings contain informational warnings, but they will also trigger warnings in the system headers and in particular in the standard library system headers.
As far as MSVS 12.0 is concerned, we decided to silent those warnings at a global scope, rather than silenting them in the source code directly.
The next sections will list all disabled warnings and gives a quick note on the reason and impact on code.
Warning C4251
'identifier' : class 'type' needs to have dll-interface to be used by clients of class 'type2' |
This warning occurs as a false positive when exporting template code.
The regression tests (flip as a dll) ensure that flip is working correctly.
Warning C4265
'class' : class has virtual functions, but destructor is not virtual |
While this warning is important, it was disabled because it occurs in standard library headers such as <thread>, <mutex> or <condition_variable>.
We rely on the fact that the clang build will catch those problems.
Warning C4350
behavior change: 'member1' called instead of 'member2' |
This is treated as an informational warning.
Warning C4355
'this' : used in base member initializer list |
This is treated as an informational warning. Internally the framework used *this to allow a child object to have access to its parent, when decomposing a big class into smaller feature-orthogonal classes.
Warning C4365
'action' : conversion from 'type_1' to 'type_2', signed/unsigned mismatch |
While this warning is important, it was disabled because it provides a lot of false positive that the standard permits.
We rely on the fact that the clang build will catch those problems.
Warning C4435
'class1' : Object layout under /vd2 will change due to virtual base 'class2' |
This is treated as an informational warning.
Warning C4514
'function' : unreferenced inline function has been removed |
This is treated as an informational warning.
Warning C4702
unreachable code |
This is treated as an informational warning.
Warning C4571
Informational: catch(...) semantics changed since Visual C++ 7.1; |
structured exceptions (SEH) are no longer caught |
This is treated as an informational warning.
Warning C4640
'instance' : construction of local static object is not thread-safe |
The C++11 standard states (section 6.7):
Note: such a variable is initialized the first time control passes through its declaration; such a variable is considered initialized upon the completion of its initialization. [...] If control enters the declaration concurrently while the variable is being initialized, the concurrent execution shall wait for completion of the initialization.
So we ignore this warning. However for compatibility, the cases where this is used are for now marked as non-thread-safe, which is acceptable since this is occured when declaring models.
Warning C4710
'function' : function not inlined |
This is treated as an informational warning.
Warning C4820
'bytes' bytes padding added after construct 'member_name' |
This is treated as an informational warning.