From 672b534974743a8479c82377e06de6c9d36113b7 Mon Sep 17 00:00:00 2001
From: kgv <kgv@opencascade.com>
Date: Tue, 1 Jun 2021 10:28:36 +0300
Subject: [PATCH] Configuration, genproj - add EnableAllWarnings to generated
 msvc projects

---
 adm/templates/template.vc10                   | 16 ++++-----
 adm/templates/template.vc10x                  | 16 ++++-----
 src/Draw/Draw_Appli.hxx                       |  2 ++
 src/Draw/Draw_BasicCommands.cxx               |  9 +++--
 src/Draw/Draw_Main.cxx                        |  2 ++
 src/Draw/Draw_Main.hxx                        |  2 ++
 src/Draw/Draw_Viewer.hxx                      |  2 ++
 src/Draw/Draw_WNTCommandWindow.cxx            |  2 ++
 src/Draw/Draw_WNTInit.cxx                     |  2 ++
 src/Draw/Draw_WNTInit.pxx                     |  3 ++
 src/Draw/Draw_WNTMainWindow.cxx               |  2 ++
 src/Draw/Draw_WNTMainWindow.pxx               |  2 ++
 src/Draw/Draw_Window.cxx                      |  2 ++
 src/Draw/Draw_Window.hxx                      |  2 ++
 src/Font/Font_FontMgr.cxx                     |  3 ++
 src/IVtkDraw/IVtkDraw.cxx                     |  3 ++
 src/IVtkDraw/IVtkDraw_Interactor.hxx          |  4 ++-
 src/Media/Media_PlayerContext.cxx             |  2 ++
 src/Message/Message_PrinterOStream.cxx        |  2 ++
 src/Message/Message_PrinterSystemLog.cxx      |  2 ++
 src/NCollection/NCollection_UtfString.cxx     |  2 ++
 .../NCollection_WinHeapAllocator.cxx          |  2 ++
 src/OSD/OSD.cxx                               |  2 ++
 src/OSD/OSD_Chronometer.cxx                   |  2 ++
 src/OSD/OSD_DirectoryIterator.cxx             |  4 +--
 src/OSD/OSD_Disk.cxx                          |  2 ++
 src/OSD/OSD_Environment.cxx                   |  2 ++
 src/OSD/OSD_Error.cxx                         |  2 ++
 src/OSD/OSD_FileIterator.cxx                  |  3 +-
 src/OSD/OSD_FileNode.cxx                      |  2 ++
 src/OSD/OSD_Host.cxx                          |  2 ++
 src/OSD/OSD_MemInfo.cxx                       |  2 ++
 src/OSD/OSD_OpenFile.cxx                      |  2 ++
 src/OSD/OSD_PThread.hxx                       |  2 ++
 src/OSD/OSD_Parallel.cxx                      |  2 ++
 src/OSD/OSD_Path.cxx                          |  3 ++
 src/OSD/OSD_Process.cxx                       |  2 ++
 src/OSD/OSD_SharedLibrary.cxx                 |  2 ++
 src/OSD/OSD_Timer.cxx                         |  2 ++
 src/OSD/OSD_WNT.hxx                           |  8 +++--
 src/OSD/OSD_signal.cxx                        |  2 ++
 src/OpenGl/OpenGl_Context.cxx                 |  2 ++
 src/OpenGl/OpenGl_GlFunctions.cxx             |  2 ++
 src/OpenGl/OpenGl_GlFunctions.hxx             |  2 ++
 src/OpenGl/OpenGl_GraphicDriver.cxx           |  2 ++
 src/OpenGl/glext.h                            |  4 ++-
 src/Standard/Standard.cxx                     |  3 ++
 src/Standard/Standard_Assert.hxx              |  2 ++
 src/Standard/Standard_Condition.cxx           |  2 ++
 src/Standard/Standard_ErrorHandler.cxx        |  2 ++
 src/Standard/Standard_MMgrOpt.cxx             |  2 ++
 src/Standard/Standard_Mutex.hxx               |  2 ++
 src/Standard/Standard_UUID.hxx                |  4 ++-
 src/ViewerTest/ViewerTest_ViewerCommands.cxx  |  2 ++
 src/WNT/WNT_Dword.hxx                         | 33 ++++++++++---------
 src/WNT/WNT_WClass.cxx                        |  2 ++
 src/WNT/WNT_Window.cxx                        |  2 ++
 57 files changed, 156 insertions(+), 44 deletions(-)

diff --git a/adm/templates/template.vc10 b/adm/templates/template.vc10
index 158733423c..8d2ec0071c 100644
--- a/adm/templates/template.vc10
+++ b/adm/templates/template.vc10
@@ -98,9 +98,9 @@
       <AssemblerListingLocation>.\..\..\..\win32\__VCVER__\obj\__TKNAM__/</AssemblerListingLocation>
       <ObjectFileName>.\..\..\..\win32\__VCVER__\obj\__TKNAM__/</ObjectFileName>
       <ProgramDataBaseFileName>.\..\..\..\win32\__VCVER__\obj\__TKNAM__/</ProgramDataBaseFileName>
-      <WarningLevel>Level4</WarningLevel>
+      <WarningLevel>EnableAllWarnings</WarningLevel>
       <SuppressStartupBanner>true</SuppressStartupBanner>
-      <DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      <DisableSpecificWarnings>4464;4514;4710;4820;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <FloatingPointModel>Precise</FloatingPointModel>
       <PrecompiledHeader>NotUsing</PrecompiledHeader>
       __VCMPL32__
@@ -144,11 +144,11 @@
       <AssemblerListingLocation>.\..\..\..\win32\__VCVER__\objd\__TKNAM__/</AssemblerListingLocation>
       <ObjectFileName>.\..\..\..\win32\__VCVER__\objd\__TKNAM__/</ObjectFileName>
       <ProgramDataBaseFileName>.\..\..\..\win32\__VCVER__\objd\__TKNAM__/</ProgramDataBaseFileName>
