0030609: Coding - eliminate warnings issued by gcc 8.1.0
authortiv <tiv@opencascade.com>
Fri, 25 Oct 2019 13:01:09 +0000 (16:01 +0300)
committerapn <apn@opencascade.com>
Wed, 30 Oct 2019 20:26:08 +0000 (23:26 +0300)
Warnings issued by gcc 8.1.0 are eliminated.

New Standard_WarningDisableFunctionCast.hxx header file is introduced to disable GCC warning "-Wcast-function-type" in those files *.cxx where it is issued. This warning is issued when the conversion from the pointer to one function type to the pointer to another function type takes places, it was added in gcc 8.1.0.

The function MyVISEDG in SWDRAW_ShapeAnalysis.cxx is removed as it does not seem to do anything useful and relevant DRAW command K_VISEDG is never used in tests.

15 files changed:
src/BiTgte/BiTgte_Blend.cxx
src/D3DHost/D3DHost_View.cxx
src/Draw/Draw.cxx
src/Draw/Draw_Window.cxx
src/Message/Message_MsgFile.cxx
src/OSD/OSD_Parallel.cxx
src/OSD/OSD_SharedLibrary.cxx
src/OSD/OSD_WNT.cxx
src/OSD/OSD_signal.cxx
src/OpenGl/OpenGl_Window.cxx
src/Plugin/Plugin.cxx
src/QABugs/QABugs_20.cxx
src/SWDRAW/SWDRAW_ShapeAnalysis.cxx
src/Standard/FILES
src/Standard/Standard_WarningDisableFunctionCast.hxx [new file with mode: 0644]

index 86b75e8..bae0791 100644 (file)
@@ -1192,35 +1192,42 @@ BiTgte_ContactType BiTgte_Blend::ContactType(const Standard_Integer Index)
   }
   BiTgte_ContactType Type = BiTgte_VertexVertex;
 
-  switch (Type1) {
-    
-  case TopAbs_VERTEX:
-    switch (Type2) {
-    case TopAbs_VERTEX: Type = BiTgte_VertexVertex; break;
-    case TopAbs_EDGE:   Type = BiTgte_EdgeVertex;   break;
-    case TopAbs_FACE:   Type = BiTgte_FaceVertex;   break;
-    default:
+  switch (Type1)
+  {
+    case TopAbs_VERTEX:
+      switch (Type2)
+      {
+        case TopAbs_VERTEX: Type = BiTgte_VertexVertex; break;
+        case TopAbs_EDGE:   Type = BiTgte_EdgeVertex;   break;
+        case TopAbs_FACE:   Type = BiTgte_FaceVertex;   break;
+        default:
+          break;
+      }
       break;
-    }
-    
-  case TopAbs_EDGE:
-    switch (Type2) {
-    case TopAbs_EDGE:   Type = BiTgte_EdgeEdge; break;
-    case TopAbs_FACE:   Type = BiTgte_FaceEdge; break;
-    default:
+
+    case TopAbs_EDGE:
+      switch (Type2)
+      {
+        case TopAbs_EDGE:   Type = BiTgte_EdgeEdge;     break;
+        case TopAbs_FACE:   Type = BiTgte_FaceEdge;     break;
+        default:
+          break;
+      }
       break;
-   }
-    
-  case TopAbs_FACE:
-    switch (Type2) {
-    case TopAbs_FACE:   Type = BiTgte_FaceEdge; break;
+
+    case TopAbs_FACE:
+      switch (Type2)
+      {
+        case TopAbs_FACE:   Type = BiTgte_FaceEdge;     break;
+        default:
+          break;
+      }
+      break;
+
     default:
       break;
-    }
-  default:
-    break;
   }
-  
+
   return Type;
 }
 
index 6b9f76b..fc61996 100644 (file)
@@ -20,6 +20,8 @@
 #include <D3DHost_GraphicDriver.hxx>
 #include <TCollection_ExtendedString.hxx>
 
+#include <Standard_WarningDisableFunctionCast.hxx>
+
 IMPLEMENT_STANDARD_RTTIEXT(D3DHost_View,OpenGl_View)
 
 // =======================================================================
index f0a27e4..18a015e 100644 (file)
@@ -37,6 +37,9 @@
 #include <TCollection_AsciiString.hxx>
 
 #include <tcl.h>
+
+#include <Standard_WarningDisableFunctionCast.hxx>
+
 // on MSVC, use #pragma to define name of the Tcl library to link with,
 // depending on Tcl version number
 #ifdef _MSC_VER
