mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-05-16 10:54:53 +03:00
0026784: Coding rules - eliminate GCC warning -Wunused-parameter
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.
This commit is contained in:
parent
1c9d32256d
commit
c85385c0e2
@ -37,6 +37,8 @@ NCollection_WinHeapAllocator::NCollection_WinHeapAllocator
|
|||||||
ULONG aHeapInfo = 2;
|
ULONG aHeapInfo = 2;
|
||||||
HeapSetInformation (myHeapH, HeapCompatibilityInformation,
|
HeapSetInformation (myHeapH, HeapCompatibilityInformation,
|
||||||
&aHeapInfo, sizeof(aHeapInfo));
|
&aHeapInfo, sizeof(aHeapInfo));
|
||||||
|
#else
|
||||||
|
(void )theInitSizeBytes;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -258,7 +258,7 @@ Standard_Boolean OSD_Thread::Wait (Standard_Address &result) const
|
|||||||
// OSD_Thread::Wait
|
// 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
|
// check that thread handle is not null
|
||||||
result = 0;
|
result = 0;
|
||||||
@ -268,7 +268,7 @@ Standard_Boolean OSD_Thread::Wait (const Standard_Integer time, Standard_Address
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
// On Windows, wait for the thread handle to be signaled
|
// 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)
|
if (ret == WAIT_OBJECT_0)
|
||||||
{
|
{
|
||||||
DWORD anExitCode;
|
DWORD anExitCode;
|
||||||
@ -284,11 +284,32 @@ Standard_Boolean OSD_Thread::Wait (const Standard_Integer time, Standard_Address
|
|||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
#if defined(__GLIBC__) && defined(__GLIBC_PREREQ)
|
||||||
|
#if __GLIBC_PREREQ(2,4)
|
||||||
|
#define HAS_TIMED_NP
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// On Unix/Linux, join the thread
|
#ifdef HAS_TIMED_NP
|
||||||
return ! pthread_join ( myThread, &result );
|
struct timespec aTimeout;
|
||||||
|
if (clock_gettime (CLOCK_REALTIME, &aTimeout) == -1)
|
||||||
|
{
|
||||||
|
return Standard_False;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
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
|
||||||
|
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
//=============================================
|
//=============================================
|
||||||
|
@ -115,7 +115,11 @@ static sigfpe_handler_type *GetOldFPE()
|
|||||||
//==== SIGSEGV is handled by "SegvHandler()"
|
//==== SIGSEGV is handled by "SegvHandler()"
|
||||||
//============================================================================
|
//============================================================================
|
||||||
#ifdef SA_SIGINFO
|
#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)
|
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
|
#else
|
||||||
static void Handler (const int theSignal)
|
static void Handler (const int theSignal)
|
||||||
#endif
|
#endif
|
||||||
@ -338,6 +342,8 @@ static void SegvHandler(const int theSignal,
|
|||||||
Handler(theSignal, ip, theContext);
|
Handler(theSignal, ip, theContext);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
(void )theContext;
|
||||||
#endif
|
#endif
|
||||||
#ifdef linux
|
#ifdef linux
|
||||||
if (fFltExceptions)
|
if (fFltExceptions)
|
||||||
|
@ -541,6 +541,8 @@ void OpenGl_Text::setupMatrix (const Handle(OpenGl_PrinterContext)& thePrintCtx,
|
|||||||
// as it is better for keeping text/3d graphics proportions
|
// as it is better for keeping text/3d graphics proportions
|
||||||
Graphic3d_TransformUtils::Scale<GLdouble> (aModViewMat, aTextScaley, aTextScaley, aTextScaley);
|
Graphic3d_TransformUtils::Scale<GLdouble> (aModViewMat, aTextScaley, aTextScaley, aTextScaley);
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
(void )thePrintCtx;
|
||||||
#endif
|
#endif
|
||||||
Graphic3d_TransformUtils::Scale<GLdouble> (aModViewMat, myScaleHeight, myScaleHeight, myScaleHeight);
|
Graphic3d_TransformUtils::Scale<GLdouble> (aModViewMat, myScaleHeight, myScaleHeight, myScaleHeight);
|
||||||
}
|
}
|
||||||
|
@ -761,6 +761,11 @@ Standard_Boolean OpenGl_View::Print (const Aspect_Handle thePrinterDC,
|
|||||||
return (Standard_Boolean) isDone;
|
return (Standard_Boolean) isDone;
|
||||||
|
|
||||||
#else // not _WIN32
|
#else // not _WIN32
|
||||||
|
(void )thePrinterDC;
|
||||||
|
(void )theToShowBackground;
|
||||||
|
(void )theFileName;
|
||||||
|
(void )thePrintAlgorithm;
|
||||||
|
(void )theScaleFactor;
|
||||||
Standard_NotImplemented::Raise ("OpenGl_View::Print is implemented only on Windows");
|
Standard_NotImplemented::Raise ("OpenGl_View::Print is implemented only on Windows");
|
||||||
myWorkspace->PrinterContext().Nullify();
|
myWorkspace->PrinterContext().Nullify();
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
@ -79,7 +79,7 @@ Device::~Device()
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
//function : SetGrid
|
//function : Print
|
||||||
//purpose :
|
//purpose :
|
||||||
//=============================================================================
|
//=============================================================================
|
||||||
Standard_Boolean V3d_View::Print (const Aspect_Handle thePrintDC,
|
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);
|
return myView->Print (device._pd.hDC, theShowBackground, theFilename, thePrintAlgorithm, aScaleFactor);
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
(void )thePrintDC;
|
||||||
|
(void )theShowDialog;
|
||||||
|
(void )theShowBackground;
|
||||||
|
(void )theFilename;
|
||||||
|
(void )thePrintAlgorithm;
|
||||||
Standard_NotImplemented::Raise ("V3d_View::Print is implemented only on Windows");
|
Standard_NotImplemented::Raise ("V3d_View::Print is implemented only on Windows");
|
||||||
#endif
|
#endif
|
||||||
return Standard_False;
|
return Standard_False;
|
||||||
|
@ -4275,6 +4275,8 @@ static int VPrintView (Draw_Interpretor& di, Standard_Integer argc,
|
|||||||
const char** argv)
|
const char** argv)
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
|
(void )argc;
|
||||||
|
(void )argv;
|
||||||
di << "Printing implemented only for WNT!\n";
|
di << "Printing implemented only for WNT!\n";
|
||||||
return 0;
|
return 0;
|
||||||
#else
|
#else
|
||||||
|
Loading…
x
Reference in New Issue
Block a user