-      <WarningLevel>Level4</WarningLevel>
+      <WarningLevel>EnableAllWarnings</WarningLevel>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <CompileAs>Default</CompileAs>
-      <DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      <DisableSpecificWarnings>4464;4514;4710;4820;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
       <FloatingPointModel>Precise</FloatingPointModel>
       <PrecompiledHeader>NotUsing</PrecompiledHeader>
@@ -194,9 +194,9 @@
       <AssemblerListingLocation>.\..\..\..\win64\__VCVER__\obj\__TKNAM__/</AssemblerListingLocation>
       <ObjectFileName>.\..\..\..\win64\__VCVER__\obj\__TKNAM__/</ObjectFileName>
       <ProgramDataBaseFileName>.\..\..\..\win64\__VCVER__\obj\__TKNAM__/</ProgramDataBaseFileName>
-      <WarningLevel>Level4</WarningLevel>
+      <WarningLevel>EnableAllWarnings</WarningLevel>
       <SuppressStartupBanner>true</SuppressStartupBanner>
-      <DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      <DisableSpecificWarnings>4464;4514;4710;4820;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <FloatingPointModel>Precise</FloatingPointModel>
       <PrecompiledHeader>NotUsing</PrecompiledHeader>
       __VCMPL64__
@@ -240,11 +240,11 @@
       <AssemblerListingLocation>.\..\..\..\win64\__VCVER__\objd\__TKNAM__/</AssemblerListingLocation>
       <ObjectFileName>.\..\..\..\win64\__VCVER__\objd\__TKNAM__/</ObjectFileName>
       <ProgramDataBaseFileName>.\..\..\..\win64\__VCVER__\objd\__TKNAM__/</ProgramDataBaseFileName>
-      <WarningLevel>Level4</WarningLevel>
+      <WarningLevel>EnableAllWarnings</WarningLevel>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <CompileAs>Default</CompileAs>
-      <DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      <DisableSpecificWarnings>4464;4514;4710;4820;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
       <FloatingPointModel>Precise</FloatingPointModel>
       <PrecompiledHeader>NotUsing</PrecompiledHeader>
diff --git a/adm/templates/template.vc10x b/adm/templates/template.vc10x
index 07f9c750fe..82b98922c3 100644
--- a/adm/templates/template.vc10x
+++ b/adm/templates/template.vc10x
@@ -93,9 +93,9 @@
       <AssemblerListingLocation>.\..\..\..\win32\__VCVER__\obj\__XQTNAM__/</AssemblerListingLocation>
       <ObjectFileName>.\..\..\..\win32\__VCVER__\obj\__XQTNAM__/</ObjectFileName>
       <ProgramDataBaseFileName>.\..\..\..\win32\__VCVER__\obj\__XQTNAM__/</ProgramDataBaseFileName>
-      <WarningLevel>Level4</WarningLevel>
+      <WarningLevel>EnableAllWarnings</WarningLevel>
       <SuppressStartupBanner>true</SuppressStartupBanner>
-      <DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      <DisableSpecificWarnings>4464;4514;4710;4820;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <FloatingPointModel>Precise</FloatingPointModel>__VCMPL32__
     </ClCompile>
     <ResourceCompile>
@@ -136,11 +136,11 @@
       <AssemblerListingLocation>.\..\..\..\win32\__VCVER__\objd\__XQTNAM__/</AssemblerListingLocation>
       <ObjectFileName>.\..\..\..\win32\__VCVER__\objd\__XQTNAM__/</ObjectFileName>
       <ProgramDataBaseFileName>.\..\..\..\win32\__VCVER__\objd\__XQTNAM__/</ProgramDataBaseFileName>
-      <WarningLevel>Level4</WarningLevel>
+      <WarningLevel>EnableAllWarnings</WarningLevel>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <CompileAs>Default</CompileAs>
-      <DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      <DisableSpecificWarnings>4464;4514;4710;4820;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
       <FloatingPointModel>Precise</FloatingPointModel>__VCMPL32__
     </ClCompile>
@@ -183,9 +183,9 @@
       <AssemblerListingLocation>.\..\..\..\win64\__VCVER__\obj\__XQTNAM__/</AssemblerListingLocation>
       <ObjectFileName>.\..\..\..\win64\__VCVER__\obj\__XQTNAM__/</ObjectFileName>
       <ProgramDataBaseFileName>.\..\..\..\win64\__VCVER__\obj\__XQTNAM__/</ProgramDataBaseFileName>
-      <WarningLevel>Level4</WarningLevel>
+      <WarningLevel>EnableAllWarnings</WarningLevel>
       <SuppressStartupBanner>true</SuppressStartupBanner>
-      <DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      <DisableSpecificWarnings>4464;4514;4710;4820;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <FloatingPointModel>Precise</FloatingPointModel>__VCMPL64__
     </ClCompile>
     <ResourceCompile>
@@ -225,11 +225,11 @@
       <AssemblerListingLocation>.\..\..\..\win64\__VCVER__\objd\__XQTNAM__/</AssemblerListingLocation>
       <ObjectFileName>.\..\..\..\win64\__VCVER__\objd\__XQTNAM__/</ObjectFileName>
       <ProgramDataBaseFileName>.\..\..\..\win64\__VCVER__\objd\__XQTNAM__/</ProgramDataBaseFileName>
-      <WarningLevel>Level4</WarningLevel>
+      <WarningLevel>EnableAllWarnings</WarningLevel>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
       <CompileAs>Default</CompileAs>
-      <DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
+      <DisableSpecificWarnings>4464;4514;4710;4820;%(DisableSpecificWarnings)</DisableSpecificWarnings>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
       <FloatingPointModel>Precise</FloatingPointModel>__VCMPL64__
     </ClCompile>
diff --git a/src/Draw/Draw_Appli.hxx b/src/Draw/Draw_Appli.hxx
index 5d3724cff5..6763b3ecaf 100644
--- a/src/Draw/Draw_Appli.hxx
+++ b/src/Draw/Draw_Appli.hxx
@@ -23,7 +23,9 @@
 typedef void (*FDraw_InitAppli)(Draw_Interpretor&);
 
 #ifdef _WIN32