index 4602f31..f096767 100644 (file)
@@ -2003,7 +2003,7 @@ void Segment::Init(Standard_Integer a1, Standard_Integer a2,
   y2=a4;
 }
 
-static DWORD WINAPI tkLoop(VOID);
+static DWORD WINAPI tkLoop (LPVOID theThreadParameter);
 #ifdef _TK
 static Tk_Window mainWindow;
 #endif
@@ -2027,12 +2027,12 @@ Standard_Boolean Init_Appli(HINSTANCE hInst,
   dwMainThreadId = GetCurrentThreadId();
 
   //necessary for normal Tk operation
-  hThread = CreateThread(NULL, // no security attributes
-                           0,                           // use default stack size
-                           (LPTHREAD_START_ROUTINE) tkLoop, // thread function
-                           NULL,                    // no thread function argument
-                           0,                       // use default creation flags
-                           &IDThread);
+  hThread = CreateThread (NULL,       // no security attributes
+                          0,          // use default stack size
+                          tkLoop,     // thread function
+                          NULL,       // no thread function argument
+                          0,          // use default creation flags
+                          &IDThread);
   if (!hThread) {
     std::cout << "Failed to create Tcl/Tk main loop thread. Switching to batch mode..." << std::endl;
     Draw_Batch = Standard_True;
@@ -2082,8 +2082,9 @@ Standard_Boolean Draw_Interprete (const char*);
 /*--------------------------------------------------------*\
 |  readStdinThreadFunc
 \*--------------------------------------------------------*/
-static DWORD WINAPI readStdinThreadFunc()
+static DWORD WINAPI readStdinThreadFunc (const LPVOID theThreadParameter)
 {
+  (void)theThreadParameter;
   if (!Draw_IsConsoleSubsystem)
   {
     return 1;
@@ -2246,8 +2247,9 @@ static void ResetStdChannel (int type)
 /*--------------------------------------------------------*\
 |  tkLoop: implements Tk_Main()-like behaviour in a separate thread
 \*--------------------------------------------------------*/
-static DWORD WINAPI tkLoop(VOID)
+static DWORD WINAPI tkLoop (const LPVOID theThreadParameter)
 {
+  (void)theThreadParameter;
   Tcl_CreateExitHandler(exitProc, 0);
   
   Draw_Interpretor& aCommands = Draw::GetInterpretor();
@@ -2309,7 +2311,7 @@ static DWORD WINAPI tkLoop(VOID)
 #endif
       }
     }
-    catch (Standard_Failure)
+    catch (const Standard_Failure&)
     {
       std::cout << "tkLoop: exception in TK_Init\n";
     }
@@ -2389,12 +2391,12 @@ void Run_Appli(HWND hWnd)
   DWORD IDThread;
   HANDLE hThread;
   if (Draw_IsConsoleSubsystem) {
-    hThread = CreateThread(NULL, // no security attributes
-                           0,                           // use default stack size
-                           (LPTHREAD_START_ROUTINE) readStdinThreadFunc, // thread function
-                           NULL,                    // no thread function argument
-                           0,                       // use default creation flags
-                           &IDThread);              // returns thread identifier
+    hThread = CreateThread (NULL,                // no security attributes
+                            0,                   // use default stack size
+                            readStdinThreadFunc, // thread function
+                            NULL,                // no thread function argument
+                            0,                   // use default creation flags
+                            &IDThread);          // returns thread identifier
     if (!hThread) {
       std::cout << "pb in creation of the thread reading stdin" << std::endl;
       Draw_IsConsoleSubsystem = Standard_False;
index 2c5deba..22ffbbc 100644 (file)
@@ -257,7 +257,7 @@ Standard_Boolean Message_MsgFile::LoadFile (const Standard_CString theFileName)
     {
       // Reverse the bytes throughout the buffer
       const Standard_ExtCharacter* const anEnd =
-        reinterpret_cast<const Standard_ExtCharacter* const>(&anMsgBuffer[aFileSize]);
+        reinterpret_cast<const Standard_ExtCharacter*>(&anMsgBuffer[aFileSize]);
 
       for (Standard_ExtCharacter* aPtr = aUnicodeBuffer; aPtr < anEnd; aPtr++)
       {
index 97d502a..d112341 100644 (file)
@@ -31,6 +31,8 @@
   #endif
 #endif
 
+#include <Standard_WarningDisableFunctionCast.hxx>
+
 namespace {
 
 #if defined(_WIN32) && !defined(OCCT_UWP)
index b635baa..b4adda8 100644 (file)
@@ -189,6 +189,8 @@ void OSD_SharedLibrary::Destroy() {
 #include <TCollection_AsciiString.hxx>
 #include <TCollection_ExtendedString.hxx>
 
+#include <Standard_WarningDisableFunctionCast.hxx>
+
 static DWORD              lastDLLError;
 
 static wchar_t errMsg[1024];
index ef38d80..f7acbd1 100644 (file)
@@ -699,12 +699,13 @@ retry:
   if (retVal || (!retVal && GetLastError() == ERROR_ALREADY_EXISTS))
   {
     size_t anOldDirLength;
-    StringCchLengthW (oldDir, sizeof(oldDir) / sizeof(oldDir[0]), &anOldDirLength);
+    StringCchLengthW (oldDir, MAX_PATH, &anOldDirLength);
+    const size_t aNameLength = anOldDirLength + WILD_CARD_LEN + sizeof (L'\x00');
     if ((pFD = (WIN32_FIND_DATAW* )HeapAlloc (hHeap, 0, sizeof(WIN32_FIND_DATAW))) != NULL
-     && (pName =        (wchar_t* )HeapAlloc (hHeap, 0, anOldDirLength + WILD_CARD_LEN + sizeof(L'\x00'))) != NULL)
+     && (pName =        (wchar_t* )HeapAlloc (hHeap, 0, aNameLength)) != NULL)
     {
-      StringCchCopyW (pName, sizeof(pName) / sizeof(pName[0]), oldDir);
-      StringCchCatW  (pName, sizeof(pName), WILD_CARD);
+      StringCchCopyW (pName, aNameLength, oldDir);
+      StringCchCatW  (pName, aNameLength, WILD_CARD);
       retVal = TRUE;
       hFindFile = FindFirstFileExW (pName, FindExInfoStandard, pFD, FindExSearchNameMatch, NULL, 0);
       for (BOOL fFind = hFindFile != INVALID_HANDLE_VALUE; fFind; fFind = FindNextFileW (hFindFile, pFD))
@@ -715,23 +716,24 @@ retry:
           continue;
         }
 
-        size_t anOldDirLength2 = 0, aNewDirLength = 0, aFileNameLength = 0;
-        StringCchLengthW (oldDir, sizeof(oldDir) / sizeof(oldDir[0]), &anOldDirLength2);
-        StringCchLengthW (newDir, sizeof(newDir) / sizeof(newDir[0]), &aNewDirLength);
+        size_t aNewDirLength = 0, aFileNameLength = 0;
+        StringCchLengthW (newDir, MAX_PATH, &aNewDirLength);
         StringCchLengthW (pFD->cFileName, sizeof(pFD->cFileName) / sizeof(pFD->cFileName[0]), &aFileNameLength);
-        if ((pFullNameSrc = (wchar_t* )HeapAlloc (hHeap, 0, anOldDirLength2 + aFileNameLength + sizeof(L'/') + sizeof(L'\x00'))) == NULL
-          || (pFullNameDst = (wchar_t* )HeapAlloc (hHeap, 0, aNewDirLength   + aFileNameLength + sizeof(L'/') + sizeof(L'\x00'))) == NULL)
+        const size_t aFullNameSrcLength = anOldDirLength + aFileNameLength + sizeof (L'/') + sizeof (L'\x00');
+        const size_t aFullNameDstLength = aNewDirLength + aFileNameLength + sizeof (L'/') + sizeof (L'\x00');
+        if ((pFullNameSrc = (wchar_t* )HeapAlloc (hHeap, 0, aFullNameSrcLength)) == NULL
+          || (pFullNameDst = (wchar_t* )HeapAlloc (hHeap, 0, aFullNameDstLength)) == NULL)
         {
           break;
         }
 
-        StringCchCopyW (pFullNameSrc, sizeof(pFullNameSrc) / sizeof(pFullNameSrc[0]), oldDir);
-        StringCchCatW  (pFullNameSrc, sizeof(pFullNameSrc) / sizeof(pFullNameSrc[0]), L"/");
-        StringCchCatW  (pFullNameSrc, sizeof(pFullNameSrc) / sizeof(pFullNameSrc[0]), pFD->cFileName);
+        StringCchCopyW (pFullNameSrc, aFullNameSrcLength, oldDir);
+        StringCchCatW  (pFullNameSrc, aFullNameSrcLength, L"/");
+        StringCchCatW  (pFullNameSrc, aFullNameSrcLength, pFD->cFileName);
 
-        StringCchCopyW (pFullNameDst, sizeof(pFullNameDst) / sizeof(pFullNameDst[0]), newDir);
-        StringCchCatW  (pFullNameDst, sizeof(pFullNameDst) / sizeof(pFullNameDst[0]), L"/");
-        StringCchCatW  (pFullNameDst, sizeof(pFullNameDst) / sizeof(pFullNameDst[0]), pFD->cFileName);
+        StringCchCopyW (pFullNameDst, aFullNameDstLength, newDir);
+        StringCchCatW  (pFullNameDst, aFullNameDstLength, L"/");
+        StringCchCatW  (pFullNameDst, aFullNameDstLength, pFD->cFileName);
 
         if ((pFD->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0)
         {
@@ -853,12 +855,13 @@ BOOL CopyDirectory (const wchar_t* dirSrc, const wchar_t* dirDst)
   if (retVal || (!retVal && GetLastError() == ERROR_ALREADY_EXISTS))
   {
     size_t aDirSrcLength = 0;
-    StringCchLengthW (dirSrc, sizeof(dirSrc) / sizeof(dirSrc[0]), &aDirSrcLength);
+    StringCchLengthW (dirSrc, MAX_PATH, &aDirSrcLength);
+    const size_t aNameLength = aDirSrcLength + WILD_CARD_LEN + sizeof (L'\x00');
     if ((pFD = (WIN32_FIND_DATAW* )HeapAlloc (hHeap, 0, sizeof(WIN32_FIND_DATAW))) != NULL
-     && (pName = (wchar_t* )HeapAlloc (hHeap, 0, aDirSrcLength + WILD_CARD_LEN + sizeof(L'\x00'))) != NULL)
+     && (pName = (wchar_t* )HeapAlloc (hHeap, 0, aNameLength)) != NULL)
     {
-      StringCchCopyW(pName, sizeof(pName) / sizeof(pName[0]), dirSrc);
-      StringCchCatW (pName, sizeof(pName) / sizeof(pName[0]), WILD_CARD);
+      StringCchCopyW(pName, aNameLength, dirSrc);
+      StringCchCatW (pName, aNameLength, WILD_CARD);
 
       retVal = TRUE;
       hFindFile = FindFirstFileExW (pName, FindExInfoStandard, pFD, FindExSearchNameMatch, NULL, 0);
@@ -870,23 +873,24 @@ BOOL CopyDirectory (const wchar_t* dirSrc, const wchar_t* dirDst)
           continue;
         }
 
-        size_t aDirSrcLength2 = 0, aDirDstLength = 0, aFileNameLength = 0;
-        StringCchLengthW (dirSrc, sizeof(dirSrc) / sizeof(dirSrc[0]), &aDirSrcLength2);
-        StringCchLengthW (dirDst, sizeof(dirDst) / sizeof(dirDst[0]), &aDirDstLength);
+        size_t aDirDstLength = 0, aFileNameLength = 0;
+        StringCchLengthW (dirDst, MAX_PATH, &aDirDstLength);
         StringCchLengthW (pFD->cFileName, sizeof(pFD->cFileName) / sizeof(pFD->cFileName[0]), &aFileNameLength);
-        if ((pFullNameSrc = (wchar_t* )HeapAlloc (hHeap, 0, aDirSrcLength2 + aFileNameLength + sizeof(L'/') + sizeof(L'\x00'))) == NULL
-         || (pFullNameDst = (wchar_t* )HeapAlloc (hHeap, 0, aDirDstLength  + aFileNameLength + sizeof(L'/') + sizeof(L'\x00'))) == NULL)
+        const size_t aFullNameSrcLength = aDirSrcLength + aFileNameLength + sizeof (L'/') + sizeof (L'\x00');
+        const size_t aFullNameDstLength = aDirDstLength + aFileNameLength + sizeof (L'/') + sizeof (L'\x00');
+        if ((pFullNameSrc = (wchar_t* )HeapAlloc (hHeap, 0, aFullNameSrcLength)) == NULL
+         || (pFullNameDst = (wchar_t* )HeapAlloc (hHeap, 0, aFullNameDstLength)) == NULL)
         {
           break;
         }
 
-        StringCchCopyW (pFullNameSrc, sizeof(pFullNameSrc) / sizeof(pFullNameSrc[0]), dirSrc);
-        StringCchCatW  (pFullNameSrc, sizeof(pFullNameSrc) / sizeof(pFullNameSrc[0]), L"/");
-        StringCchCatW  (pFullNameSrc, sizeof(pFullNameSrc) / sizeof(pFullNameSrc[0]), pFD->cFileName);
+        StringCchCopyW (pFullNameSrc, aFullNameSrcLength, dirSrc);
+        StringCchCatW  (pFullNameSrc, aFullNameSrcLength, L"/");
+        StringCchCatW  (pFullNameSrc, aFullNameSrcLength, pFD->cFileName);
 
-        StringCchCopyW (pFullNameDst, sizeof(pFullNameDst) / sizeof(pFullNameDst[0]), dirDst);
-        StringCchCatW  (pFullNameDst, sizeof(pFullNameDst) / sizeof(pFullNameDst[0]), L"/");
-        StringCchCatW  (pFullNameDst, sizeof(pFullNameDst) / sizeof(pFullNameDst[0]), pFD->cFileName);
+        StringCchCopyW (pFullNameDst, aFullNameDstLength, dirDst);
+        StringCchCatW  (pFullNameDst, aFullNameDstLength, L"/");
+        StringCchCatW  (pFullNameDst, aFullNameDstLength, pFD->cFileName);
         if ((pFD->dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0)
         {
           retVal = CopyDirectory (pFullNameSrc, pFullNameDst);
index af86c67..d36c531 100644 (file)
@@ -18,6 +18,8 @@
 #include <Standard_Overflow.hxx>
 #include <Standard_Assert.hxx>
 
+#include <Standard_WarningDisableFunctionCast.hxx>
+
 static OSD_SignalMode OSD_WasSetSignal = OSD_SignalMode_AsIs;
 
 //=======================================================================
index b01f7f5..d16e754 100644 (file)
@@ -28,6 +28,8 @@
 
 #include <memory>
 
+#include <Standard_WarningDisableFunctionCast.hxx>
+
 IMPLEMENT_STANDARD_RTTIEXT(OpenGl_Window,Standard_Transient)
 
 #if defined(HAVE_EGL)
index b478296..6ad8b23 100644 (file)
@@ -24,6 +24,8 @@
 #include <Standard_Transient.hxx>
 #include <TCollection_AsciiString.hxx>
 
+#include <Standard_WarningDisableFunctionCast.hxx>
+
 static Standard_Character tc[1000];
 static Standard_PCharacter thePluginId = tc;
 
index 8a7ab78..3d81fbf 100644 (file)
@@ -3154,7 +3154,7 @@ static Standard_Integer OCC30708_1 (Draw_Interpretor& di, Standard_Integer, cons
     it.Initialize (empty);
 
   }
-  catch (Standard_Failure)
+  catch (const Standard_Failure&)
   {
     di << "Cannot initialize TopoDS_Iterator with null shape\n";
     return 0;
@@ -3179,7 +3179,7 @@ static Standard_Integer OCC30708_2 (Draw_Interpretor& di, Standard_Integer, cons
     TopoDS_Wire empty;
     BRepLib_MakeWire aWBuilder (empty);
   }
-  catch (Standard_Failure)
+  catch (const Standard_Failure&)
   {
     di << "Cannot initialize BRepLib_MakeWire with null wire\n";
   }
index 401c896..6d3ebcd 100644 (file)
@@ -830,66 +830,6 @@ static Standard_Integer closefreebounds (Draw_Interpretor& di,
 }
 
 
-//=======================================================================
-//function : MyVISEDG
-//purpose  : 
-//=======================================================================
-static Standard_Integer MyVISEDG (Draw_Interpretor& /*di*/,
-                              Standard_Integer n, const char** a)
-{
-  if (n >4) return 1;
-  TopoDS_Shape MaListe = DBRep::Get(a[1]);
-  if (MaListe.IsNull()) return 1;
-  TopoDS_Compound TheList = TopoDS::Compound(MaListe);
-  if (TheList.IsNull()) return 1;
-  Standard_Real toler = 0.001;
-  int create = 0;
-  if ( n >= 3) toler = Draw::Atof(a[2]);
-  if (n == 4 && !strcmp(a[3],"C")) create = 1;
-  ShapeAnalysis_FreeBounds F(TheList,toler);
-  //
-  //
-  //
-  char name[100];
-  char num[5];
-  if (!create)
-    {
-      TopoDS_Compound Wires = F.GetClosedWires();
-      TopoDS_Iterator S(Wires);
-      Standard_Integer iwire = 0;
-      while (S.More())
-       {
-         Sprintf (num,"%d",iwire);
-         name[0] = 'w';
-         name[1] = '\0';
-         strncat(name,num,strlen(num));
-         name[strlen(name)] = '\0';
-         DBRep::Set(name,S.Value());
-         S.Next();
-         iwire++;
-       }
-      iwire = 0;
-      TopoDS_Compound Edges = F.GetOpenWires();
-      S.Initialize(Edges);
-      iwire = 0;
-      while (S.More())
-       {
-         Sprintf (num,"%d",iwire);
-         name[0] = 'E';
-         name[1] = '\0';
-         strncat(name,num,strlen(num));
-         name[strlen(name)] = '\0';
-         DBRep::Set(name,S.Value());
-         S.Next();
-         iwire++;
-       }
-    }
-  else
-    {
-    }
-  return 0;
-}
-
 static Standard_Integer getareacontour (Draw_Interpretor& di,
                                         Standard_Integer n, const char** a)
 {
@@ -1076,9 +1016,6 @@ static Standard_Integer checkedge(Draw_Interpretor& di, Standard_Integer argc, c
   theCommands.Add("fbclose",
                  "shp sewtoler closetoler [splitclosed [splitopen]] - closes free bounds; use sewtoler <= 0 for shells (no sewing call)",
                  __FILE__, closefreebounds, groupold);
-  theCommands.Add("K_VISEDG",
-                  "K_VISEDG Visu of free edge of a compound of faces.",
-                  __FILE__, MyVISEDG, groupold);
     
   theCommands.Add("getareacontour","wire ",__FILE__, getareacontour, groupold);
   theCommands.Add ("checkselfintersection","wire [face]", __FILE__,checkselfintersection,g);
index 84ad0ec..dc0f0c9 100755 (executable)
@@ -33,6 +33,7 @@ Standard_ExtString.cxx
 Standard_ExtString.hxx
 Standard_Failure.cxx
 Standard_Failure.hxx
+Standard_WarningDisableFunctionCast.hxx
 Standard_GUID.cxx
 Standard_GUID.hxx
 Standard_Handle.hxx
diff --git a/src/Standard/Standard_WarningDisableFunctionCast.hxx b/src/Standard/Standard_WarningDisableFunctionCast.hxx
new file mode 100644 (file)
index 0000000..5a8a4ff
--- /dev/null
@@ -0,0 +1,33 @@
+// Copyright (c) 2019 OPEN CASCADE SAS
+//
+// This file is part of Open CASCADE Technology software library.
+//
+// This library is free software; you can redistribute it and/or modify it under
+// the terms of the GNU Lesser General Public License version 2.1 as published
+// by the Free Software Foundation, with special exception defined in the file
+// OCCT_LGPL_EXCEPTION.txt. Consult the file LICENSE_LGPL_21.txt included in OCCT
+// distribution for complete text of the license and disclaimer of any warranty.
+//
+// Alternatively, this file may be used under the terms of Open CASCADE
+// commercial license or contractual agreement.
+
+#ifndef _Standard_WarningDisableFunctionCast_HeaderFile
+#define _Standard_WarningDisableFunctionCast_HeaderFile
+
+//! @file
+//! Include this file to disable GCC warning -Wcast-function-type introduced in GCC 8.1.
+//!
+//! This diagnostic warns when a function pointer is cast to an incompatible function pointer.
+//! Existing APIs loading function pointer from library (like dlsym() or wglGetProcAddress()) have no
+//! possibility to return function of specified type nor to verify that exported symbol actually
+//! matches the expected function signature, so that unsafe function cast is unavoidable.
+//! There is no way to prevent this warning at OCCT level (until safer APIs is introduced), thus
+//! suppressing it is the only feasible way to avoid it. As this warning still can point out broken
+//! places, it should be suppressed only locally, where usage of function cast has been verified.
+#if defined(__GNUC__) && !defined(__INTEL_COMPILER) && !defined(__clang__)
+#  if (__GNUC__ > 8) || ((__GNUC__ == 8) && (__GNUC_MINOR__ >= 1))
+#    pragma GCC diagnostic ignored "-Wcast-function-type"
+#  endif
+#endif
+
+#endif // _Standard_WarningDisableFunctionCast_HeaderFile