]> OCCT Git - occt-copy.git/commitdiff
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)
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

index 5484c6759f3fcaf4e2a4e918b2362932de3e67ac..484002d1aa1bf01973a03d61fadaceaabd1ad7f4 100644 (file)
@@ -130,7 +130,9 @@ elseif ("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xClang")
   if (APPLE)
     # CLang can be used with both libstdc++ and libc++, however on OS X libstdc++ is outdated.
     set (CMAKE_CXX_FLAGS "-std=c++0x -stdlib=libc++ ${CMAKE_CXX_FLAGS}")
-  else()
+  elseif(NOT WIN32)
+    # CLang for Windows (at least CLang 8.0 distributed with VS 2019) 
+    # does not support option "-std=c++0x"
     set (CMAKE_CXX_FLAGS "-std=c++0x ${CMAKE_CXX_FLAGS}")
   endif()
 elseif (DEFINED CMAKE_COMPILER_IS_GNUCXX)
index 88b17d46b776886ff9e3deb16ecaac2fc2eb6fad..799945e3babda74a4fa982a7e56705f268bfbfbf 100644 (file)
@@ -82,6 +82,11 @@ if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Micr
   lappend ::SYS_VC_LIST "vc142-uwp"
   lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
 }
+if { ! [catch {exec vswhere.exe -version "\[16.0,16.99\]" -latest -requires Microsoft.VisualStudio.Component.VC.ClangCL -property installationPath} res] } {
+  lappend ::SYS_VS_LIST "Visual Studio 2019 (16, toolset ClangCL)"
+  lappend ::SYS_VC_LIST "vclang"
+  lappend ::SYS_VCVARS_LIST "$res\\VC\\vcvarsall.bat"
+}
 
 # detect installed Visual Studio instances from global environment
 if { [info exists ::env(VS140COMNTOOLS)] } {
index 030879dc150522e4250ad8c439ab094a09de84d8..3897341ce2216f008eb38147a6333e7fec679d0d 100644 (file)
@@ -241,7 +241,11 @@ proc wokdep:Preferred {theList theCmpl theArch} {
 
   # keep only two first digits in "vc141"
   if { ! [regexp {^vc[0-9][0-9]} $theCmpl aCmpl] } {
-    set aCmpl $theCmpl
+    if { [regexp {^vclang} $theCmpl] } { 
+      set aCmpl vc14
+    } else {
+      set aCmpl $theCmpl
+    }
   }
 
   set aShortList {}
@@ -631,7 +635,11 @@ proc wokdep:SearchTBB {theErrInc theErrLib32 theErrLib64 theErrBin32 theErrBin64
 
   # keep only two first digits in "vc141"
   if { ! [regexp {^vc[0-9][0-9]} ${::VCVER} aVcLib] } {
-    set aVcLib ${::VCVER}
+    if { [regexp {^vclang} ${::VCVER}] } {
+      set aVcLib vc14
+    } else {
+      set aVcLib ${::VCVER}
+    }
   }
 
   set isFound "true"
index 400b71525d68544950622731427ccb0c6e9f558b..b95166d1b3076215a9e74aac9d129848b1549f50 100644 (file)
@@ -256,7 +256,7 @@ proc genAllResources {} {
 
 # Wrapper-function to generate VS project files
 proc genproj {theFormat args} {
-  set aSupportedFormats { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "vc141" "vc142" "cbp" "xcd" "pro"}
+  set aSupportedFormats { "vc7" "vc8" "vc9" "vc10" "vc11" "vc12" "vc14" "vc141" "vc142" "vclang" "cbp" "xcd" "pro"}
   set aSupportedPlatforms { "wnt" "uwp" "lin" "mac" "ios" "qnx" }
   set isHelpRequire false
 
@@ -320,6 +320,7 @@ proc genproj {theFormat args} {
       vc14     -  Visual Studio 2015
       vc141    -  Visual Studio 2017
       vc142    -  Visual Studio 2019
+      vclang   -  Visual Studio with ClangCL toolset
       cbp      -  CodeBlocks
       xcd      -  XCode
       pro      -  Qt Creator
@@ -529,7 +530,8 @@ proc OS:MKPRC { theOutDir theFormat theLibType thePlatform theCmpl theSolution }
     "vc12"  -
     "vc14"  -
     "vc141" -
-    "vc142"    { OS:MKVC  $anOutDir $aModules $theSolution $theFormat $isUWP}
+    "vc142" -
+    "vclang"   { OS:MKVC  $anOutDir $aModules $theSolution $theFormat $isUWP}
     "cbp"      { OS:MKCBP $anOutDir $aModules $theSolution $thePlatform $theCmpl }
     "xcd"      {
       set ::THE_GUIDS_LIST($::aTKNullKey) "000000000000000000000000"
@@ -984,7 +986,8 @@ proc osutils:vcsolution:header { vcversion } {
     append var \
       "Microsoft Visual Studio Solution File, Format Version 12.00\n" \
       "# Visual Studio 2013\n"
-  } elseif { "$vcversion" == "vc14" || "$vcversion" == "vc141" || "$vcversion" == "vc142" } {
+  } elseif { "$vcversion" == "vc14" || "$vcversion" == "vc141" || 
+             "$vcversion" == "vc142" || "$vcversion" == "vclang" } {
     append var \
       "Microsoft Visual Studio Solution File, Format Version 12.00\n" \
       "# Visual Studio 14\n"
@@ -1225,6 +1228,9 @@ proc osutils:vcproj:readtemplate {theVcVer isUWP isExec} {
   } elseif { $theVcVer == "vc142" } {
     set aVCRTVer "vc14"
     set aToolset "v142"
+  } elseif { $theVcVer == "vclang" } {
+    set aVCRTVer "vc14"
+    set aToolset "ClangCL"
   }
 
   set what "$theVcVer"
index 4180f23999d832dcf510c0b963906dadf09240b8..b262e1081138545d6cabbcf48a4cd3732312fd74 100644 (file)
@@ -77,6 +77,9 @@ if "%VCVER:~-4%" == "-uwp" (
   set VCLIB=%VCLIB%-uwp
   set VCPROP=Universal
 )
+if "%VCFMT%" == "vclang" (
+  set VCLIB=vc14
+)
 rem echo VCVER=%VCVER% VCFMT=%VCFMT% VCLIB=%VCLIB% VCPROP=%VCPROP%
 
 rem ----- Parsing of Visual Studio platform -----
@@ -106,6 +109,10 @@ if not "%DevEnvDir%" == "" (
   for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
     set "DevEnvDir=%%i\Common7\IDE\"
   )
+) else if /I "%VCFMT%" == "vclang" (
+  for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
+    set "DevEnvDir=%%i\Common7\IDE\"
+  )
 ) else if /I "%VCFMT%" == "gcc" (
   rem MinGW
 ) else (
@@ -118,6 +125,7 @@ if not "%DevEnvDir%" == "" (
   echo vc14  = VS 2015
   echo vc141 = VS 2017
   echo vc142 = VS 2019
+  echo vclang = VS 2019 with ClangCL toolset
   exit /B
 )
 
@@ -147,6 +155,11 @@ if /I "%VCFMT%" == "vc9" (
     set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
   ) 
   set "VCPlatformToolSet=v142"
+) else if /I "%VCFMT%" == "vclang" (
+  for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
+    set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
+  ) 
+  set "VCPlatformToolSet=ClangCL"
 ) else if /I "%VCFMT%" == "gcc" (
   rem MinGW
 ) else (
index 6096a2d5b353744c117fc6fa1dd028a9ce2b0ec2..6eb6c1b2b9542eeae170bfa86f6c2239d951384e 100644 (file)
@@ -210,7 +210,7 @@ for which OCCT is certified to work.
 
 | OS        | Compiler |
 | --------- | ----------- |
-| Windows   | Microsoft Visual Studio: 2008 SP1, 2010 SP1, 2012 Update 4, 2013 Update 5, 2015 Update 3, 2017 <sup>1</sup>, 2019 <br> GCC 4.3+ (Mingw-w64)|
+| Windows   | Microsoft Visual Studio: 2008 SP1, 2010 SP1, 2012 Update 4, 2013 Update 5, 2015 Update 3, 2017 <sup>1</sup>, 2019 <br>, LLVM (ClangCL), GCC 4.3+ (Mingw-w64)|
 | Linux     | GNU gcc 4.3+ <br> LLVM CLang 3.6+ |
 | OS X / macOS | XCode 6 or newer |
 | Android   | NDK r10, GNU gcc 4.8 or newer |
index 6f1c5330a4361fd2b1e2bd39fa5584ed7a39f3dd..135ec21fb172620ece70126796219a9d438bedd2 100644 (file)
 #define AdvApp2Var_SysBase_HeaderFile
 
 #include <Standard_Macro.hxx>
+#include <Standard_TypeDef.hxx>
 #include <AdvApp2Var_Data_f2c.hxx>
-#if _MSC_VER
-#include <stddef.h>
-#else
-#include <stdint.h>
-#endif
 
 class AdvApp2Var_SysBase {
  public:
index 82a9133f341973e2c292bb197a7cd2ac3de63c5a..609169dd32caa15fe60eaf60971e1704c81b81fe 100644 (file)
@@ -62,7 +62,7 @@ public:
   BVH_Object() {}
 
   //! Releases resources of geometric object.
-  virtual ~BVH_Object() = 0;
+  virtual ~BVH_Object() {}
 
 public:
 
@@ -71,14 +71,4 @@ public:
 
 };
 
-// =======================================================================
-// function : ~BVH_Object
-// purpose  :
-// =======================================================================
-template<class T, int N>
-BVH_Object<T, N>::~BVH_Object()
-{
-  //
-}
-
 #endif // _BVH_Object_Header
index c7c4bf34ece9c877cca5d82f7633cf15de297dbb..51d79615dc7dc306876f2d627990309e997b322e 100644 (file)
@@ -44,7 +44,7 @@ public:
     myNumOfThreads (theNumOfThreads) {}
 
   //! Releases resources of BVH queue based builder.
-  virtual ~BVH_QueueBuilder() = 0;
+  virtual ~BVH_QueueBuilder() {}
 
 public:
 
@@ -288,14 +288,4 @@ void BVH_QueueBuilder<T, N>::Build (BVH_Set<T, N>*       theSet,
   }
 }
 
-// =======================================================================
-// function : ~BVH_QueueBuilder
-// purpose  :
-// =======================================================================
-template<class T, int N>
-BVH_QueueBuilder<T, N>::~BVH_QueueBuilder()
-{
-  //
-}
-
 #endif // _BVH_QueueBuilder_Header
index 2d0950cb2bb2864b061c77149fe6d2978ded9483..aaec3f327297d0388eb8b062e2258db9ade170e9 100644 (file)
@@ -35,7 +35,7 @@ public:
   BVH_Set() {}
 
   //! Releases resources of set of objects.
-  virtual ~BVH_Set() = 0;
+  virtual ~BVH_Set() {}
 
   //! Returns AABB of the entire set of objects.
   virtual BVH_Box<T, N> Box() const
@@ -67,14 +67,4 @@ public:
 
 };
 
-// =======================================================================
-// function : ~BVH_Set
-// purpose  :
-// =======================================================================
-template<class T, int N>
-BVH_Set<T, N>::~BVH_Set()
-{
-  //
-}
-
 #endif // _BVH_Set_Header
index 4c7d91fdd9b4820ea93e95fc5781f143925e5509..a01903d561e7bdaee29038074468871e50f9ddc3 100644 (file)
@@ -223,7 +223,7 @@ void BinLDrivers_DocumentStorageDriver::WriteSubTree
   // Write attributes
   TDF_AttributeIterator itAtt (theLabel);
   for ( ; itAtt.More() && theOS; itAtt.Next()) {
-    const Handle(TDF_Attribute)& tAtt = itAtt.Value();
+    const Handle(TDF_Attribute) tAtt = itAtt.Value();
     const Handle(Standard_Type)& aType = tAtt->DynamicType();
     // Get type ID and driver
     Handle(BinMDF_ADriver) aDriver;
index c2e2bc749aa3bb54e40cd54a006baa077e38e396..e9f05243a31822c80b1edb77584fa393c4bf46c5 100644 (file)
@@ -57,6 +57,10 @@ static int yywrap()
 // Note that Intel compiler also defines _MSC_VER but has different warning ids
 #if defined(__INTEL_COMPILER)
 #pragma warning(disable:177 1786 1736)
+#elif defined(__clang__)
+#pragma GCC diagnostic ignored "-Wunused-function"
+#pragma GCC diagnostic ignored "-Winconsistent-dllimport"
+#pragma GCC diagnostic ignored "-Wunneeded-internal-declaration"
 #else
 #pragma warning(disable:4131 4244 4273 4127 4267)
 #endif
index fa1f37beb155db5115adb7815536ec527ed93a22..c3593f9339a8b1c012bdff7e62b8b64fcf3d9647 100644 (file)
@@ -2106,6 +2106,10 @@ static int yywrap()
 // Note that Intel compiler also defines _MSC_VER but has different warning ids
 #if defined(__INTEL_COMPILER)
 #pragma warning(disable:177 1786 1736)
+#elif defined(__clang__)
+#pragma GCC diagnostic ignored "-Wunused-function"
+#pragma GCC diagnostic ignored "-Winconsistent-dllimport"
+#pragma GCC diagnostic ignored "-Wunneeded-internal-declaration"
 #else
 #pragma warning(disable:4131 4244 4273 4127 4267)
 #endif
index 9c517db488fa7c4cf2e0c614afb00920cd16ebdf..e3befa7f211a1b6b95d6f38133f2227fc7fea777 100644 (file)
@@ -252,13 +252,13 @@ Standard_Integer GenerateId()
 // Function : WClass
 // Purpose  :
 //=========================================================
-const Handle(Standard_Transient)& IVtkDraw::WClass()
+const Handle(WNT_WClass)& IVtkDraw::WClass()
 {
-  static Handle(Standard_Transient) aWindowClass;
+  static Handle(WNT_WClass) aWindowClass;
 #ifdef _WIN32
   if (aWindowClass.IsNull())
   {
-    aWindowClass = new WNT_WClass ("GWVTK_Class", DefWindowProc,
+    aWindowClass = new WNT_WClass ("GWVTK_Class", NULL,
                                    CS_VREDRAW | CS_HREDRAW, 0, 0,
                                    ::LoadCursorW (NULL, IDC_ARROW));
   }
@@ -305,8 +305,7 @@ void IVtkDraw::ViewerInit (Standard_Integer thePxLeft,
 #ifdef _WIN32
     if (GetWindow().IsNull())
     {
-      GetWindow() = new WNT_Window ("IVtkTest",
-                                    Handle(WNT_WClass)::DownCast (WClass()),
+      GetWindow() = new WNT_Window ("IVtkTest", WClass(),
                                     WS_OVERLAPPEDWINDOW,
                                     aPxLeft, aPxTop,
                                     aPxWidth, aPxHeight,
index 6c485bea5e41fa6be70dc98974520cffd86f617d..2f7643a93ab3b12e89feca2d0667f86b0c9d5a1a 100644 (file)
@@ -21,6 +21,7 @@
 #include <Standard_Macro.hxx>
 
 class Draw_Interpretor;
+class WNT_WClass;
 
 class IVtkDraw
 {
@@ -37,7 +38,7 @@ public:
   Standard_EXPORT   static  void Commands (Draw_Interpretor& theCommands);
 
 private:
-  Standard_EXPORT   static const Handle(Standard_Transient)& WClass();
+  Standard_EXPORT   static const Handle(WNT_WClass)& WClass();
 };
 
 #endif
index 743caf9a39d0f64bc47cabe5b2baa413c7ab38e7..0a3b90190b63f490754519f42237c1f52fa226e5 100644 (file)
@@ -187,6 +187,10 @@ void IVtkDraw_Interactor::Initialize()
   this->Size[1] = aSize[1];
 }
 
+#ifdef _WIN32
+LRESULT CALLBACK WndProc(HWND theHWnd, UINT theUMsg, WPARAM theWParam, LPARAM theLParam);
+#endif
+
 //===========================================================
 // Function : Enable
 // Purpose  :
index 6e9e752147a3579953e084763d8abf2ca3ead36e..c81f0eadd388da70b00a1e9c3eccd00b004fc075 100644 (file)
@@ -181,7 +181,7 @@ Handle(Image_PixMap) Image_Texture::loadImageOffset (const TCollection_AsciiStri
 // ================================================================
 TCollection_AsciiString Image_Texture::ProbeImageFileFormat() const
 {
-  static const int THE_PROBE_SIZE = 20;
+  static const Standard_Size THE_PROBE_SIZE = 20;
   char aBuffer[THE_PROBE_SIZE];
   if (!myBuffer.IsNull())
   {
index ba716b8d71b144b6dabc50d639629241b27c595d..239ba351c2aad16b59ed110dcd1b8edac9d2ea21 100644 (file)
@@ -75,7 +75,7 @@ protected:
   {
     Standard_Size myValue;
   public:
-    AlignedSize(){}
+    AlignedSize() : myValue(0) {}
     AlignedSize(const Standard_Size theValue)
       : myValue((theValue + Align - 1) & ~(Align - 1)) {}
     operator Standard_Size() const {return myValue;}
@@ -86,7 +86,7 @@ protected:
   {
     Standard_Byte* myValue;
   public:
-    AlignedPtr(){}
+    AlignedPtr() : myValue(0) {}
     AlignedPtr(const Standard_Address theValue)
       : myValue((Standard_Byte*)((Standard_Size)theValue & ~(Align - 1))) {}
     operator Standard_Address       () const {return myValue;}
index e5cbeff9dbde227cadfb2dedcaa78211fb0a642e..ce5087d63bf5a6fd2545d672798a30d4cb14b497 100644 (file)
@@ -190,8 +190,8 @@ public:
 
 private:
   // Copy constructor and assignment operator are private thus not accessible
-  NCollection_SparseArrayBase (const NCollection_SparseArrayBase&) {}
-  void operator = (const NCollection_SparseArrayBase&) {}
+  NCollection_SparseArrayBase(const NCollection_SparseArrayBase&);
+  void operator = (const NCollection_SparseArrayBase&);
 
 protected:
   // Object life
index 5e4c90933dc6aa13962e8e40543c5a081c4d3b76..589e5eac06f04f49e4bb17604981bc4feb195fbf 100644 (file)
@@ -29,7 +29,7 @@
     #include <tchar.h>
   #endif
 
-  void _osd_wnt_set_error (OSD_Error&, OSD_WhoAmI, ... );
+  void _osd_wnt_set_error (OSD_Error&, Standard_Integer, ... );
 #else
   #include <errno.h>
   #include <stdio.h>
index 568122bb918114f89575e1161e722866366335f5..9e349588bc8753b5e46d21d2670a5d14f1432f9f 100644 (file)
@@ -193,7 +193,7 @@ Standard_Integer OSD_DirectoryIterator::Error()const{
 
 #define _FD (  ( PWIN32_FIND_DATAW )myData  )
 
-void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... );
+void _osd_wnt_set_error ( OSD_Error&, Standard_Integer, ... );
 
 OSD_DirectoryIterator :: OSD_DirectoryIterator (
                           const OSD_Path&                where,
@@ -318,7 +318,12 @@ Standard_Integer OSD_DirectoryIterator :: Error () const {
 }  // end OSD_DirectoryIterator :: Error
 
 // For compatibility with UNIX version
-OSD_DirectoryIterator::OSD_DirectoryIterator() {}
+OSD_DirectoryIterator::OSD_DirectoryIterator()
+: myFlag(false),
+  myHandle(0),
+  myData(0),
+  myFirstCall(Standard_False)
+{}
 
 void OSD_DirectoryIterator::Initialize(
                              const OSD_Path&,
index 0bd42fbe7c3aae6e37a32302d0be798958b7418e..ef37014bf8026676327262e4166800b21fb48908 100644 (file)
@@ -25,7 +25,7 @@
 #ifdef _WIN32
   #include <windows.h>
 
-  void _osd_wnt_set_error (OSD_Error&, OSD_WhoAmI, ... );
+  void _osd_wnt_set_error (OSD_Error&, Standard_Integer, ... );
 
   static TCollection_AsciiString _osd_wnt_set_disk_name (const OSD_Path& thePath)
   {
index cb4850f6da16b37dd5ed098d38084641730c0f19..b8c0abc43b048c4efadcc01a6455ea7aa6e9e460 100644 (file)
@@ -42,7 +42,7 @@
   #define OPEN_OLD    1
   #define OPEN_APPEND 2
 
-  void                            _osd_wnt_set_error        ( OSD_Error&, OSD_WhoAmI, ... );
+  void _osd_wnt_set_error (OSD_Error&, Standard_Integer, ...);
 
 #ifndef OCCT_UWP
   PSECURITY_DESCRIPTOR __fastcall _osd_wnt_protection_to_sd ( const OSD_Protection&, BOOL, const wchar_t* );
index 7b8f469c91d4b70d6382d2bf59fa30eb0a355c8d..d77ca7e84f775440326cda1995c5b6adac1b12c9 100644 (file)
@@ -267,7 +267,7 @@ Standard_Integer OSD_FileIterator::Error()const{
 
 #define _FD (  ( PWIN32_FIND_DATAW )myData  )
 
-void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... );
+void _osd_wnt_set_error ( OSD_Error&, Standard_Integer, ... );
 
 OSD_FileIterator :: OSD_FileIterator (
                      const OSD_Path&                where,
@@ -392,7 +392,12 @@ Standard_Integer OSD_FileIterator :: Error () const {
 }  // end  OSD_FileIterator :: Error
 
 // For compatibility with UNIX version
-OSD_FileIterator::OSD_FileIterator() {}
+OSD_FileIterator::OSD_FileIterator()
+: myFlag(Standard_False),
+  myHandle(0),
+  myData(0),
+  myFirstCall(Standard_False)
+{}
 
 void OSD_FileIterator::Initialize(
                        const OSD_Path&,
index 51555438080132598bdcd3192cdf05d469dc8a91..f0444f717c9eb1265f7797f99968022b514b8265 100644 (file)
@@ -393,7 +393,7 @@ BOOL                 __fastcall _osd_wnt_sd_to_protection (
 #endif
 Standard_Integer     __fastcall _get_file_type ( Standard_CString, HANDLE );
 
-void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... );
+void _osd_wnt_set_error ( OSD_Error&, Standard_Integer, ... );
 
 static BOOL __fastcall _get_file_time (const wchar_t*, LPSYSTEMTIME, BOOL );
 static void __fastcall _test_raise ( TCollection_AsciiString, Standard_CString );
@@ -825,7 +825,7 @@ Standard_Integer OSD_FileNode::Error () const {
 
 }  // end OSD_FileNode :: Error
 
-void _osd_wnt_set_error ( OSD_Error& err, OSD_WhoAmI who, ... ) {
+void _osd_wnt_set_error ( OSD_Error& err, Standard_Integer who, ... ) {
 
  DWORD              errCode;
 
index 38d7414fddce5f9bfffc764c55eb7c6aef30ec25..1547be3fbd3cc725bf6a2ef818560e3b53da9dd9 100644 (file)
@@ -189,7 +189,7 @@ Standard_Integer OSD_Host::Error()const{
   #pragma comment( lib, "WSOCK32.LIB" )
 #endif
 
-void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... );
+void _osd_wnt_set_error ( OSD_Error&, Standard_Integer, ... );
 
 static BOOL                    fInit = FALSE;
 static TCollection_AsciiString hostName;
@@ -218,11 +218,7 @@ OSD_Host :: OSD_Host () {
   ZeroMemory (szHostName, sizeof(char) * (MAX_COMPUTERNAME_LENGTH + 1));
 
   // suppress GetVersionEx() deprecation warning
-#if defined(__INTEL_COMPILER)
-  #pragma warning(disable : 1478)
-#elif defined(_MSC_VER)
-  #pragma warning(disable : 4996)
-#endif
+  Standard_DISABLE_DEPRECATION_WARNINGS
   if (!GetVersionExW (&osVerInfo))
   {
     _osd_wnt_set_error (myError, OSD_WHost);
@@ -236,9 +232,7 @@ OSD_Host :: OSD_Host () {
     ms.dwLength = sizeof(MEMORYSTATUS);
     GlobalMemoryStatus (&ms);
   }  // end else
-#ifdef _MSC_VER
-  #pragma warning(default : 4996)
-#endif
+  Standard_ENABLE_DEPRECATION_WARNINGS
 
   if (  !Failed ()  ) {
   
index 9179f8dba496ae7ce399a37b378c7a1e6d509d68..2344a6ca2df9c2d01c8a73579060c9cb44d3d789 100644 (file)
 #include <OSD_ThreadPool.hxx>
 #include <Standard_ProgramError.hxx>
 
+Standard_DISABLE_DEPRECATION_WARNINGS
 #include <tbb/parallel_for.h>
 #include <tbb/parallel_for_each.h>
 #include <tbb/blocked_range.h>
 #include <tbb/task_scheduler_init.h>
+Standard_ENABLE_DEPRECATION_WARNINGS
 
 //=======================================================================
 //function : forEachExternal
index 6e5c5836eb5ebd42ac0a62693d2f66354763a0a1..5f53fa684a6598048143627b4293d160004d89a7 100644 (file)
@@ -882,8 +882,9 @@ void OSD_Path::SetExtension(const TCollection_AsciiString& aName){
 static void __fastcall _test_raise ( OSD_SysType, Standard_CString );
 static void __fastcall _remove_dup ( TCollection_AsciiString& );
 
-OSD_Path :: OSD_Path () {
-
+OSD_Path :: OSD_Path ()
+: myUNCFlag(Standard_False), mySysDep(OSD_WindowsNT)
+{
 }  // end constructor ( 1 )
 
 OSD_Path ::  OSD_Path (
index c3163f4e4d0e83fc56c9f9144be1a7db74d90c46..d7f4b7923e39a16d8adad41254931c73dbc95ae9 100644 (file)
@@ -187,7 +187,7 @@ Standard_Integer OSD_Process::Error()const{
 //-------------------  WNT Sources of OSD_Path ---------------------------
 //------------------------------------------------------------------------
 
-void _osd_wnt_set_error ( OSD_Error&, OSD_WhoAmI, ... );
+void _osd_wnt_set_error ( OSD_Error&, Standard_Integer, ... );
 
 // =======================================================================
 // function : OSD_Process
index e8bc5d951947139a9b360e806ba7e6c76d489610..c3129a89bee92b944c3b4fa8e91517b2ab3c2f3c 100644 (file)
@@ -52,10 +52,10 @@ static inline Standard_Real GetWallClockTime ()
   LARGE_INTEGER time;
   return isOk && QueryPerformanceCounter (&time) ? 
          (Standard_Real)time.QuadPart / (Standard_Real)freq.QuadPart :
-#ifndef OCCT_UWP
-         0.001 * GetTickCount();
-#else
+#if defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0600)
          0.001 * GetTickCount64();
+#else
+         0.001 * GetTickCount();
 #endif
 }
 
index 56d3b33d56975f8f118399e5f0a4d2b89f8aff4f..c7012e849e6c343f162e400293a4370c28848b33 100644 (file)
@@ -2174,7 +2174,7 @@ static int StackOverflow (int i = -1)
 #endif
 
 // this code does not work with optimize mode on Windows
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && !defined(__clang__)
 #pragma optimize( "", off )
 #endif
 static Standard_Integer OCC6143 (Draw_Interpretor& di, Standard_Integer argc, const char ** argv)
@@ -2488,7 +2488,7 @@ static Standard_Integer OCC30775 (Draw_Interpretor& theDI, Standard_Integer theN
   return 0;
 }
 
-#if defined(_MSC_VER)
+#if defined(_MSC_VER) && !defined(__clang__)
 #pragma optimize( "", on )
 #endif
 
index 2f835f57846f6df17851e04f6160256423fedc30..d61fcc5c3e173a62b7486e8f039b6db4f402347b 100644 (file)
 #include <Standard_Atomic.hxx>
 
 #ifdef HAVE_TBB
+  Standard_DISABLE_DEPRECATION_WARNINGS
   #include <tbb/parallel_for.h>
   #include <tbb/parallel_for_each.h>
   #include <tbb/blocked_range.h>
+  Standard_ENABLE_DEPRECATION_WARNINGS
 #endif
 
 #include <cstdio>
index 4ce134c4b619171a8ab97149cb7c40b54ac7ba67..10ad6164ac7a1cfef2237199d21f2ea7c9667de0 100644 (file)
@@ -44,7 +44,7 @@ namespace
                                                            const ColorInteger theColorComponentBase)
   {
     Standard_ASSERT_RETURN (theColorComponentBase >= 2,
-                            __FUNCTION__ ": 'theColorComponentBase' must be greater than 1.",
+                            "'theColorComponentBase' must be greater than 1.",
                             0.0f);
     const ColorInteger       aColorComponentMaxValue  = theColorComponentBase - 1;
     const ColorInteger       aColorComponentAsInteger = theColorInteger % theColorComponentBase;
@@ -67,7 +67,7 @@ namespace
                                          Quantity_ColorRGBA& theColor)
   {
     Standard_ASSERT_RETURN (theColorComponentBase >= 2,
-                            __FUNCTION__ ": 'theColorComponentBase' must be greater than 1.",
+                            "'theColorComponentBase' must be greater than 1.",
                             0.0f);
     NCollection_Vec4<float> aColor (1.0f);
     if (hasAlphaComponent)
index 5071021411f33345e63381a90c4b63cc5c357cbd..09bdc7bfbf1067b792913db689159970f7696523 100644 (file)
@@ -202,6 +202,8 @@ inline Standard_ErrorHandler::Callback::Callback ()
 }
 inline Standard_ErrorHandler::Callback::~Callback ()
 {
+  (void)myHandler;
+  (void)myPrev;
 }
 inline void Standard_ErrorHandler::Callback::RegisterCallback ()
 {
index a2ab9188a4d073166a84adf21dca2832558ab459..63303b2de19eb58a9fe8c552c807c2e153c98a3d 100644 (file)
 #if defined(__ICL) || defined (__INTEL_COMPILER)
   #define Standard_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) __pragma(warning(disable:1478))
   #define Standard_ENABLE_DEPRECATION_WARNINGS  __pragma(warning(pop))
-#elif defined(_MSC_VER)
-  #define Standard_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) __pragma(warning(disable:4996))
-  #define Standard_ENABLE_DEPRECATION_WARNINGS  __pragma(warning(pop))
 #elif (defined(__GNUC__) && __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) || defined(__clang__)
   // available since at least gcc 4.2 (maybe earlier), however only gcc 4.6+ supports this pragma inside the function body
   // CLang also supports this gcc syntax (in addition to "clang diagnostic ignored")
   #define Standard_DISABLE_DEPRECATION_WARNINGS _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
   #define Standard_ENABLE_DEPRECATION_WARNINGS  _Pragma("GCC diagnostic warning \"-Wdeprecated-declarations\"")
+#elif defined(_MSC_VER)
+  #define Standard_DISABLE_DEPRECATION_WARNINGS __pragma(warning(push)) __pragma(warning(disable:4996))
+  #define Standard_ENABLE_DEPRECATION_WARNINGS  __pragma(warning(pop))
 #else
   #define Standard_DISABLE_DEPRECATION_WARNINGS
   #define Standard_ENABLE_DEPRECATION_WARNINGS
index 66baa717cea6093fa8c9e668222e6b4b14bf520a..88f946e0bf247b4957f27de3303005207e047602 100644 (file)
@@ -552,6 +552,10 @@ void rec_typarg(int argtype);
 // Note that Intel compiler also defines _MSC_VER but has different warning ids
 #if defined(__INTEL_COMPILER)
 #pragma warning(disable:177 1786 1736)
+#elif defined(__clang__)
+#pragma GCC diagnostic ignored "-Wunused-function"
+#pragma GCC diagnostic ignored "-Winconsistent-dllimport"
+#pragma GCC diagnostic ignored "-Wunneeded-internal-declaration"
 #else
 #pragma warning(disable:4131 4244 4273 4267 4127)
 #endif
index 94179ea56b5e65779d508dd49cc34540bbea21f8..dd3340da5e341712a8e5dba8b2dfa86d7763f233 100644 (file)
@@ -47,6 +47,11 @@ void rec_typarg(int argtype);
 // Note that Intel compiler also defines _MSC_VER but has different warning ids
 #if defined(__INTEL_COMPILER)
 #pragma warning(disable:177 1786 1736)
+#elif defined(__clang__)
+#pragma GCC diagnostic ignored "-Wunused-function"
+#pragma GCC diagnostic ignored "-Winconsistent-dllimport"
+#pragma GCC diagnostic ignored "-Wunneeded-internal-declaration"
+#else
 #else
 #pragma warning(disable:4131 4244 4273 4267 4127)
 #endif
index e070d8d5ee556e5395594e427cb1116b4c1b4a22..7968ffdbfdb17b627a4320aff041773445b1c503 100644 (file)
@@ -205,6 +205,9 @@ void Storage_BucketOfPersistent::Append(const Handle(Standard_Persistent)& sp)
 
 Storage_BucketIterator::Storage_BucketIterator
                          (Storage_BucketOfPersistent* aBucketManager)
+: myBucket(0), myCurrentBucket(0),
+  myCurrentBucketIndex(0), myCurrentIndex(0),
+  myBucketNumber(0), myMoreObject(Standard_False)
 {
   if (aBucketManager) {
     myBucket             = aBucketManager;
@@ -214,7 +217,6 @@ Storage_BucketIterator::Storage_BucketIterator
     myCurrentIndex       = 0;
     myMoreObject         = Standard_True;
   }
-  else myMoreObject         = Standard_False;
 }
 
 //=======================================================================
index b9665cfc7dda3365dd3e315664f08531497d37b7..0d1301b55184252c3186b311aafd826ba07014b2 100644 (file)
@@ -34,6 +34,7 @@ class V3d_View;
 class V3d_Viewer;
 class ViewerTest_EventManager;
 class TopoDS_Shape;
+class WNT_WClass;
 
 class ViewerTest
 {
@@ -257,7 +258,7 @@ private:
   //! Ctrl+MB2 for pan, etc) and keyboard shortcuts.
   //! This method is relevant for MS Windows only and respectively
   //! returns WNT_WClass handle.
-  static const Handle(Standard_Transient)& WClass();
+  static const Handle(WNT_WClass)& WClass();
 };
 
 #endif // _ViewerTest_HeaderFile
index fbdb9c243f6b9d2862ab2f5d01bafb7f0f2ae931..bbffa5dd6ddfff65d4a33f54a822400cd1f6aae6 100644 (file)
@@ -305,7 +305,7 @@ bool ViewerTest_CmdParser::Arg (const std::string&     theOptionName,
                                 std::string&           theOptionArgument) const
 {
   Standard_ASSERT_RETURN (theArgumentIndex >= 0,
-                          __FUNCTION__ ": 'theArgumentIndex' must be greater than or equal to zero.",
+                          "'theArgumentIndex' must be greater than or equal to zero.",
                           false);
   ViewerTest_CommandOptionKey anOptionKey = THE_UNNAMED_COMMAND_OPTION_KEY;
   if (!theOptionName.empty() && !findOptionKey (theOptionName, anOptionKey))
@@ -324,7 +324,7 @@ bool ViewerTest_CmdParser::Arg (const ViewerTest_CommandOptionKey theOptionKey,
                                 std::string&                      theOptionArgument) const
 {
   Standard_ASSERT_RETURN (theArgumentIndex >= 0,
-                          __FUNCTION__ ": 'theArgumentIndex' must be greater than or equal to zero.",
+                          "'theArgumentIndex' must be greater than or equal to zero.",
                           false);
   std::size_t aUsedOptionIndex = 0;
   if (!findUsedOptionIndex (theOptionKey, aUsedOptionIndex))
@@ -347,7 +347,7 @@ bool ViewerTest_CmdParser::Arg (const ViewerTest_CommandOptionKey theOptionKey,
 std::string ViewerTest_CmdParser::Arg (const std::string& theOptionName, const Standard_Integer theArgumentIndex) const
 {
   Standard_ASSERT_RETURN (theArgumentIndex >= 0,
-                          __FUNCTION__ ": 'theArgumentIndex' must be greater than or equal to zero.",
+                          "'theArgumentIndex' must be greater than or equal to zero.",
                           std::string());
   std::string anOptionArgument;
   if (!Arg (theOptionName, theArgumentIndex, anOptionArgument))
@@ -501,8 +501,8 @@ bool ViewerTest_CmdParser::ArgColor (const ViewerTest_CommandOptionKey theOption
   const RawStringArguments aRawStringArguments = getRawStringArguments (aUsedOptionIndex);
   const Standard_Integer   aNumberOfArguments  = static_cast<Standard_Integer> (aRawStringArguments.size());
   Standard_ASSERT_RETURN (theArgumentIndex < aNumberOfArguments,
-                          __FUNCTION__ ": 'theArgumentIndex' must be less than the number of command-line arguments "
-                                       "passed with the option which access key is 'theOptionKey'.",
+                          "'theArgumentIndex' must be less than the number of command-line arguments "
+                          "passed with the option which access key is 'theOptionKey'.",
                           false);
   const Standard_Integer aNumberOfAvailableArguments = aNumberOfArguments - theArgumentIndex;
   TheColor               aColor;
@@ -601,7 +601,7 @@ ViewerTest_CmdParser::RawStringArguments ViewerTest_CmdParser::getRawStringArgum
 {
   Standard_ASSERT_RETURN (
     theUsedOptionIndex < myOptionArgumentStorage.size(),
-    __FUNCTION__ ": 'theUsedOptionIndex' must be less than the size of 'myOptionArgumentStorage'.",
+    "'theUsedOptionIndex' must be less than the size of 'myOptionArgumentStorage'.",
     RawStringArguments());
   const OptionArguments& anOptionArguments = myOptionArgumentStorage[theUsedOptionIndex];
   return convertToRawStringList (anOptionArguments);
index 4b4eab1ada935328a5d924872f256d7ff081f180..c1e1e059d5c723538aa15ae4c1ba280623b8910c 100644 (file)
@@ -1397,9 +1397,9 @@ static LRESULT WINAPI AdvViewerWindowProc(
 //purpose  :
 //==============================================================================
 
-const Handle(Standard_Transient)& ViewerTest::WClass()
+const Handle(WNT_WClass)& ViewerTest::WClass()
 {
-  static Handle(Standard_Transient) theWClass;
+  static Handle(WNT_WClass) theWClass;
 #if defined(_WIN32)
   if (theWClass.IsNull())
   {
@@ -1939,8 +1939,7 @@ TCollection_AsciiString ViewerTest::ViewerInit (const Standard_Integer thePxLeft
 
   // Create window
 #if defined(_WIN32)
-  VT_GetWindow() = new WNT_Window (aTitle.ToCString(),
-                                    Handle(WNT_WClass)::DownCast (WClass()),
+  VT_GetWindow() = new WNT_Window (aTitle.ToCString(), WClass(),
                                     Draw_VirtualWindows ? WS_POPUP : WS_OVERLAPPEDWINDOW,
                                     aPxLeft, aPxTop,
                                     aPxWidth, aPxHeight,