+#include <Standard_WarningsDisable.hxx>
 #include <windows.h>
+#include <Standard_WarningsRestore.hxx>
 Standard_EXPORT void Draw_Appli(HINSTANCE,HINSTANCE,int,
                                 int argc, wchar_t** argv,
                                 const FDraw_InitAppli Draw_InitAppli);
diff --git a/src/Draw/Draw_BasicCommands.cxx b/src/Draw/Draw_BasicCommands.cxx
index 897e007957..e6263a194a 100644
--- a/src/Draw/Draw_BasicCommands.cxx
+++ b/src/Draw/Draw_BasicCommands.cxx
@@ -39,11 +39,14 @@
 #include <TCollection_AsciiString.hxx>
 
 #include <OSD_PerfMeter.h>
+
 #ifdef _WIN32
+#include <Standard_WarningsDisable.hxx>
+  #include <windows.h>
+  #include <winbase.h>
+  #include <process.h>
+#include <Standard_WarningsRestore.hxx>
 
-#include <windows.h>
-#include <winbase.h>
-#include <process.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <time.h>
diff --git a/src/Draw/Draw_Main.cxx b/src/Draw/Draw_Main.cxx
index 783742a8d8..8fdb28a33b 100644
--- a/src/Draw/Draw_Main.cxx
+++ b/src/Draw/Draw_Main.cxx
@@ -15,7 +15,9 @@
 // commercial license or contractual agreement.
 
 #ifdef _WIN32
+#include <Standard_WarningsDisable.hxx>
 #include <windows.h>
+#include <Standard_WarningsRestore.hxx>
 #endif
 
 #include <Draw_Main.hxx>
