]> OCCT Git - occt-copy.git/commitdiff
0026784: Coding rules - eliminate GCC warning -Wunused-parameter
authorrkv <rkv@opencascade.com>
Thu, 29 Oct 2015 07:43:23 +0000 (10:43 +0300)
committerbugmaster <bugmaster@opencascade.com>
Thu, 5 Nov 2015 09:01:07 +0000 (12:01 +0300)
OSD_Thread - use pthread_timedjoin_np() instead of pthread_join() when available (glibc extension).
Suppress unused parameter warning in OSD_Signal, NCollection_WinHeapAllocator, OpenGl_Text, OpenGl_View, V3d_View and ViewerTest.

src/NCollection/NCollection_WinHeapAllocator.cxx
src/OSD/OSD_Thread.cxx
src/OSD/OSD_signal.cxx
src/OpenGl/OpenGl_Text.cxx
src/OpenGl/OpenGl_View_Print.cxx
src/V3d/V3d_View_Print.cxx
src/ViewerTest/ViewerTest_ViewerCommands.cxx

index caf647e5b12d58a9f4f1e4fbc07b5cf0f5a42c82..fa28019933e6aed7da285d2ba42a2a703b520267 100644 (file)
@@ -37,6 +37,8 @@ NCollection_WinHeapAllocator::NCollection_WinHeapAllocator
   ULONG aHeapInfo = 2;
   HeapSetInformation (myHeapH, HeapCompatibilityInformation,
                       &aHeapInfo, sizeof(aHeapInfo));
+#else
+  (void )theInitSizeBytes;
 #endif
 }
 
index 598fa5717ee5a64d13d70499e6186730175e789a..95097687c666640e1a0cf355f673b48a2436d7c8 100644 (file)
@@ -258,7 +258,7 @@ Standard_Boolean OSD_Thread::Wait (Standard_Address &result) const
 // OSD_Thread::Wait
 //=============================================
 
