Some pragma warnings are not more needed for VS2015 compilation this will remove them.
Removing some specific code for older version than VS2015.
Forcing build to fail if compiling with VS older than VS2015.
Details
Check we did not enable not wanted warning by accident.
Diff Detail
- Repository
- rP 0 A.D. Public Repository
- Branch
- /ps/trunk
- Lint
Lint OK - Unit
No Unit Test Coverage - Build Status
Buildable 8140 Build 13255: Vulcan Build Jenkins Build 13254: arc lint + arc unit
Event Timeline
Successful build - Chance fights ever on the side of the prudent.
Link to build: https://jenkins.wildfiregames.com/job/differential/259/display/redirect
In D1262 have been added version check for warning C4351, which was not correct and because of that, warning have been enabled again for VS2013. I have no idea how VS2015 managed to not display this warning since version did not satisfy needed version check to disable this warning.
Successful build - Chance fights ever on the side of the prudent.
Link to build: https://jenkins.wildfiregames.com/job/differential/529/display/redirect
Not sure either why VS2015 doesn't get the error. Could you try to see what happens when the version check is removed? It doesn't make sense to add this new conditional as-is. The only meaningful patches would be, In my opinion, no conditional (the warning is silenced on all versions), or a conditional that keeps the old behavior for 2013 and introduces a change for the new version (that would be <= 1800).
Also, the typo was made twice in this file, for warning C4836 as well.
I'm removing the Accepted status while this is investigated.
So a bit of research and test builds as well.
https://docs.microsoft.com/en-us/previous-versions/1ywe7hcy(v=vs.140)
Looks like VS2013 uses older compiler for which is 4351 dangerous and can lead to unexpected behaviour, but for VS2015 it is safe by compiler.
One situation where the new behavior can result in unexpected behavior is when placement new is used to construct the object that has the array as a member, and the program depends on the contents that the memory (for the elements of the default initialized array) had before the call to placement new. In this case, the older compiler would have left the contents of memory unchanged, but the new behavior will cause default initialization of the array elements, overwriting the original contents in memory.
and
In previous versions of Visual C++, when an array was in a constructor's member initialization list, the elements of the array may not have been default initialized in some cases.
So to the builds without version guard.
VS2013,
not disabled c4351 -> a bunch of warnings
disabled c4351 -> no warning related to this
VS2015
not disabled c4351 -> no warning related to this
not disabled c4351 and building with Wall option -> no warning related to this
Looks like VS2015 stopped worried about 4351 warning so it now depends how long there will be game support for 2013. After that one drops, pragma warning for that can be removed.
Successful build - Chance fights ever on the side of the prudent.
Link to build: https://jenkins.wildfiregames.com/job/differential/973/
For future reference.
https://dev.to/yumetodo/list-of-mscver-and-mscfullver-8nd
Still don't know why but we have our own macro in source/lib/sysdep/compiler.h :
#ifdef _MSC_VER # define MSC_VERSION _MSC_VER #else # define MSC_VERSION 0 #endif
Removes checks introduced because we supported vs2013.
Removes dead code because of vs2015.
Makes build fail if compiling with older version than VS2015.
source/lib/precompiled.h | ||
---|---|---|
44 | might want to check != Vs2015 in case someone tries to build with something like vs2012 etc. |
Successful build - Chance fights ever on the side of the prudent.
Linter detected issues: Executing section Source... source/lib/sysdep/os/win/wposix/wtime.h | 1| /*·Copyright·(C)·2017·Wildfire·Games. | | [NORMAL] LicenseYearBear: | | License should have "2019" year instead of "2017" Executing section JS... Executing section cli...
Link to build: https://jenkins.wildfiregames.com/job/differential/1863/display/redirect
source/lib/precompiled.h | ||
---|---|---|
44 | vs2012 is 1700 so still works, and I actually cant exclude > 1900 because VS2017 |
source/lib/precompiled.h | ||
---|---|---|
44 | Maybe you could check the toolset version instead ? |
This is good for me! I think you can commit this just after I commit D2524.
It only needs a trivial rebase for LoaderThunks.h and I think you should rephrase the error message for the code that detects the minimal version of VS.
source/lib/precompiled.h | ||
---|---|---|
45 | I agree with this check, which will be useful and will be updated each time we drop support for a version. I think the best formulation of the error would be Visual Studio 2015 is the minimal supported version. |
Just for the record
_MSC_VER
source/collada/Decompose.cpp:#ifdef _MSC_VER source/lib/external_libraries/suppress_boost_warnings.h:#if _MSC_VER > 1800 source/lib/sysdep/compiler.h:#ifdef _MSC_VER source/lib/sysdep/compiler.h:# define MSC_VERSION _MSC_VER source/lib/sysdep/os/win/wdbg_heap.h:#ifdef _MSC_VER source/lib/sysdep/os/win/wdbg_heap.h:#if _MSC_VER > 1800 source/lib/sysdep/os/win/wdbg_sym.h:#ifdef _MSC_VER source/lib/sysdep/os/win/wdbg_sym.h:#if _MSC_VER > 1800 source/lib/sysdep/os/win/wposix/wtime.h:#if _MSC_VER < 1900 source/lib/sysdep/os/win/wutil.h:#ifdef _MSC_VER source/lib/sysdep/os/win/wutil.h:#if _MSC_VER > 1800 source/lib/sysdep/sysdep.h:#ifdef _MSC_VER source/lib/sysdep/sysdep.h:#if _MSC_VER > 1800 source/third_party/cppformat/format.cpp:#ifndef _MSC_VER source/third_party/cppformat/format.cpp:#else // _MSC_VER source/third_party/cppformat/format.cpp:#if _MSC_VER > 1800 source/third_party/cppformat/format.cpp:#endif // _MSC_VER source/third_party/cppformat/format.cpp:#ifdef _MSC_VER source/third_party/cppformat/format.cpp:#ifdef _MSC_VER source/third_party/cppformat/format.cpp:#ifdef _MSC_VER source/third_party/cppformat/format.h:# if defined(_MSC_VER) && _MSC_VER >= 1800 source/third_party/cppformat/format.h:# elif defined(_MSC_VER) && _MSC_VER >= 1600 source/third_party/jsonspirit/json_spirit_error_position.h:#if defined(_MSC_VER) && (_MSC_VER >= 1020) source/third_party/jsonspirit/json_spirit_reader_template.h:#if defined(_MSC_VER) && (_MSC_VER >= 1020) source/third_party/jsonspirit/json_spirit_value.h:#if defined(_MSC_VER) && (_MSC_VER >= 1020) source/third_party/jsonspirit/json_spirit_writer_options.h:#if defined(_MSC_VER) && (_MSC_VER >= 1020) source/third_party/jsonspirit/json_spirit_writer_template.h:#if defined(_MSC_VER) && (_MSC_VER >= 1020) source/third_party/mikktspace/mikktspace.cpp:#ifdef _MSC_VER source/third_party/mikktspace/mikktspace.cpp:#if _MSC_VER > 1800 source/third_party/mikktspace/mikktspace.cpp:#ifdef _MSC_VER source/third_party/mikktspace/weldmesh.cpp:#ifdef _MSC_VER source/third_party/mikktspace/weldmesh.cpp:#if _MSC_VER > 1800 source/third_party/mongoose/mongoose.cpp:#ifdef _MSC_VER source/third_party/mongoose/mongoose.cpp:#if _MSC_VER > 1800 source/third_party/mongoose/mongoose.cpp:#if defined(_MSC_VER) && _MSC_VER < 1300 source/third_party/mongoose/mongoose.cpp:#endif // _MSC_VER source/third_party/mongoose/mongoose.cpp:#if _MSC_VER < 1900 source/third_party/mongoose/mongoose_orig.c:#if defined(_MSC_VER) && _MSC_VER < 1300 source/third_party/mongoose/mongoose_orig.c:#endif // _MSC_VER source/third_party/tinygettext/src/unix_file_system.cpp:#ifdef _MSC_VER source/tools/atlas/AtlasFrontends/_template.cpp:# if _MSC_VER >= 1400 // (can't be bothered to implement this for VC7.1...) source/tools/atlas/AtlasObject/AtlasObjectImpl.h:#ifdef _MSC_VER source/tools/atlas/AtlasObject/AtlasObjectJS.cpp:#if defined(_MSC_VER) source/tools/atlas/AtlasObject/JSONSpiritInclude.h:#ifdef _MSC_VER source/tools/atlas/AtlasObject/JSONSpiritInclude.h:#ifdef _MSC_VER source/tools/atlas/AtlasUI/Misc/precompiled.h:#if defined(_MSC_VER) source/tools/atlas/GameInterface/Messages.h:#ifdef _MSC_VER // (can't use MSC_VERSION here since this file is included by Atlas too) source/tools/atlas/GameInterface/Messages.h:#ifdef _MSC_VER source/tools/atlas/GameInterface/Shareable.h:#ifdef _MSC_VER // (can't use MSC_VERSION here since this file is included by Atlas too) source/tools/atlas/GameInterface/Shareable.h:#ifdef _MSC_VER
MSC_VERSION
source/lib/alignment.h:#include "lib/sysdep/compiler.h" // MSC_VERSION source/lib/alignment.h:#if MSC_VERSION source/lib/byte_order.h:#elif MSC_VERSION source/lib/code_annotation.h:#elif MSC_VERSION source/lib/code_annotation.h:#if MSC_VERSION && !ICC_VERSION // (ICC ignores this) source/lib/code_annotation.h:#elif MSC_VERSION source/lib/code_annotation.h:# if MSC_VERSION source/lib/code_annotation.h:#elif MSC_VERSION source/lib/code_annotation.h:# error ICC_VERSION defined without either GCC_VERSION or an adequate MSC_VERSION source/lib/code_annotation.h:#elif MSC_VERSION source/lib/code_annotation.h:#if MSC_VERSION source/lib/code_annotation.h:#if MSC_VERSION source/lib/code_annotation.h:#if MSC_VERSION && !ARCH_AMD64 source/lib/debug.h:#if MSC_VERSION source/lib/debug_stl.cpp:#if MSC_VERSION source/lib/external_libraries/dbghelp.h:#if MSC_VERSION source/lib/external_libraries/libsdl.h:# if MSC_VERSION source/lib/external_libraries/openal.h:#if MSC_VERSION source/lib/external_libraries/openmp.h:# if MSC_VERSION source/lib/external_libraries/png.h:#if MSC_VERSION source/lib/external_libraries/png.h:#endif // MSC_VERSION source/lib/external_libraries/powrprof.h:#if MSC_VERSION && MSC_VERSION < 1400 source/lib/external_libraries/powrprof.h:#endif // #if MSC_VERSION source/lib/external_libraries/suppress_boost_warnings.h:#if MSC_VERSION source/lib/external_libraries/tinygettext.h:#if MSC_VERSION source/lib/external_libraries/tinygettext.h:#if MSC_VERSION source/lib/external_libraries/vorbis.h:#if MSC_VERSION source/lib/external_libraries/zlib.h:#if MSC_VERSION source/lib/lib_api.h:# if MSC_VERSION source/lib/ogl.cpp:#if MSC_VERSION source/lib/pch/pch_boost.h:#if MSC_VERSION source/lib/pch/pch_warnings.h:#include "lib/sysdep/compiler.h" // MSC_VERSION source/lib/pch/pch_warnings.h:#if MSC_VERSION source/lib/pch/pch_warnings.h:#if MSC_VERSION <= 140 source/lib/pch/pch_warnings.h:#if MSC_VERSION <= 140 source/lib/posix/posix.h:#if MSC_VERSION source/lib/posix/posix.h:#if MSC_VERSION source/lib/posix/posix.h:# if MSC_VERSION source/lib/precompiled.h:#include "lib/sysdep/compiler.h" // MSC_VERSION source/lib/precompiled.h:#if MSC_VERSION source/lib/secure_crt.h:#if MSC_VERSION source/lib/sysdep/acpi.cpp:#if MSC_VERSION source/lib/sysdep/arch/amd64/amd64.cpp:#if MSC_VERSION source/lib/sysdep/arch/ia32/ia32.cpp:#if MSC_VERSION source/lib/sysdep/arch/x86_x64/x86_x64.cpp:#if MSC_VERSION source/lib/sysdep/arch/x86_x64/x86_x64.cpp:#if !MSC_VERSION // ensure not already defined in header source/lib/sysdep/arch/x86_x64/x86_x64.cpp:#if MSC_VERSION source/lib/sysdep/arch/x86_x64/x86_x64.h:#if MSC_VERSION source/lib/sysdep/arch/x86_x64/x86_x64.h:#if MSC_VERSION source/lib/sysdep/compiler.h:# define MSC_VERSION _MSC_VER source/lib/sysdep/compiler.h:# define MSC_VERSION 0 source/lib/sysdep/compiler.h:# elif MSC_VERSION // also includes ICC source/lib/sysdep/compiler.h:# elif MSC_VERSION // also includes ICC source/lib/sysdep/cpu.h:#if MSC_VERSION && ARCH_X86_X64 source/lib/sysdep/os/win/manifest.cpp:#if MSC_VERSION >= 1400 && !ICC_VERSION && defined(LIB_STATIC_LINK) source/lib/sysdep/os/win/wdbg_heap.cpp:#if MSC_VERSION && _DLL // DLL runtime library source/lib/sysdep/os/win/wdbg_heap.cpp: const int dllVersion = (MSC_VERS // VC2005: 1400 => 80 source/lib/sysdep/os/win/wdll_delay_load.cpp:#if MSC_VERSION && MSC_VERSION >= 1700 source/lib/sysdep/os/win/wdll_ver.cpp:#if MSC_VERSION source/lib/sysdep/os/win/wgfx.cpp:#if MSC_VERSION source/lib/sysdep/os/win/whrt/hpet.cpp:#define HAVE_X64_MOVD ARCH_AMD64 && (ICC_VERSION || MSC_VERSION >= 1500) source/lib/sysdep/os/win/whrt/tgt.cpp:#if MSC_VERSION source/lib/sysdep/os/win/wposix/waio.cpp:#if MSC_VERSION source/lib/sysdep/os/win/wposix/waio.cpp:#if MSC_VERSION source/lib/sysdep/os/win/wposix/werrno.h:#if (!defined(BOOST_VERSION) || BOOST_VERSION <= 103401) && (!MSC_VERSION || MSC_VERSION < 1600) source/lib/sysdep/os/win/wposix/wfilesystem.h:#if MSC_VERSION source/lib/sysdep/os/win/wposix/wposix_types.h:#if MSC_VERSION source/lib/sysdep/os/win/wposix/wposix_types.h:#if MSC_VERSION || ICC_VERSION || LCC_VERSION source/lib/sysdep/os/win/wposix/wposix_types.h:#if MSC_VERSION || ICC_VERSION || LCC_VERSION source/lib/sysdep/os/win/wposix/wposix_types.h:#if MSC_VERSION >= 1600 source/lib/sysdep/os/win/wseh.cpp:#if MSC_VERSION source/lib/sysdep/os/win/wsysdep.cpp:#if MSC_VERSION source/lib/sysdep/stl.h:#if MSC_VERSION source/lib/tex/tex_png.cpp:#if MSC_VERSION source/lib/tex/tex_png.cpp:#endif // MSC_VERSION source/main.cpp:#if MSC_VERSION source/maths/Fixed.h:#if MSC_VERSION source/pch/gui/precompiled.h:#if MSC_VERSION source/ps/GameSetup/HWDetect.cpp: scriptInterface.SetProperty(settings, "build_msc", (int)MSC_VERSION); source/ps/LoaderThunks.h:#if MSC_VERSION source/scriptinterface/ScriptExtraHeaders.h:#if MSC_VERSION source/scriptinterface/ScriptExtraHeaders.h:#if MSC_VERSION source/scriptinterface/ScriptTypes.h:#if MSC_VERSION source/scriptinterface/ScriptTypes.h:#if MSC_VERSION source/test_setup.cpp:#if MSC_VERSION source/tools/atlas/GameInterface/Messages.h:#ifdef _MSC_VER // (can't use MSC_VERSION here since this file is included by Atlas too) source/tools/atlas/GameInterface/Shareable.h:#ifdef _MSC_VER // (can't use MSC_VERSION here since this file is included by Atlas too)
Those are wrong
source/lib/pch/pch_warnings.h:#if MSC_VERSION <= 140 source/lib/pch/pch_warnings.h:#if MSC_VERSION <= 140
source/lib/precompiled.h | ||
---|---|---|
44 | So apparently no it is not possible to do so. |
Those are wrong
source/lib/pch/pch_warnings.h:#if MSC_VERSION <= 140
source/lib/pch/pch_warnings.h:#if MSC_VERSION <= 140
I know that was first intention in the diff :)
I'm not sure about the change in Mongoose, there are quite a few warnings in that file. I think it will be better to update it.
Successful build - Chance fights ever on the side of the prudent.
Link to build: https://jenkins.wildfiregames.com/job/vs2015-differential/1069/display/redirect
Successful build - Chance fights ever on the side of the prudent.
Link to build: https://jenkins.wildfiregames.com/job/macos-differential/165/display/redirect
Successful build - Chance fights ever on the side of the prudent.
Linter detected issues: Executing section Source... source/lib/sysdep/os/win/wutil.h | 37| template<typename·H> | | [MAJOR] CPPCheckBear (syntaxError): | | Code 'template<...' is invalid C code. Use --std or --language to configure the language. source/ps/LoaderThunks.h | 28| template<class·T>·struct·MemFun_t | | [MAJOR] CPPCheckBear (syntaxError): | | Code 'template<...' is invalid C code. Use --std or --language to configure the language. Executing section JS... Executing section cli...
Link to build: https://jenkins.wildfiregames.com/job/docker-differential/1587/display/redirect