diff --git a/src/Draw/Draw_Main.hxx b/src/Draw/Draw_Main.hxx
index 2ccb4839f2..004a18bdba 100644
--- a/src/Draw/Draw_Main.hxx
+++ b/src/Draw/Draw_Main.hxx
@@ -35,7 +35,9 @@ Standard_EXPORT Standard_Integer Draw_Main (Standard_Integer argc, Standard_PCha
 // Declarations of macros DRAW_MAIN to be used in executables instead of explicit main/WinMain
 #ifdef _WIN32
 
+#include <Standard_WarningsDisable.hxx>
 #include <windows.h>
+#include <Standard_WarningsRestore.hxx>
 
 Standard_EXPORT Standard_Integer Draw_WinMain (HINSTANCE hInstance,
                                                HINSTANCE hPrevinstance, 
diff --git a/src/Draw/Draw_Viewer.hxx b/src/Draw/Draw_Viewer.hxx
index e8d409994d..6eb662f8ef 100644
--- a/src/Draw/Draw_Viewer.hxx
+++ b/src/Draw/Draw_Viewer.hxx
@@ -30,7 +30,9 @@
 #include <Draw_Color.hxx>
 
 #ifdef _WIN32
+#include <Standard_WarningsDisable.hxx>
 #include <windows.h>
+#include <Standard_WarningsRestore.hxx>
 #endif
 
 const Standard_Integer MAXVIEW  = 30;
diff --git a/src/Draw/Draw_WNTCommandWindow.cxx b/src/Draw/Draw_WNTCommandWindow.cxx
index a519264401..e44d2812c1 100644
--- a/src/Draw/Draw_WNTCommandWindow.cxx
+++ b/src/Draw/Draw_WNTCommandWindow.cxx
@@ -16,7 +16,9 @@
 
 #ifdef _WIN32
 
+#include <Standard_WarningsDisable.hxx>
 #include <windows.h>
+#include <Standard_WarningsRestore.hxx>
 
 #include <Draw_Window.hxx>
 #include <Draw_Appli.hxx>
diff --git a/src/Draw/Draw_WNTInit.cxx b/src/Draw/Draw_WNTInit.cxx
index 3c9b3a3195..4808d17728 100644
--- a/src/Draw/Draw_WNTInit.cxx
+++ b/src/Draw/Draw_WNTInit.cxx
@@ -17,7 +17,9 @@
 #ifdef _WIN32
 
 // include windows.h first to have all definitions available
+#include <Standard_WarningsDisable.hxx>
 #include <windows.h>
+#include <Standard_WarningsRestore.hxx>
 
 #include "Draw_Window.hxx"
 #include "Draw_WNTRessource.pxx"
diff --git a/src/Draw/Draw_WNTInit.pxx b/src/Draw/Draw_WNTInit.pxx
index 61b2b13fbe..495c5ce379 100644
--- a/src/Draw/Draw_WNTInit.pxx
+++ b/src/Draw/Draw_WNTInit.pxx
@@ -18,7 +18,10 @@
 
 #define APPCLASS L"TDRAW"
 #define APPTITLE L"Windows NT TDRAW"
+
+#include <Standard_WarningsDisable.hxx>
 #include <windows.h>
+#include <Standard_WarningsRestore.hxx>
 
 BOOL RegisterAppClass(HINSTANCE);
 VOID UnregisterAppClass(HINSTANCE);
diff --git a/src/Draw/Draw_WNTMainWindow.cxx b/src/Draw/Draw_WNTMainWindow.cxx
index c5dfadf86f..9d921336ce 100644
--- a/src/Draw/Draw_WNTMainWindow.cxx
+++ b/src/Draw/Draw_WNTMainWindow.cxx
@@ -16,7 +16,9 @@
 
 #ifdef _WIN32
 
+#include <Standard_WarningsDisable.hxx>
 #include <windows.h>
+#include <Standard_WarningsRestore.hxx>
 
 #include <Draw_Window.hxx>
 
diff --git a/src/Draw/Draw_WNTMainWindow.pxx b/src/Draw/Draw_WNTMainWindow.pxx
index 68307b9237..3d42d4e6e5 100644
--- a/src/Draw/Draw_WNTMainWindow.pxx
+++ b/src/Draw/Draw_WNTMainWindow.pxx
@@ -26,7 +26,9 @@
 /*
 ** PROCEDURES DE MAIN WINDOW
 */
+#include <Standard_WarningsDisable.hxx>
 #include <windows.h>
+#include <Standard_WarningsRestore.hxx>
 
 LRESULT APIENTRY WndProc(HWND, UINT, WPARAM, LPARAM);
 BOOL CreateProc(HWND);
diff --git a/src/Draw/Draw_Window.cxx b/src/Draw/Draw_Window.cxx
index c30c6bd096..28be716cdb 100644
--- a/src/Draw/Draw_Window.cxx
+++ b/src/Draw/Draw_Window.cxx
@@ -16,7 +16,9 @@
 
 // include windows.h first to have all definitions available
 #ifdef _WIN32
+#include <Standard_WarningsDisable.hxx>
 #include <windows.h>
+#include <Standard_WarningsRestore.hxx>
 #endif
 
 #include <Draw_Window.hxx>
diff --git a/src/Draw/Draw_Window.hxx b/src/Draw/Draw_Window.hxx
index 27eced584b..b21ccd7040 100644
--- a/src/Draw/Draw_Window.hxx
+++ b/src/Draw/Draw_Window.hxx
@@ -18,7 +18,9 @@
 #define Draw_Window_HeaderFile
 
 #if defined(_WIN32)
+  #include <Standard_WarningsDisable.hxx>
   #include <windows.h>
+  #include <Standard_WarningsRestore.hxx>
 #endif
 
 #include <Aspect_Drawable.hxx>
diff --git a/src/Font/Font_FontMgr.cxx b/src/Font/Font_FontMgr.cxx
index b9b2d47e8f..34e5f4c7cb 100644
--- a/src/Font/Font_FontMgr.cxx
+++ b/src/Font/Font_FontMgr.cxx
@@ -38,7 +38,10 @@ IMPLEMENT_STANDARD_RTTIEXT(Font_FontMgr,Standard_Transient)
 
 #if defined(_WIN32)
 
+  #include <Standard_WarningsDisable.hxx>
   #include <windows.h>
+  #include <Standard_WarningsRestore.hxx>
+
   #include <stdlib.h>
 
   #if defined(_MSC_VER) && defined(HAVE_FREETYPE)
diff --git a/src/IVtkDraw/IVtkDraw.cxx b/src/IVtkDraw/IVtkDraw.cxx
index 80cd7f0c8d..709436cf3d 100644
--- a/src/IVtkDraw/IVtkDraw.cxx
+++ b/src/IVtkDraw/IVtkDraw.cxx
@@ -14,7 +14,10 @@
 // commercial license or contractual agreement.
 
 #ifdef _WIN32
+  #include <Standard_WarningsDisable.hxx>
   #include <windows.h>
+  #include <Standard_WarningsRestore.hxx>
+
   #include <WNT_WClass.hxx>
   #include <WNT_Window.hxx>
 #endif
diff --git a/src/IVtkDraw/IVtkDraw_Interactor.hxx b/src/IVtkDraw/IVtkDraw_Interactor.hxx
index 41c92fb0fc..c28fd84100 100644
--- a/src/IVtkDraw/IVtkDraw_Interactor.hxx
+++ b/src/IVtkDraw/IVtkDraw_Interactor.hxx
@@ -21,7 +21,9 @@
 #include <Standard_Transient.hxx>
 
 #ifdef _WIN32
-#include <windows.h>
+  #include <Standard_WarningsDisable.hxx>
+  #include <windows.h>
+  #include <Standard_WarningsRestore.hxx>
 #else
 #include <X11/X.h>
 #include <X11/Xlib.h>
diff --git a/src/Media/Media_PlayerContext.cxx b/src/Media/Media_PlayerContext.cxx
index d18d4ae73e..abadda101c 100644
--- a/src/Media/Media_PlayerContext.cxx
+++ b/src/Media/Media_PlayerContext.cxx
@@ -18,7 +18,9 @@
 #endif
 
 #ifdef _WIN32
+  #include <Standard_WarningsDisable.hxx>
   #include <windows.h>
+  #include <Standard_WarningsRestore.hxx>
 #endif
 
 #include <Media_PlayerContext.hxx>
diff --git a/src/Message/Message_PrinterOStream.cxx b/src/Message/Message_PrinterOStream.cxx
index ee53f8187a..3e2ff602ce 100644
--- a/src/Message/Message_PrinterOStream.cxx
+++ b/src/Message/Message_PrinterOStream.cxx
@@ -14,7 +14,9 @@
 // commercial license or contractual agreement.
 
 #ifdef _WIN32
+  #include <Standard_WarningsDisable.hxx>
   #include <windows.h>
+  #include <Standard_WarningsRestore.hxx>
 #endif
 
 #include <Message_PrinterOStream.hxx>
diff --git a/src/Message/Message_PrinterSystemLog.cxx b/src/Message/Message_PrinterSystemLog.cxx
index 0c82c21671..ce27e7b0fb 100644
--- a/src/Message/Message_PrinterSystemLog.cxx
+++ b/src/Message/Message_PrinterSystemLog.cxx
@@ -12,7 +12,9 @@
 // commercial license or contractual agreement.
 
 #ifdef _WIN32
+  #include <Standard_WarningsDisable.hxx>
   #include <windows.h>
+  #include <Standard_WarningsRestore.hxx>
 #endif
 
 #include <Message_PrinterSystemLog.hxx>
diff --git a/src/NCollection/NCollection_UtfString.cxx b/src/NCollection/NCollection_UtfString.cxx
index 07556e2c93..bcda56a49b 100644
--- a/src/NCollection/NCollection_UtfString.cxx
+++ b/src/NCollection/NCollection_UtfString.cxx
@@ -14,7 +14,9 @@
 // commercial license or contractual agreement.
 
 #if defined(_WIN32)
+  #include <Standard_WarningsDisable.hxx>
   #include <windows.h>
+  #include <Standard_WarningsRestore.hxx>
 #endif
 
 #include <NCollection_UtfString.hxx>
diff --git a/src/NCollection/NCollection_WinHeapAllocator.cxx b/src/NCollection/NCollection_WinHeapAllocator.cxx
index 0e286bbcbd..3216b60bb6 100644
--- a/src/NCollection/NCollection_WinHeapAllocator.cxx
+++ b/src/NCollection/NCollection_WinHeapAllocator.cxx
@@ -19,7 +19,9 @@
 IMPLEMENT_STANDARD_RTTIEXT(NCollection_WinHeapAllocator,NCollection_BaseAllocator)
 
 #if(defined(_WIN32) || defined(__WIN32__))
+  #include <Standard_WarningsDisable.hxx>
   #include <windows.h>
+  #include <Standard_WarningsRestore.hxx>
 #endif
 
 //=======================================================================
diff --git a/src/OSD/OSD.cxx b/src/OSD/OSD.cxx
index c150fe7e87..2ef497b72e 100644
--- a/src/OSD/OSD.cxx
+++ b/src/OSD/OSD.cxx
@@ -56,7 +56,9 @@ Standard_Boolean OSD::CStringToReal(const Standard_CString aString,
 }
 
 #ifdef _WIN32
+  #include <Standard_WarningsDisable.hxx>
   #include <windows.h>
+  #include <Standard_WarningsRestore.hxx>
 #else
   #include <unistd.h>
 #endif
diff --git a/src/OSD/OSD_Chronometer.cxx b/src/OSD/OSD_Chronometer.cxx
index 24b1cad3ed..5a1ce55fc4 100644
--- a/src/OSD/OSD_Chronometer.cxx
+++ b/src/OSD/OSD_Chronometer.cxx
@@ -103,7 +103,9 @@ void OSD_Chronometer::GetThreadCPU (Standard_Real& theUserSeconds,
 
 #else
 
+#include <Standard_WarningsDisable.hxx>
 #include <windows.h>
+#include <Standard_WarningsRestore.hxx>
 
 //=======================================================================
 //function : EncodeFILETIME
diff --git a/src/OSD/OSD_DirectoryIterator.cxx b/src/OSD/OSD_DirectoryIterator.cxx
index 9e349588bc..44ce5bb780 100644
--- a/src/OSD/OSD_DirectoryIterator.cxx
+++ b/src/OSD/OSD_DirectoryIterator.cxx
@@ -180,9 +180,9 @@ Standard_Integer OSD_DirectoryIterator::Error()const{
 //-------------------  Windows NT sources for OSD_DirectoryIterator ------
 //------------------------------------------------------------------------
 
-
+#include <Standard_WarningsDisable.hxx>
 #include <windows.h>
-
+#include <Standard_WarningsRestore.hxx>
 
 #include <OSD_Directory.hxx>
 #include <OSD_DirectoryIterator.hxx>
diff --git a/src/OSD/OSD_Disk.cxx b/src/OSD/OSD_Disk.cxx
index ef37014bf8..488e5862ae 100644
--- a/src/OSD/OSD_Disk.cxx
+++ b/src/OSD/OSD_Disk.cxx
@@ -23,7 +23,9 @@
 #include <TCollection_ExtendedString.hxx>
 
 #ifdef _WIN32
+  #include <Standard_WarningsDisable.hxx>
   #include <windows.h>
+  #include <Standard_WarningsRestore.hxx>
 
   void _osd_wnt_set_error (OSD_Error&, Standard_Integer, ... );
 
diff --git a/src/OSD/OSD_Environment.cxx b/src/OSD/OSD_Environment.cxx
index 2a8794db65..a3c60c3bd0 100644
--- a/src/OSD/OSD_Environment.cxx
+++ b/src/OSD/OSD_Environment.cxx
@@ -232,7 +232,9 @@ Standard_Integer OSD_Environment::Error() const
 //-------------------  WNT Sources of OSD_Environment --------------------
 //------------------------------------------------------------------------
 
+#include <Standard_WarningsDisable.hxx>
 #include <windows.h>
+#include <Standard_WarningsRestore.hxx>
 
 #include <OSD_Environment.hxx>
 
diff --git a/src/OSD/OSD_Error.cxx b/src/OSD/OSD_Error.cxx
index 89c1b35108..271a0b7bf3 100755
--- a/src/OSD/OSD_Error.cxx
+++ b/src/OSD/OSD_Error.cxx
@@ -447,8 +447,10 @@ void OSD_Error::Perror() {
 #include <OSD_ErrorList.hxx>
 #include <TCollection_ExtendedString.hxx>
 
+#include <Standard_WarningsDisable.hxx>
 #include <windows.h>
 #include <strsafe.h>
+#include <Standard_WarningsRestore.hxx>
 
 typedef struct _error_table {
 
diff --git a/src/OSD/OSD_FileIterator.cxx b/src/OSD/OSD_FileIterator.cxx
index d77ca7e84f..0903cd839f 100644
--- a/src/OSD/OSD_FileIterator.cxx
+++ b/src/OSD/OSD_FileIterator.cxx
@@ -255,8 +255,9 @@ Standard_Integer OSD_FileIterator::Error()const{
 //-------------------  Windows NT sources for OSD_FileIterator -----------
 //------------------------------------------------------------------------
 
+#include <Standard_WarningsDisable.hxx>
 #include <windows.h>
-
+#include <Standard_WarningsRestore.hxx>
 
 #include <OSD_File.hxx>
 #include <OSD_FileIterator.hxx>
diff --git a/src/OSD/OSD_FileNode.cxx b/src/OSD/OSD_FileNode.cxx
index 352d24e606..61c5601435 100644
--- a/src/OSD/OSD_FileNode.cxx
+++ b/src/OSD/OSD_FileNode.cxx
@@ -365,7 +365,9 @@ Standard_Integer OSD_FileNode::Error()const{
 #ifdef NONLS
 #undef NONLS
 #endif
+#include <Standard_WarningsDisable.hxx>
 #include <windows.h>
+#include <Standard_WarningsRestore.hxx>
 
 #include <OSD_FileNode.hxx>
 #include <OSD_Protection.hxx>
diff --git a/src/OSD/OSD_Host.cxx b/src/OSD/OSD_Host.cxx
index 1547be3fbd..b2f305449a 100644
--- a/src/OSD/OSD_Host.cxx
+++ b/src/OSD/OSD_Host.cxx
@@ -181,7 +181,9 @@ Standard_Integer OSD_Host::Error()const{
 //-------------------  WNT Sources of OSD_Host ---------------------------
 //------------------------------------------------------------------------
 
+#include <Standard_WarningsDisable.hxx>
 #include <windows.h>
+#include <Standard_WarningsRestore.hxx>
 
 #include <OSD_Host.hxx>
 
diff --git a/src/OSD/OSD_MemInfo.cxx b/src/OSD/OSD_MemInfo.cxx
index d9bb913986..2dcf5cf583 100644
--- a/src/OSD/OSD_MemInfo.cxx
+++ b/src/OSD/OSD_MemInfo.cxx
@@ -14,11 +14,13 @@
 // commercial license or contractual agreement.
 
 #if (defined(_WIN32) || defined(__WIN32__))
+  #include <Standard_WarningsDisable.hxx>
   #include <windows.h>
   #include <winbase.h>
   #include <process.h>
   #include <malloc.h>
   #include <psapi.h>
+  #include <Standard_WarningsRestore.hxx>
   #ifdef _MSC_VER
     #pragma comment(lib, "Psapi.lib")
   #endif
diff --git a/src/OSD/OSD_OpenFile.cxx b/src/OSD/OSD_OpenFile.cxx
index 72b54b08ea..5581f0d096 100644
--- a/src/OSD/OSD_OpenFile.cxx
+++ b/src/OSD/OSD_OpenFile.cxx
@@ -12,8 +12,10 @@
 // commercial license or contractual agreement.
 
 #ifdef _WIN32
+  #include <Standard_WarningsDisable.hxx>
   #include <windows.h>
   #include <share.h>
+  #include <Standard_WarningsRestore.hxx>
 #endif
 
 #include <OSD_OpenFile.hxx>
diff --git a/src/OSD/OSD_PThread.hxx b/src/OSD/OSD_PThread.hxx
index ddc83f800a..100a8dd35c 100644
--- a/src/OSD/OSD_PThread.hxx
+++ b/src/OSD/OSD_PThread.hxx
@@ -20,7 +20,9 @@
 
 #ifdef _WIN32
 
+#include <Standard_WarningsDisable.hxx>
 #include <windows.h>
+#include <Standard_WarningsRestore.hxx>
 typedef HANDLE OSD_PThread;
 
 #else
diff --git a/src/OSD/OSD_Parallel.cxx b/src/OSD/OSD_Parallel.cxx
index 519518012c..a03e22d5e0 100644
--- a/src/OSD/OSD_Parallel.cxx
+++ b/src/OSD/OSD_Parallel.cxx
@@ -17,8 +17,10 @@
 #include <OSD_Parallel.hxx>
 
 #ifdef _WIN32
+  #include <Standard_WarningsDisable.hxx>
   #include <windows.h>
   #include <process.h>
+  #include <Standard_WarningsRestore.hxx>
 #else
   #include <sys/types.h>
   #include <unistd.h>
diff --git a/src/OSD/OSD_Path.cxx b/src/OSD/OSD_Path.cxx
index eab689b75b..f6d8cab407 100644
--- a/src/OSD/OSD_Path.cxx
+++ b/src/OSD/OSD_Path.cxx
@@ -874,7 +874,10 @@ void OSD_Path::SetExtension(const TCollection_AsciiString& aName){
 
 #include <Standard_ProgramError.hxx>
 
+#include <Standard_WarningsDisable.hxx>
 #include <windows.h>
+#include <Standard_WarningsRestore.hxx>
+
 #include <stdlib.h>
 
 #define TEST_RAISE( type, arg ) _test_raise (  ( type ), ( arg )  )
diff --git a/src/OSD/OSD_Process.cxx b/src/OSD/OSD_Process.cxx
index bb530e9b15..e65139c3e0 100644
--- a/src/OSD/OSD_Process.cxx
+++ b/src/OSD/OSD_Process.cxx
@@ -18,7 +18,9 @@
 #ifdef NOUSER
 #undef NOUSER // we need SW_HIDE from windows.h
 #endif
+#include <Standard_WarningsDisable.hxx>
 #include <windows.h>
+#include <Standard_WarningsRestore.hxx>
 #endif
 
 #include <OSD_Process.hxx>
diff --git a/src/OSD/OSD_SharedLibrary.cxx b/src/OSD/OSD_SharedLibrary.cxx
index b4adda843d..061ac4880f 100644
--- a/src/OSD/OSD_SharedLibrary.cxx
+++ b/src/OSD/OSD_SharedLibrary.cxx
@@ -182,7 +182,9 @@ void OSD_SharedLibrary::Destroy() {
 #ifndef STRICT
 #define STRICT
 #endif
+#include <Standard_WarningsDisable.hxx>
 #include <windows.h>
+#include <Standard_WarningsRestore.hxx>
 
 #include <OSD_Path.hxx>
 #include <OSD_SharedLibrary.hxx>
diff --git a/src/OSD/OSD_Timer.cxx b/src/OSD/OSD_Timer.cxx
index 5a0a176bf4..7779c04429 100644
--- a/src/OSD/OSD_Timer.cxx
+++ b/src/OSD/OSD_Timer.cxx
@@ -17,7 +17,9 @@
 #include <OSD_Timer.hxx>
 
 #ifdef _WIN32
+  #include <Standard_WarningsDisable.hxx>
   #include <windows.h>
+  #include <Standard_WarningsRestore.hxx>
 #else
   #include <sys/time.h>
 #endif
diff --git a/src/OSD/OSD_WNT.hxx b/src/OSD/OSD_WNT.hxx
index d112791279..d8d9c76cea 100644
--- a/src/OSD/OSD_WNT.hxx
+++ b/src/OSD/OSD_WNT.hxx
@@ -19,9 +19,11 @@
 #  define STRICT
 # endif  /* STRICT */
 
-# ifndef _INC_WINDOWS
-#  include <windows.h>
-# endif  /* _INC_WINDOWS */
+#ifndef _INC_WINDOWS
+  #include <Standard_WarningsDisable.hxx>
+  #include <windows.h>
+  #include <Standard_WarningsRestore.hxx>
+#endif  /* _INC_WINDOWS */
 
 # ifdef __cplusplus
 extern "C" {
diff --git a/src/OSD/OSD_signal.cxx b/src/OSD/OSD_signal.cxx
index 007f5ccaa9..564635dda6 100644
--- a/src/OSD/OSD_signal.cxx
+++ b/src/OSD/OSD_signal.cxx
@@ -59,7 +59,9 @@ void OSD::SetSignalStackTraceLength (Standard_Integer theLength)
 #ifdef NONLS
 #undef NONLS
 #endif
+#include <Standard_WarningsDisable.hxx>
 #include <windows.h>
+#include <Standard_WarningsRestore.hxx>
 
 #include <strsafe.h>
 
diff --git a/src/OpenGl/OpenGl_Context.cxx b/src/OpenGl/OpenGl_Context.cxx
index 303c398ec1..d33c8ceadb 100644
--- a/src/OpenGl/OpenGl_Context.cxx
+++ b/src/OpenGl/OpenGl_Context.cxx
@@ -14,7 +14,9 @@
 // commercial license or contractual agreement.
 
 #if defined(_WIN32)
+  #include <Standard_WarningsDisable.hxx>
   #include <windows.h>
+  #include <Standard_WarningsRestore.hxx>
 #endif
 
 #include <OpenGl_Context.hxx>
diff --git a/src/OpenGl/OpenGl_GlFunctions.cxx b/src/OpenGl/OpenGl_GlFunctions.cxx
index ead3f3cdb3..cd97f3e7c8 100644
--- a/src/OpenGl/OpenGl_GlFunctions.cxx
+++ b/src/OpenGl/OpenGl_GlFunctions.cxx
@@ -12,7 +12,9 @@
 // commercial license or contractual agreement.
 
 #if defined(_WIN32)
+  #include <Standard_WarningsDisable.hxx>
   #include <windows.h>
+  #include <Standard_WarningsRestore.hxx>
 #endif
 
 #include <OpenGl_Context.hxx>
diff --git a/src/OpenGl/OpenGl_GlFunctions.hxx b/src/OpenGl/OpenGl_GlFunctions.hxx
index a8be687e88..44b1355ad3 100644
--- a/src/OpenGl/OpenGl_GlFunctions.hxx
+++ b/src/OpenGl/OpenGl_GlFunctions.hxx
@@ -19,7 +19,9 @@
 // required for correct APIENTRY definition
 #if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)
   #define WIN32_LEAN_AND_MEAN
+  #include <Standard_WarningsDisable.hxx>
   #include <windows.h>
+  #include <Standard_WarningsRestore.hxx>
 #endif
 
 #include <Standard_Macro.hxx>
diff --git a/src/OpenGl/OpenGl_GraphicDriver.cxx b/src/OpenGl/OpenGl_GraphicDriver.cxx
index b98795d318..bf26fa88e0 100644
--- a/src/OpenGl/OpenGl_GraphicDriver.cxx
+++ b/src/OpenGl/OpenGl_GraphicDriver.cxx
@@ -14,7 +14,9 @@
 // commercial license or contractual agreement.
 
 #if defined(_WIN32)
+  #include <Standard_WarningsDisable.hxx>
   #include <windows.h>
+  #include <Standard_WarningsRestore.hxx>
 #endif
 
 #include <OpenGl_GraphicDriver.hxx>
diff --git a/src/OpenGl/glext.h b/src/OpenGl/glext.h
index 83facce0e6..a3d234d6a3 100644
--- a/src/OpenGl/glext.h
+++ b/src/OpenGl/glext.h
@@ -19,7 +19,9 @@ extern "C" {
 #ifndef WIN32_LEAN_AND_MEAN
 #define WIN32_LEAN_AND_MEAN 1
 #endif
-#include <windows.h>
+  #include <Standard_WarningsDisable.hxx>
+  #include <windows.h>
+  #include <Standard_WarningsRestore.hxx>
 #endif
 
 #ifndef APIENTRY
diff --git a/src/Standard/Standard.cxx b/src/Standard/Standard.cxx
index bc601165c6..0991bc8b2e 100644
--- a/src/Standard/Standard.cxx
+++ b/src/Standard/Standard.cxx
@@ -23,7 +23,10 @@
 
 #include <stdlib.h>
 #if(defined(_WIN32) || defined(__WIN32__))
+  #include <Standard_WarningsDisable.hxx>
   #include <windows.h>
+  #include <Standard_WarningsRestore.hxx>
+
   #include <malloc.h>
   #include <locale.h>
 #endif
diff --git a/src/Standard/Standard_Assert.hxx b/src/Standard/Standard_Assert.hxx
index 628b50db46..3b3f7e4372 100644
--- a/src/Standard/Standard_Assert.hxx
+++ b/src/Standard/Standard_Assert.hxx
@@ -77,7 +77,9 @@ inline void Standard_ASSERT_DO_NOTHING() {}
       #define Standard_ASSERT_DBGBREAK_() __debugbreak()
     #else
       // WinAPI function
+      #include <Standard_WarningsDisable.hxx>
       #include <windows.h>
+      #include <Standard_WarningsRestore.hxx>
       #define Standard_ASSERT_DBGBREAK_() DebugBreak()
     #endif
   #elif defined(__EMSCRIPTEN__)
diff --git a/src/Standard/Standard_Condition.cxx b/src/Standard/Standard_Condition.cxx
index 232ae2b2ec..2d3fa1afc5 100644
--- a/src/Standard/Standard_Condition.cxx
+++ b/src/Standard/Standard_Condition.cxx
@@ -13,7 +13,9 @@
 // commercial license or contractual agreement.
 
 #ifdef _WIN32
+  #include <Standard_WarningsDisable.hxx>
   #include <windows.h>
+  #include <Standard_WarningsRestore.hxx>
 #else
   #include <pthread.h>
   #include <unistd.h>
diff --git a/src/Standard/Standard_ErrorHandler.cxx b/src/Standard/Standard_ErrorHandler.cxx
index 3fc6c189d9..c0dafa050c 100644
--- a/src/Standard/Standard_ErrorHandler.cxx
+++ b/src/Standard/Standard_ErrorHandler.cxx
@@ -24,7 +24,9 @@
 #ifndef _WIN32
 #include <pthread.h>
 #else
+#include <Standard_WarningsDisable.hxx>
 #include <windows.h>
+#include <Standard_WarningsRestore.hxx>
 #endif
 
 // ===========================================================================
diff --git a/src/Standard/Standard_MMgrOpt.cxx b/src/Standard/Standard_MMgrOpt.cxx
index 9ba6935472..9083349b0c 100644
--- a/src/Standard/Standard_MMgrOpt.cxx
+++ b/src/Standard/Standard_MMgrOpt.cxx
@@ -14,7 +14,9 @@
 // commercial license or contractual agreement.
 
 #ifdef _WIN32
+#include <Standard_WarningsDisable.hxx>
 #include <windows.h>
+#include <Standard_WarningsRestore.hxx>
 #endif
 
 #include <Standard_MMgrOpt.hxx>
diff --git a/src/Standard/Standard_Mutex.hxx b/src/Standard/Standard_Mutex.hxx
index dfdfb6a289..4d45088284 100644
--- a/src/Standard/Standard_Mutex.hxx
+++ b/src/Standard/Standard_Mutex.hxx
@@ -21,7 +21,9 @@
 #include <Standard_ErrorHandler.hxx>
 
 #if defined(_WIN32)
+  #include <Standard_WarningsDisable.hxx>
   #include <windows.h>
+  #include <Standard_WarningsRestore.hxx>
 #else
   #include <pthread.h>
   #include <unistd.h>
diff --git a/src/Standard/Standard_UUID.hxx b/src/Standard/Standard_UUID.hxx
index 9a863ec4c7..ca67c1fe14 100644
--- a/src/Standard/Standard_UUID.hxx
+++ b/src/Standard/Standard_UUID.hxx
@@ -18,7 +18,9 @@
 #include <Standard_Type.hxx>
 
 #ifdef _WIN32
-#include <windows.h>
+  #include <Standard_WarningsDisable.hxx>
+  #include <windows.h>
+  #include <Standard_WarningsRestore.hxx>
 #else
 typedef struct {
   unsigned long Data1 ;
diff --git a/src/ViewerTest/ViewerTest_ViewerCommands.cxx b/src/ViewerTest/ViewerTest_ViewerCommands.cxx
index 0a37eb4eef..3d1edd9f79 100644
--- a/src/ViewerTest/ViewerTest_ViewerCommands.cxx
+++ b/src/ViewerTest/ViewerTest_ViewerCommands.cxx
@@ -15,7 +15,9 @@
 // commercial license or contractual agreement.
 
 #if defined(_WIN32)
+  #include <Standard_WarningsDisable.hxx>
   #include <windows.h>
+  #include <Standard_WarningsRestore.hxx>
 #endif
 
 #include <ViewerTest.hxx>
diff --git a/src/WNT/WNT_Dword.hxx b/src/WNT/WNT_Dword.hxx
index 8249a12af6..8e0a904973 100644
--- a/src/WNT/WNT_Dword.hxx
+++ b/src/WNT/WNT_Dword.hxx
@@ -17,22 +17,23 @@
 
 // Purpose: Defines a Windows NT DWORD type.
 
-# ifndef __WINDOWS_H_INCLUDED
-#  define __WINDOWS_H_INCLUDED
-#  ifndef STRICT
-#   define STRICT
-#  endif  /* STRICT */
-#  define WIN32_LEAN_AND_MEAN
-#  include <windows.h>
-
-#ifdef DrawText
-#undef DrawText
-#endif
-
-#  ifdef THIS
-#   undef THIS
-#  endif  // THIS
-# endif  // __WINDOWS_H_INCLUDED
+#ifndef __WINDOWS_H_INCLUDED
+#define __WINDOWS_H_INCLUDED
+  #ifndef STRICT
+    #define STRICT
+  #endif
+  #define WIN32_LEAN_AND_MEAN
+  #include <Standard_WarningsDisable.hxx>
+  #include <windows.h>
+  #include <Standard_WarningsRestore.hxx>
+
+  #ifdef DrawText
+    #undef DrawText
+  #endif
+  #ifdef THIS
+    #undef THIS
+  #endif
+#endif  // __WINDOWS_H_INCLUDED
 
 # ifndef __STANDARD_TYPE_HXX_INCLUDED
 #  define __STANDARD_TYPE_HXX_INCLUDED
diff --git a/src/WNT/WNT_WClass.cxx b/src/WNT/WNT_WClass.cxx
index cf168fb41d..e56d6eddc3 100644
--- a/src/WNT/WNT_WClass.cxx
+++ b/src/WNT/WNT_WClass.cxx
@@ -13,7 +13,9 @@
 // commercial license or contractual agreement.
 
 #if defined(_WIN32)
+  #include <Standard_WarningsDisable.hxx>
   #include <windows.h>
+  #include <Standard_WarningsRestore.hxx>
 #endif
 
 #include <WNT_WClass.hxx>
diff --git a/src/WNT/WNT_Window.cxx b/src/WNT/WNT_Window.cxx
index 8f9ed39f2a..389ded4edf 100644
--- a/src/WNT/WNT_Window.cxx
+++ b/src/WNT/WNT_Window.cxx
@@ -14,7 +14,9 @@
 
 #if defined(_WIN32)
   // include windows.h first to have all definitions available
+  #include <Standard_WarningsDisable.hxx>
   #include <windows.h>
+  #include <Standard_WarningsRestore.hxx>
 #endif
 
 #include <WNT_Window.hxx>
-- 
2.31.1.windows.1

