mirror of
https://git.dev.opencascade.org/repos/occt.git
synced 2025-08-24 13:50:49 +03:00
0027525: Coding - eliminate warnings on Windows for OCCT with static type of libraries
Useless *.cxx files were removed to eliminate linker warning LNK4221. Package TopOpeBRepDS was cleaned up from old debugging routines. Merged OSD_signal_WNT.cxx into OSD_signal.cxx Class Standard_ErrorHandlerCallback was moved into the Standard_ErrorHandler class as nested class Callback Eliminated warning about unused variable.
This commit is contained in:
@@ -22,8 +22,6 @@ Standard_DivideByZero.hxx
|
||||
Standard_DomainError.hxx
|
||||
Standard_ErrorHandler.cxx
|
||||
Standard_ErrorHandler.hxx
|
||||
Standard_ErrorHandlerCallback.cxx
|
||||
Standard_ErrorHandlerCallback.hxx
|
||||
Standard_ExtCharacter.hxx
|
||||
Standard_ExtString.cxx
|
||||
Standard_ExtString.hxx
|
||||
|
@@ -22,7 +22,6 @@
|
||||
#include <Standard_Size.hxx>
|
||||
#include <Standard_Integer.hxx>
|
||||
|
||||
class Standard_ErrorHandlerCallback;
|
||||
class Standard_ErrorHandler;
|
||||
class Standard_GUID;
|
||||
class Standard_Persistent;
|
||||
|
@@ -18,7 +18,6 @@
|
||||
//============================================================================
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <Standard_Failure.hxx>
|
||||
#include <Standard_ErrorHandlerCallback.hxx>
|
||||
#include <Standard_Mutex.hxx>
|
||||
#include <Standard.hxx>
|
||||
|
||||
@@ -125,7 +124,7 @@ void Standard_ErrorHandler::Unlink()
|
||||
Standard_Address aPtr = aCurrent->myCallbackPtr;
|
||||
myCallbackPtr = 0;
|
||||
while ( aPtr ) {
|
||||
Standard_ErrorHandlerCallback* aCallback = (Standard_ErrorHandlerCallback*)aPtr;
|
||||
Standard_ErrorHandler::Callback* aCallback = (Standard_ErrorHandler::Callback*)aPtr;
|
||||
aPtr = aCallback->myNext;
|
||||
// Call destructor explicitly, as we know that it will not be called automatically
|
||||
aCallback->DestroyCallback();
|
||||
@@ -267,3 +266,45 @@ Standard_ErrorHandler* Standard_ErrorHandler::FindHandler(const Standard_Handler
|
||||
|
||||
return anActive;
|
||||
}
|
||||
|
||||
#if defined(NO_CXX_EXCEPTION) || defined(OCC_CONVERT_SIGNALS)
|
||||
|
||||
Standard_ErrorHandler::Callback::Callback ()
|
||||
: myHandler(0), myPrev(0), myNext(0)
|
||||
{
|
||||
}
|
||||
|
||||
Standard_ErrorHandler::Callback::~Callback ()
|
||||
{
|
||||
UnregisterCallback();
|
||||
}
|
||||
|
||||
void Standard_ErrorHandler::Callback::RegisterCallback ()
|
||||
{
|
||||
if ( myHandler ) return; // already registered
|
||||
|
||||
// find current active exception handler
|
||||
Standard_ErrorHandler *aHandler =
|
||||
Standard_ErrorHandler::FindHandler(Standard_HandlerVoid, Standard_False);
|
||||
|
||||
// if found, add this callback object first to the list
|
||||
if ( aHandler ) {
|
||||
myHandler = aHandler;
|
||||
myNext = aHandler->myCallbackPtr;
|
||||
if ( myNext ) ((Standard_ErrorHandler::Callback*)myNext)->myPrev = this;
|
||||
aHandler->myCallbackPtr = this;
|
||||
}
|
||||
}
|
||||
|
||||
void Standard_ErrorHandler::Callback::UnregisterCallback ()
|
||||
{
|
||||
if ( ! myHandler ) return;
|
||||
if ( myNext )
|
||||
((Standard_ErrorHandler::Callback*)myNext)->myPrev = myPrev;
|
||||
if ( myPrev )
|
||||
((Standard_ErrorHandler::Callback*)myPrev)->myNext = myNext;
|
||||
else if ( ((Standard_ErrorHandler*)myHandler)->myCallbackPtr == this)
|
||||
((Standard_ErrorHandler*)myHandler)->myCallbackPtr = (Standard_ErrorHandler::Callback*)myNext;
|
||||
myHandler = myNext = myPrev = 0;
|
||||
}
|
||||
#endif
|
@@ -95,7 +95,6 @@
|
||||
#endif
|
||||
|
||||
class Standard_Failure;
|
||||
class Standard_ErrorHandlerCallback;
|
||||
|
||||
//! Class implementing mechanics of conversion of signals to exceptions.
|
||||
//!
|
||||
@@ -159,6 +158,56 @@ private:
|
||||
//! Returns the current handler (closest in the stack in the current execution thread)
|
||||
Standard_EXPORT static Standard_PErrorHandler FindHandler (const Standard_HandlerStatus theStatus, const Standard_Boolean theUnlink);
|
||||
|
||||
public:
|
||||
//! Defines a base class for callback objects that can be registered
|
||||
//! in the OCC error handler (the class simulating C++ exceptions)
|
||||
//! so as to be correctly destroyed when error handler is activated.
|
||||
//!
|
||||
//! Note that this is needed only when Open CASCADE is compiled with
|
||||
//! NO_CXX_EXCEPTION or OCC_CONVERT_SIGNALS options (i.e. on UNIX/Linux).
|
||||
//! In that case, raising OCC exception and/or signal will not cause
|
||||
//! C++ stack unwinding and destruction of objects created in the stack.
|
||||
//!
|
||||
//! This class is intended to protect critical objects and operations in
|
||||
//! the try {} catch {} block from being bypassed by OCC signal or exception.
|
||||
//!
|
||||
//! Inherit your object from that class, implement DestroyCallback() function,
|
||||
//! and call Register/Unregister in critical points.
|
||||
//!
|
||||
//! Note that you must ensure that your object has life span longer than
|
||||
//! that of the try {} block in which it calls Register().
|
||||
class Callback
|
||||
{
|
||||
public:
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Registers this callback object in the current error handler (if found).
|
||||
void RegisterCallback();
|
||||
|
||||
//! Unregisters this callback object from the error handler.
|
||||
void UnregisterCallback();
|
||||
|
||||
//! Destructor
|
||||
virtual ~Callback();
|
||||
|
||||
//! The callback function to perform necessary callback action.
|
||||
//! Called by the exception handler when it is being destroyed but
|
||||
//! still has this callback registered.
|
||||
Standard_EXPORT virtual void DestroyCallback() = 0;
|
||||
|
||||
protected:
|
||||
|
||||
//! Empty constructor
|
||||
Callback();
|
||||
|
||||
private:
|
||||
Standard_Address myHandler;
|
||||
Standard_Address myPrev;
|
||||
Standard_Address myNext;
|
||||
|
||||
friend class Standard_ErrorHandler;
|
||||
};
|
||||
|
||||
private:
|
||||
|
||||
Standard_PErrorHandler myPrevious;
|
||||
@@ -166,10 +215,30 @@ private:
|
||||
Standard_JmpBuf myLabel;
|
||||
Standard_HandlerStatus myStatus;
|
||||
Standard_ThreadId myThread;
|
||||
Standard_Address myCallbackPtr;
|
||||
Callback* myCallbackPtr;
|
||||
|
||||
friend class Standard_Failure;
|
||||
friend class Standard_ErrorHandlerCallback;
|
||||
};
|
||||
|
||||
// If neither NO_CXX_EXCEPTION nor OCC_CONVERT_SIGNALS is defined,
|
||||
// provide empty inline implementation
|
||||
#if ! defined(NO_CXX_EXCEPTION) && ! defined(OCC_CONVERT_SIGNALS)
|
||||
inline Standard_ErrorHandler::Callback::Callback ()
|
||||
: myHandler(0), myPrev(0), myNext(0)
|
||||
{
|
||||
}
|
||||
inline Standard_ErrorHandler::Callback::~Callback ()
|
||||
{
|
||||
}
|
||||
inline void Standard_ErrorHandler::Callback::RegisterCallback ()
|
||||
{
|
||||
}
|
||||
inline void Standard_ErrorHandler::Callback::UnregisterCallback ()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
// Definition of the old name "Standard_ErrorHandlerCallback" was kept for compatibility
|
||||
typedef Standard_ErrorHandler::Callback Standard_ErrorHandlerCallback;
|
||||
|
||||
#endif // _Standard_ErrorHandler_HeaderFile
|
||||
|
@@ -1,63 +0,0 @@
|
||||
// Created on: 2006-04-13
|
||||
// Created by: Andrey BETENEV
|
||||
// Copyright (c) 2006-2014 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.
|
||||
|
||||
// If either NO_CXX_EXCEPTION or OCC_CONVERT_SIGNALS is defined,
|
||||
// provide complete implementation
|
||||
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
#include <Standard_ErrorHandlerCallback.hxx>
|
||||
|
||||
#if defined(NO_CXX_EXCEPTION) || defined(OCC_CONVERT_SIGNALS)
|
||||
|
||||
Standard_ErrorHandlerCallback::Standard_ErrorHandlerCallback ()
|
||||
: myHandler(0), myPrev(0), myNext(0)
|
||||
{
|
||||
}
|
||||
|
||||
Standard_ErrorHandlerCallback::~Standard_ErrorHandlerCallback ()
|
||||
{
|
||||
UnregisterCallback();
|
||||
}
|
||||
|
||||
void Standard_ErrorHandlerCallback::RegisterCallback ()
|
||||
{
|
||||
if ( myHandler ) return; // already registered
|
||||
|
||||
// find current active exception handler
|
||||
Standard_ErrorHandler *aHandler =
|
||||
Standard_ErrorHandler::FindHandler(Standard_HandlerVoid, Standard_False);
|
||||
|
||||
// if found, add this callback object first to the list
|
||||
if ( aHandler ) {
|
||||
myHandler = aHandler;
|
||||
myNext = aHandler->myCallbackPtr;
|
||||
if ( myNext ) ((Standard_ErrorHandlerCallback*)myNext)->myPrev = this;
|
||||
aHandler->myCallbackPtr = this;
|
||||
}
|
||||
}
|
||||
|
||||
void Standard_ErrorHandlerCallback::UnregisterCallback ()
|
||||
{
|
||||
if ( ! myHandler ) return;
|
||||
if ( myNext )
|
||||
((Standard_ErrorHandlerCallback*)myNext)->myPrev = myPrev;
|
||||
if ( myPrev )
|
||||
((Standard_ErrorHandlerCallback*)myPrev)->myNext = myNext;
|
||||
else if ( ((Standard_ErrorHandler*)myHandler)->myCallbackPtr == this)
|
||||
((Standard_ErrorHandler*)myHandler)->myCallbackPtr = myNext;
|
||||
myHandler = myNext = myPrev = 0;
|
||||
}
|
||||
|
||||
#endif
|
@@ -1,92 +0,0 @@
|
||||
// Created on: 2006-04-13
|
||||
// Created by: Andrey BETENEV
|
||||
// Copyright (c) 2006-2014 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_ErrorHandlerCallback_HeaderFile
|
||||
#define _Standard_ErrorHandlerCallback_HeaderFile
|
||||
|
||||
#include <Standard.hxx>
|
||||
#include <Standard_Handle.hxx>
|
||||
|
||||
class Standard_ErrorHandler;
|
||||
|
||||
//! Defines a base class for callback objects that can be registered
|
||||
//! in the OCC error handler (the class simulating C++ exceptions)
|
||||
//! so as to be correctly destroyed when error handler is activated.
|
||||
//!
|
||||
//! Note that this is needed only when Open CASCADE is compiled with
|
||||
//! NO_CXX_EXCEPTION or OCC_CONVERT_SIGNALS options (i.e. on UNIX/Linux).
|
||||
//! In that case, raising OCC exception and/or signal will not cause
|
||||
//! C++ stack unwinding and destruction of objects created in the stack.
|
||||
//!
|
||||
//! This class is intended to protect critical objects and operations in
|
||||
//! the try {} catch {} block from being bypassed by OCC signal or exception.
|
||||
//!
|
||||
//! Inherit your object from that class, implement DestroyCallback() function,
|
||||
//! and call Register/Unregister in critical points.
|
||||
//!
|
||||
//! Note that you must ensure that your object has life span longer than
|
||||
//! that of the try {} block in which it calls Register().
|
||||
class Standard_ErrorHandlerCallback
|
||||
{
|
||||
public:
|
||||
|
||||
DEFINE_STANDARD_ALLOC
|
||||
|
||||
//! Registers this callback object in the current error handler (if found).
|
||||
void RegisterCallback();
|
||||
|
||||
//! Unregisters this callback object from the error handler.
|
||||
void UnregisterCallback();
|
||||
|
||||
//! Destructor
|
||||
virtual ~Standard_ErrorHandlerCallback ();
|
||||
|
||||
//! The callback function to perform necessary callback action.
|
||||
//! Called by the exception handler when it is being destroyed but
|
||||
//! still has this callback registered.
|
||||
Standard_EXPORT virtual void DestroyCallback() = 0;
|
||||
|
||||
friend class Standard_ErrorHandler;
|
||||
|
||||
protected:
|
||||
|
||||
//! Empty constructor
|
||||
Standard_ErrorHandlerCallback();
|
||||
|
||||
private:
|
||||
Standard_Address myHandler;
|
||||
Standard_Address myPrev;
|
||||
Standard_Address myNext;
|
||||
};
|
||||
|
||||
// If neither NO_CXX_EXCEPTION nor OCC_CONVERT_SIGNALS is defined,
|
||||
// provide empty inline implementation
|
||||
#if ! defined(NO_CXX_EXCEPTION) && ! defined(OCC_CONVERT_SIGNALS)
|
||||
inline Standard_ErrorHandlerCallback::Standard_ErrorHandlerCallback ()
|
||||
: myHandler(0), myPrev(0), myNext(0)
|
||||
{
|
||||
}
|
||||
inline Standard_ErrorHandlerCallback::~Standard_ErrorHandlerCallback ()
|
||||
{
|
||||
}
|
||||
inline void Standard_ErrorHandlerCallback::RegisterCallback ()
|
||||
{
|
||||
}
|
||||
inline void Standard_ErrorHandlerCallback::UnregisterCallback ()
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // _Standard_ErrorHandlerCallback_HeaderFile
|
@@ -18,7 +18,7 @@
|
||||
|
||||
#include <Standard_Integer.hxx>
|
||||
#include <Standard_Boolean.hxx>
|
||||
#include <Standard_ErrorHandlerCallback.hxx>
|
||||
#include <Standard_ErrorHandler.hxx>
|
||||
|
||||
#if defined(_WIN32)
|
||||
#include <windows.h>
|
||||
@@ -62,7 +62,7 @@
|
||||
* TryLock(), and UnregisterCallback() before Unlock() (or use Sentry classes).
|
||||
*/
|
||||
|
||||
class Standard_Mutex : public Standard_ErrorHandlerCallback
|
||||
class Standard_Mutex : public Standard_ErrorHandler::Callback
|
||||
{
|
||||
public:
|
||||
/**
|
||||
|
Reference in New Issue
Block a user