]> 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>
Sat, 19 Oct 2019 09:31:41 +0000 (12:31 +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 BRepExtrema_SelfIntersection.hxx, missing Standard_EXPORT is added
- 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

40 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/BRepExtrema/BRepExtrema_SelfIntersection.hxx
src/BVH/BVH_Object.hxx
src/BVH/BVH_QueueBuilder.hxx
src/BVH/BVH_Set.hxx
src/ExprIntrp/ExprIntrp.lex
src/ExprIntrp/lex.ExprIntrp.c
src/IVtkDraw/IVtkDraw.cxx
src/IVtkDraw/IVtkDraw.hxx
src/IVtkDraw/IVtkDraw_Interactor.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 68f987159215564fe6c704ade55b5c8629c2eff0..7e13b47e44c2650f5f619ccdae8e1d1908d1afcc 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 8115c900737b27bb72f01f37916f16d2ea8b994d..6ba96088a5b65a50e509b50c9e5374c4a2d70780 100644 (file)
@@ -207,7 +207,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 b1cd1d98f71de7f087d8b352164e9263d3e59bf1..0407abb3d3390d8637ad0535b0c40fffb222f4a2 100644 (file)
@@ -96,8 +96,8 @@ public:
 protected:
 
   //! Filter out correct adjacent mesh elements.
-  virtual BRepExtrema_ElementFilter::FilterResult PreCheckElements (const Standard_Integer theIndex1,
-                                                                    const Standard_Integer theIndex2);
+  Standard_EXPORT virtual BRepExtrema_ElementFilter::FilterResult PreCheckElements (const Standard_Integer theIndex1,
+                                                                                    const Standard_Integer theIndex2);
 
   //! Checks if the given triangles have only single common vertex.
   BRepExtrema_ElementFilter::FilterResult isRegularSharedVertex (const BVH_Vec3d& theSharedVert,
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 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 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 cca6172504d1bdcd8935dd08b021bbd7485fcf96..e0b6f9da5e03d1159493ba99d36d9d966ade6f89 100644 (file)
@@ -880,8 +880,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..90d55be76c71e56e574a0cdb2063d9b69aff0b3f 100644 (file)
@@ -52,11 +52,7 @@ 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
          0.001 * GetTickCount64();
-#endif
 }
 
 #endif /* _WIN32 */
index 983cc5a45f57457937b9b17004e199f7dbf165ac..a3f9ff68dd36dee01cf4d3b81b8339423e4c28f8 100644 (file)
@@ -2207,7 +2207,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)
@@ -2521,7 +2521,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 dfce9c34fe33f95f2789e14595915fc072ea9cc2..9299de980725edfab0d8c65f93891c90be5c6819 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 3db480fa39ac768b77d2ba9ae08f170ab98a4304..ca1745313b87a3ef6e3e5fc0e37f2fe17fddfd8e 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);
     Graphic3d_Vec4 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 336ecbd3317b0fdf869c5c31ff0973b8d63401b6..6790f6dba6ee06c6d2010ba76c6d2b4de14d29b2 100644 (file)
@@ -1367,13 +1367,13 @@ 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())
   {
-    theWClass = new WNT_WClass ("GW3D_Class", (Standard_Address )AdvViewerWindowProc,
+    theWClass = new WNT_WClass ("GW3D_Class", AdvViewerWindowProc,
                                 CS_VREDRAW | CS_HREDRAW, 0, 0,
                                 ::LoadCursor (NULL, IDC_ARROW));
   }
@@ -1909,8 +1909,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,