-Standard_Boolean OSD_Thread::Wait (const Standard_Integer time, Standard_Address &result) const
+Standard_Boolean OSD_Thread::Wait (const Standard_Integer theTimeMs, Standard_Address &result) const
 {
   // check that thread handle is not null
   result = 0;
@@ -268,7 +268,7 @@ Standard_Boolean OSD_Thread::Wait (const Standard_Integer time, Standard_Address
 #ifdef _WIN32
 
   // On Windows, wait for the thread handle to be signaled
-  DWORD ret = WaitForSingleObject ( myThread, time );
+  DWORD ret = WaitForSingleObject (myThread, theTimeMs);
   if (ret == WAIT_OBJECT_0)
   {
     DWORD anExitCode;
@@ -284,11 +284,32 @@ Standard_Boolean OSD_Thread::Wait (const Standard_Integer time, Standard_Address
   return Standard_False;
 
 #else
+  #if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
+    #if __GLIBC_PREREQ(2,4)
+      #define HAS_TIMED_NP
+    #endif
+  #endif
+
+  #ifdef HAS_TIMED_NP
+    struct timespec aTimeout;
+    if (clock_gettime (CLOCK_REALTIME, &aTimeout) == -1)
+    {
+      return Standard_False;
+    }
+
+    time_t aSeconds      = (theTimeMs / 1000);
+    long   aMicroseconds = (theTimeMs - aSeconds * 1000) * 1000;
+    aTimeout.tv_sec  += aSeconds;
+    aTimeout.tv_nsec += aMicroseconds * 1000;
+
+    return pthread_timedjoin_np (myThread, &result, &aTimeout) == 0;
+  #else
+    // join the thread without timeout
+    (void )theTimeMs;
+    return pthread_join (myThread, &result) == 0;
+  #endif
 
-  // On Unix/Linux, join the thread
-  return ! pthread_join ( myThread, &result );
-
-#endif  
+#endif
 }
 
 //=============================================
index 9046a673c8b97a4e5fd74d5199a0bf4ec242bf3a..1f9c374397c504fc2108ff9b3c9aabeccdfea9cb 100644 (file)
@@ -115,7 +115,11 @@ static sigfpe_handler_type *GetOldFPE()
 //==== SIGSEGV is handled by "SegvHandler()"
 //============================================================================
 #ifdef SA_SIGINFO
+  #if defined(HAVE_PTHREAD_H) && defined(NO_CXX_EXCEPTION)
 static void Handler (const int theSignal, siginfo_t *theSigInfo, const Standard_Address theContext)
+  #else
+static void Handler (const int theSignal, siginfo_t */*theSigInfo*/, const Standard_Address /*theContext*/)
+  #endif
 #else
 static void Handler (const int theSignal)
 #endif
@@ -338,6 +342,8 @@ static void SegvHandler(const int theSignal,
     Handler(theSignal, ip, theContext);
     return;
   }
+#else
+  (void )theContext;
 #endif
 #ifdef linux
   if (fFltExceptions)
index 139be47288e47262fb8c6b3f6a8773b4f4c71289..a27f4fdbcd997b78c51fc639b5cca29e09a0a8da 100644 (file)
@@ -541,6 +541,8 @@ void OpenGl_Text::setupMatrix (const Handle(OpenGl_PrinterContext)& thePrintCtx,
         // as it is better for keeping text/3d graphics proportions
         Graphic3d_TransformUtils::Scale<GLdouble> (aModViewMat, aTextScaley, aTextScaley, aTextScaley);
       }
+    #else
+      (void )thePrintCtx;
     #endif
       Graphic3d_TransformUtils::Scale<GLdouble> (aModViewMat, myScaleHeight, myScaleHeight, myScaleHeight);
     }
index 5f53f4466732d02ac092472e8a68655254563bda..3251a5e4db099e10d2f196585e7b8b37a4434ebc 100644 (file)
@@ -761,6 +761,11 @@ Standard_Boolean OpenGl_View::Print (const Aspect_Handle    thePrinterDC,
   return (Standard_Boolean) isDone;
 
 #else // not _WIN32
+  (void )thePrinterDC;
+  (void )theToShowBackground;
+  (void )theFileName;
+  (void )thePrintAlgorithm;
+  (void )theScaleFactor;
   Standard_NotImplemented::Raise ("OpenGl_View::Print is implemented only on Windows");
   myWorkspace->PrinterContext().Nullify();
   return Standard_False;
index dede6b0e4bee2296726660bd9ab2d0b0277361f1..edeaa5903ceb3cc0327fb68cd0e8b93ba244e87e 100644 (file)
@@ -79,7 +79,7 @@ Device::~Device()
 #endif
 
 //=============================================================================
-//function : SetGrid
+//function : Print
 //purpose  :
 //=============================================================================
 Standard_Boolean V3d_View::Print (const Aspect_Handle    thePrintDC,
@@ -143,6 +143,11 @@ Standard_Boolean V3d_View::Print (const Aspect_Handle    thePrintDC,
     return myView->Print (device._pd.hDC, theShowBackground, theFilename, thePrintAlgorithm, aScaleFactor);
   }
 #else
+  (void )thePrintDC;
+  (void )theShowDialog;
+  (void )theShowBackground;
+  (void )theFilename;
+  (void )thePrintAlgorithm;
   Standard_NotImplemented::Raise ("V3d_View::Print is implemented only on Windows");
 #endif
   return Standard_False;
index 9642900302b3d259be548f593221d1ddfd62ecfe..28077010f216d6b5eef4f2930a4d79a20e3825ee 100644 (file)
@@ -4275,6 +4275,8 @@ static int VPrintView (Draw_Interpretor& di, Standard_Integer argc,
                        const char** argv)
 {
 #ifndef _WIN32
+  (void )argc;
+  (void )argv;
   di << "Printing implemented only for WNT!\n";
   return 0;
 #else