0031060: Configuration - Support building with CLang compiler under VS 2019
authorabv <abv@opencascade.com>
Fri, 11 Oct 2019 19:04:02 +0000 (22:04 +0300)
committerabv <abv@opencascade.com>
Sun, 3 Nov 2019 18:47:59 +0000 (21:47 +0300)
commit1bd04b5a02c9d940988ec52bc7fd2673a7045188
tree7c450f304508d06a8af823b54eec10f77edeaa18
parent6466cc9eb15a1e56aefb363704ed2a154b8b4c99
0031060: Configuration - Support building with CLang compiler under VS 2019

Build tools are updated to support building with Visual Studion 2019 toolset ClangCL (LLVM clang-cl):
- In CMake builds, use of unsupported option "-std=c++0x" is avoided
- Tool genconf recognizes availability of ClangCL toolset and proposes it in the list
- Tool genproj recognizes new compiler specification VCVER=vclang and generates VS 2019 projects for it

Note that vclang configuration puts binaries to folder "vc14" as it is compatible with vc14 CRT.

Code is updated to build with Clang for Windows without errors and warnings:
- In BVH classes, pure virtual destructors are replaced by empty ones, to avoid bogus compiler warning
- In .lex files, pragmas are added to disable warnings in parser code
- In OSD, signature of function _osd_wnt_set_error() is corrected to avoid warning on incorrect use of va_args (undefined behavior)
- In OSD_Host, OSD_Parallel_TBB, warnings on usage of deprecated function are disabled
- In Quantity_ColorRGBA and ViewerTest_CmdParser, incorrect use of predefined macro __FUNCTION__ assuming it was a string literal is avoided
- In Standard_Macro.hxx, code is reordered to handle Clang for Windows appropriately
- In AdvApp2Var_SysBase.hxx, inclusion of obsolete (MSVC-specific) header file is replaced by Standard_TypeDef.hxx
- In Standard_ErrorHandler.hxx, empty statements added to avoid warning on unused class fields
- In IVtkDraw and ViewerTest, interface is corrected to use actual type avoiding unnecessary type casts

Off-topic: corrections of some errors (uninitialized class fields) reported by VS Code Analysis in TKernel
41 files changed:
adm/cmake/occt_defs_flags.cmake
adm/genconf.tcl
adm/genconfdeps.tcl
adm/genproj.tcl
adm/templates/env.bat
dox/overview/overview.md
src/AdvApp2Var/AdvApp2Var_SysBase.hxx
src/BVH/BVH_Object.hxx
src/BVH/BVH_QueueBuilder.hxx
src/BVH/BVH_Set.hxx
src/BinLDrivers/BinLDrivers_DocumentStorageDriver.cxx
src/ExprIntrp/ExprIntrp.lex
src/ExprIntrp/lex.ExprIntrp.c
src/IVtkDraw/IVtkDraw.cxx
src/IVtkDraw/IVtkDraw.hxx
src/IVtkDraw/IVtkDraw_Interactor.cxx
src/Image/Image_Texture.cxx
src/NCollection/NCollection_AccAllocator.hxx
src/NCollection/NCollection_SparseArrayBase.hxx
src/OSD/OSD_Directory.cxx
src/OSD/OSD_DirectoryIterator.cxx
src/OSD/OSD_Disk.cxx
src/OSD/OSD_File.cxx
src/OSD/OSD_FileIterator.cxx
src/OSD/OSD_FileNode.cxx
src/OSD/OSD_Host.cxx
src/OSD/OSD_Parallel_TBB.cxx
src/OSD/OSD_Path.cxx
src/OSD/OSD_Process.cxx
src/OSD/OSD_Timer.cxx
src/QABugs/QABugs_11.cxx
src/QABugs/QABugs_19.cxx
src/Quantity/Quantity_ColorRGBA.cxx
src/Standard/Standard_ErrorHandler.hxx
src/Standard/Standard_Macro.hxx
src/StepFile/lex.step.c
src/StepFile/step.lex
src/Storage/Storage_Schema.cxx
src/ViewerTest/ViewerTest.hxx
src/ViewerTest/ViewerTest_CmdParser.cxx
src/ViewerTest/ViewerTest_ViewerCommands.cxx