From e1d36343e460056870b3aaefca31f3d8356df3de Mon Sep 17 00:00:00 2001 From: Pasukhin Dmitry Date: Wed, 7 Jan 2026 12:22:32 +0000 Subject: [PATCH] Foundation Classes - Inherited Standard_Failure from std::exception (#984) First patch in iterative renovation of exceptions. - Simplify exception classes to be container of data only. - Removed redundant inclusion of in various header files across the project. - Removed Set methods for failure and its define template. - Removed Raise and Rerise static methods. - Remove Instance and Throw methods - Deprecated getting message with old approach, and moving to what() - Update ErrorHandler to handle only specific list of exceptions. --- .../migration_800/migrate_raise_to_throw.py | 179 +++++++++++++++ .../foundation_classes/foundation_classes.md | 2 +- .../BinDrivers_DocumentRetrievalDriver.cxx | 3 +- .../BinDrivers_DocumentStorageDriver.cxx | 2 +- .../TKCDF/CDF/CDF_StoreList.cxx | 2 +- .../TKCDF/PCDM/PCDM_DriverError.hxx | 1 - .../TKLCAF/TDocStd/TDocStd_Application.cxx | 16 +- .../TKTObj/TObj/TObj_Application.cxx | 4 +- .../TKTObj/TObj/TObj_Model.cxx | 5 +- .../XmlLDrivers_DocumentRetrievalDriver.cxx | 2 +- .../XmlLDrivers_DocumentStorageDriver.cxx | 2 +- .../TKDEOBJ/RWObj/RWObj_Reader.cxx | 2 +- .../STEPControl/STEPControl_Reader.cxx | 8 +- .../StepData/StepData_StepReaderTool.cxx | 2 +- .../StepToTopoDS/StepToTopoDS_Builder.cxx | 2 +- .../TopoDSToStep_MakeStepFace.cxx | 2 +- .../TKDESTL/RWStl/RWStl_Reader.hxx | 1 + .../TKRWMesh/RWMesh/RWMesh_MaterialMap.cxx | 3 +- .../IFSelect/IFSelect_WorkSession.cxx | 26 +-- .../Interface/Interface_CheckFailure.hxx | 1 - .../Interface/Interface_CheckTool.cxx | 8 +- .../Interface/Interface_FileReaderTool.cxx | 4 +- .../Interface/Interface_InterfaceError.hxx | 1 - .../Interface/Interface_InterfaceMismatch.hxx | 1 - .../TKXSBase/MoniTool/MoniTool_CaseData.cxx | 10 +- .../TKXSBase/MoniTool/MoniTool_CaseData.hxx | 5 +- .../Transfer/Transfer_ProcessForFinder_0.cxx | 2 +- .../Transfer_ProcessForTransient_0.cxx | 2 +- .../Transfer/Transfer_TransferDeadLoop.hxx | 1 - .../Transfer/Transfer_TransferFailure.hxx | 1 - .../XSControl/XSControl_TransferWriter.cxx | 4 +- src/Draw/DRAWEXE/DRAWEXE.cxx | 2 +- .../DNaming/DNaming_ModelingCommands.cxx | 4 +- src/Draw/TKDraw/DBRep/DBRep_Debug.cxx | 2 +- src/Draw/TKDraw/Draw/Draw_Debug.cxx | 2 +- src/Draw/TKDraw/Draw/Draw_Failure.hxx | 1 - src/Draw/TKDraw/Draw/Draw_Window.cxx | 2 +- .../TKDraw/DrawTrSurf/DrawTrSurf_Debug.cxx | 6 +- src/Draw/TKQADraw/QABugs/QABugs_11.cxx | 24 +- .../BRepTest/BRepTest_CheckCommands.cxx | 2 +- .../TKTopTest/MeshTest/MeshTest_Debug.cxx | 4 +- src/Draw/TKXDEDRAW/XDEDRAW/XDEDRAW_Props.cxx | 2 +- .../TKXSDRAWIGES/XSDRAWIGES/XSDRAWIGES.cxx | 6 +- .../TKMath/gp/gp_VectorWithNullMagnitude.hxx | 4 - .../TKMath/math/math_NotSquare.hxx | 1 - .../TKMath/math/math_SingularMatrix.hxx | 1 - .../NCollection/NCollection_AliasedArray.hxx | 2 + .../NCollection_SparseArrayBase.cxx | 1 + .../TKernel/OSD/OSD_Exception.hxx | 1 - .../OSD/OSD_Exception_ACCESS_VIOLATION.hxx | 1 - .../OSD_Exception_ARRAY_BOUNDS_EXCEEDED.hxx | 1 - .../TKernel/OSD/OSD_Exception_CTRL_BREAK.hxx | 1 - .../OSD/OSD_Exception_ILLEGAL_INSTRUCTION.hxx | 1 - .../OSD/OSD_Exception_INT_OVERFLOW.hxx | 1 - .../OSD/OSD_Exception_INVALID_DISPOSITION.hxx | 1 - .../OSD/OSD_Exception_IN_PAGE_ERROR.hxx | 1 - ...OSD_Exception_NONCONTINUABLE_EXCEPTION.hxx | 1 - .../OSD/OSD_Exception_PRIV_INSTRUCTION.hxx | 1 - .../OSD/OSD_Exception_STACK_OVERFLOW.hxx | 1 - .../OSD/OSD_Exception_STATUS_NO_MEMORY.hxx | 1 - .../TKernel/OSD/OSD_OSDError.hxx | 1 - .../TKernel/OSD/OSD_SIGBUS.hxx | 1 - .../TKernel/OSD/OSD_SIGHUP.hxx | 1 - .../TKernel/OSD/OSD_SIGILL.hxx | 1 - .../TKernel/OSD/OSD_SIGINT.hxx | 1 - .../TKernel/OSD/OSD_SIGKILL.hxx | 1 - .../TKernel/OSD/OSD_SIGQUIT.hxx | 1 - .../TKernel/OSD/OSD_SIGSEGV.hxx | 1 - .../TKernel/OSD/OSD_SIGSYS.hxx | 1 - .../TKernel/OSD/OSD_Signal.hxx | 1 - .../TKernel/OSD/OSD_ThreadPool.cxx | 25 +- .../TKernel/OSD/OSD_ThreadPool.hxx | 29 +-- .../TKernel/OSD/OSD_signal.cxx | 43 ++-- .../TKernel/Plugin/Plugin_Failure.hxx | 1 - .../Quantity/Quantity_DateDefinitionError.hxx | 1 - .../Quantity_PeriodDefinitionError.hxx | 1 - .../Resource/Resource_NoSuchResource.hxx | 1 - .../Standard/Standard_AbortiveTransaction.hxx | 1 - .../Standard/Standard_ConstructionError.hxx | 1 - .../Standard/Standard_DefineException.hxx | 58 ++--- .../Standard/Standard_DimensionError.hxx | 1 - .../Standard/Standard_DimensionMismatch.hxx | 1 - .../Standard/Standard_DivideByZero.hxx | 1 - .../TKernel/Standard/Standard_DomainError.hxx | 1 - .../Standard/Standard_ErrorHandler.cxx | 35 +-- .../Standard/Standard_ErrorHandler.hxx | 106 +++++++-- .../TKernel/Standard/Standard_Failure.cxx | 214 +++++------------- .../TKernel/Standard/Standard_Failure.hxx | 136 ++++------- .../Standard/Standard_ImmutableObject.hxx | 1 - .../Standard/Standard_LicenseError.hxx | 1 - .../Standard/Standard_LicenseNotFound.hxx | 1 - .../TKernel/Standard/Standard_MMgrOpt.cxx | 1 + .../Standard/Standard_MultiplyDefined.hxx | 1 - .../Standard/Standard_NegativeValue.hxx | 1 - .../Standard/Standard_NoMoreObject.hxx | 1 - .../Standard/Standard_NoSuchObject.hxx | 1 - .../Standard/Standard_NotImplemented.hxx | 1 - .../TKernel/Standard/Standard_NullObject.hxx | 1 - .../TKernel/Standard/Standard_NullValue.hxx | 1 - .../Standard/Standard_NumericError.hxx | 1 - .../TKernel/Standard/Standard_OutOfMemory.cxx | 61 +---- .../TKernel/Standard/Standard_OutOfMemory.hxx | 39 +--- .../TKernel/Standard/Standard_OutOfRange.hxx | 1 - .../TKernel/Standard/Standard_Overflow.hxx | 1 - .../Standard/Standard_ProgramError.hxx | 1 - .../TKernel/Standard/Standard_RangeError.hxx | 1 - .../Standard/Standard_TypeMismatch.hxx | 1 - .../TKernel/Standard/Standard_Underflow.hxx | 1 - .../StdFail/StdFail_InfiniteSolutions.hxx | 1 - .../TKernel/StdFail/StdFail_NotDone.hxx | 1 - .../TKernel/StdFail/StdFail_Undefined.hxx | 1 - .../StdFail/StdFail_UndefinedDerivative.hxx | 1 - .../StdFail/StdFail_UndefinedValue.hxx | 1 - .../Storage_StreamExtCharParityError.hxx | 1 - .../Storage/Storage_StreamFormatError.hxx | 1 - .../Storage/Storage_StreamModeError.hxx | 1 - .../Storage/Storage_StreamReadError.hxx | 1 - .../Storage_StreamTypeMismatchError.hxx | 1 - .../Storage_StreamUnknownTypeError.hxx | 1 - .../Storage/Storage_StreamWriteError.hxx | 1 - .../TColStd/TColStd_HPackedMapOfInteger.hxx | 1 + .../TKernel/Units/Units_NoSuchType.hxx | 1 - .../TKernel/Units/Units_NoSuchUnit.hxx | 1 - .../TKExpress/Expr/Expr_ExprFailure.hxx | 1 - .../TKExpress/Expr/Expr_InvalidAssignment.hxx | 1 - .../TKExpress/Expr/Expr_InvalidFunction.hxx | 1 - .../TKExpress/Expr/Expr_InvalidOperand.hxx | 1 - .../TKExpress/Expr/Expr_NotAssigned.hxx | 1 - .../TKExpress/Expr/Expr_NotEvaluable.hxx | 1 - .../ExprIntrp/ExprIntrp_SyntaxError.hxx | 1 - .../TKGeomAlgo/GccAna/GccAna_NoSolution.hxx | 1 - .../TKGeomAlgo/GccEnt/GccEnt_BadQualifier.hxx | 1 - .../Geom2dGcc/Geom2dGcc_IsParallel.hxx | 1 - .../NLPlate/NLPlate_HGPPConstraint.hxx | 2 + .../HLRAlgo/HLRAlgo_PolyInternalNode.hxx | 1 + .../BRepMesh_DataStructureOfDelaun.cxx | 2 +- .../TKMesh/BRepMesh/BRepMesh_Delaun.cxx | 2 +- .../TKMesh/BRepMesh/BRepMesh_Triangulator.cxx | 2 +- .../TKShHealing/ShapeProcess/ShapeProcess.cxx | 4 +- .../BRepExtrema_UnCompatibleShape.hxx | 1 - .../TKBRep/BRepTools/BRepTools_Debug.cxx | 6 +- .../TKBRep/TopoDS/TopoDS_FrozenShape.hxx | 1 - .../TKBRep/TopoDS/TopoDS_LockedShape.hxx | 1 - .../TopoDS/TopoDS_UnCompatibleShapes.hxx | 1 - .../Geom2d/Geom2d_UndefinedDerivative.hxx | 1 - .../TKG2d/Geom2d/Geom2d_UndefinedValue.hxx | 1 - .../TKG2d/LProp/LProp_BadContinuity.hxx | 1 - .../TKG2d/LProp/LProp_NotDefined.hxx | 1 - .../TKG3d/GProp/GProp_UndefinedAxis.hxx | 1 - .../TKG3d/Geom/Geom_UndefinedDerivative.hxx | 1 - .../TKG3d/Geom/Geom_UndefinedValue.hxx | 1 - .../Extrema/Extrema_GCurveLocator.hxx | 1 + .../TKGeomBase/GeomTools/GeomTools_Debug.cxx | 2 +- .../IVtkOCC/IVtkOCC_SelectableObject.cxx | 2 +- .../TKIVtk/IVtkOCC/IVtkOCC_ShapeMesher.cxx | 2 +- .../Aspect_AspectFillAreaDefinitionError.hxx | 1 - .../Aspect_AspectLineDefinitionError.hxx | 1 - .../Aspect_AspectMarkerDefinitionError.hxx | 1 - ...spect_DisplayConnectionDefinitionError.hxx | 1 - .../Aspect_GraphicDeviceDefinitionError.hxx | 1 - .../Aspect/Aspect_IdentDefinitionError.hxx | 1 - .../Aspect/Aspect_WindowDefinitionError.hxx | 1 - .../TKService/Aspect/Aspect_WindowError.hxx | 1 - .../Graphic3d_GroupDefinitionError.hxx | 1 - .../Graphic3d_MaterialDefinitionError.hxx | 1 - .../Graphic3d_PriorityDefinitionError.hxx | 1 - .../Graphic3d_StructureDefinitionError.hxx | 1 - .../WNT/WNT_ClassDefinitionError.hxx | 1 - src/Visualization/TKV3d/AIS/AIS_Shape.cxx | 8 +- .../TKV3d/AIS/AIS_ViewController.cxx | 2 +- .../TKV3d/Prs3d/Prs3d_InvalidAngle.hxx | 1 - .../SelectMgr/SelectMgr_BVHThreadPool.cxx | 4 +- src/Visualization/TKV3d/V3d/V3d_BadValue.hxx | 1 - src/Visualization/TKV3d/V3d/V3d_UnMapped.hxx | 1 - 174 files changed, 590 insertions(+), 668 deletions(-) create mode 100755 adm/scripts/migration_800/migrate_raise_to_throw.py diff --git a/adm/scripts/migration_800/migrate_raise_to_throw.py b/adm/scripts/migration_800/migrate_raise_to_throw.py new file mode 100755 index 0000000000..16bc592e0d --- /dev/null +++ b/adm/scripts/migration_800/migrate_raise_to_throw.py @@ -0,0 +1,179 @@ +#!/usr/bin/env python3 +""" +Script to migrate Standard_*::Raise() calls to throw Standard_*() statements. + +Pattern: Standard_SomeException::Raise("message") -> throw Standard_SomeException("message") + +Also removes unnecessary 'return;' or 'return "";' statements after throw. + +Usage: + python3 migrate_raise_to_throw.py [--dry-run] +""" + +import re +import os +import sys +import argparse + +# Pattern to match Standard_*::Raise calls (single or multi-line) +# Captures: (ExceptionType, arguments) +RAISE_PATTERN = re.compile( + r'(Standard_\w+)::Raise\s*\(\s*([^;]*?)\s*\)\s*;', + re.DOTALL +) + +# Pattern to match 'return "";' or 'return;' that might follow a throw +RETURN_AFTER_THROW = re.compile( + r'(throw\s+Standard_\w+\s*\([^)]*\)\s*;)\s*\n(\s*)(return\s*"?"?\s*;)', + re.DOTALL +) + +# Special case for #define YY_FATAL_ERROR +YY_FATAL_PATTERN = re.compile( + r'#define\s+YY_FATAL_ERROR\s*\(\s*msg\s*\)\s*Standard_Failure::Raise\s*\(\s*msg\s*\)\s*;' +) + +# Patterns to skip (method definitions, not static calls) +SKIP_PATTERNS = [ + r'void\s+Standard_\w+::Raise\s*\(', # Method definitions + r'//.*Standard_\w+::Raise', # Comments +] + + +def find_occt_root(): + """Find OCCT root directory by looking for src/ directory.""" + script_dir = os.path.dirname(os.path.abspath(__file__)) + # Navigate up from adm/scripts/migration_800 to root + root = os.path.dirname(os.path.dirname(os.path.dirname(script_dir))) + if os.path.isdir(os.path.join(root, 'src')): + return root + # Try current directory + if os.path.isdir('src'): + return os.getcwd() + return None + + +def should_skip_line(line): + """Check if line should be skipped (method definition or comment).""" + for pattern in SKIP_PATTERNS: + if re.search(pattern, line): + return True + return False + + +def find_files_with_raise(src_dir): + """Find all .cxx and .hxx files containing Standard_*::Raise calls.""" + files_to_process = [] + + for root, dirs, files in os.walk(src_dir): + for filename in files: + if filename.endswith(('.cxx', '.hxx', '.lex')): + filepath = os.path.join(root, filename) + try: + with open(filepath, 'r', encoding='utf-8', errors='replace') as f: + content = f.read() + + # Check if file contains Raise pattern + if RAISE_PATTERN.search(content) or YY_FATAL_PATTERN.search(content): + # Verify it's not just method definitions + lines_with_raise = [line for line in content.split('\n') + if 'Standard_' in line and '::Raise' in line] + has_static_calls = any(not should_skip_line(line) + for line in lines_with_raise) + if has_static_calls: + files_to_process.append(filepath) + except Exception as e: + print(f" Warning: Could not read {filepath}: {e}") + + return files_to_process + + +def process_file(filepath, dry_run=False): + """Process a single file to replace Raise calls with throw.""" + + with open(filepath, 'r', encoding='utf-8', errors='replace') as f: + content = f.read() + + original_content = content + changes = [] + + # Handle special case for YY_FATAL_ERROR macro + if YY_FATAL_PATTERN.search(content): + content = YY_FATAL_PATTERN.sub( + '#define YY_FATAL_ERROR(msg) throw Standard_Failure(msg);', + content + ) + changes.append("YY_FATAL_ERROR macro") + + # Replace Standard_*::Raise(...) with throw Standard_*(...) + def replace_raise(match): + exception_type = match.group(1) + args = match.group(2).strip() + # Clean up multi-line arguments + args = ' '.join(args.split()) + changes.append(f"{exception_type}::Raise -> throw") + return f'throw {exception_type}({args});' + + content = RAISE_PATTERN.sub(replace_raise, content) + + # Remove 'return "";' or 'return;' that follows a throw + def remove_return_after_throw(match): + throw_stmt = match.group(1) + changes.append("removed return after throw") + return throw_stmt + + content = RETURN_AFTER_THROW.sub(remove_return_after_throw, content) + + if content != original_content: + if not dry_run: + with open(filepath, 'w', encoding='utf-8') as f: + f.write(content) + return changes + return None + + +def main(): + parser = argparse.ArgumentParser( + description='Migrate Standard_*::Raise() to throw Standard_*()' + ) + parser.add_argument('--dry-run', action='store_true', + help='Show what would be changed without modifying files') + args = parser.parse_args() + + occt_root = find_occt_root() + if not occt_root: + print("Error: Could not find OCCT root directory") + sys.exit(1) + + src_dir = os.path.join(occt_root, 'src') + print(f"OCCT root: {occt_root}") + print(f"Scanning: {src_dir}") + print("=" * 60) + + if args.dry_run: + print("DRY RUN - no files will be modified") + print("=" * 60) + + # Find files to process + files = find_files_with_raise(src_dir) + print(f"Found {len(files)} files with Standard_*::Raise calls") + print("=" * 60) + + modified_count = 0 + for filepath in sorted(files): + rel_path = os.path.relpath(filepath, occt_root) + changes = process_file(filepath, args.dry_run) + if changes: + modified_count += 1 + action = "WOULD MODIFY" if args.dry_run else "MODIFIED" + print(f" {action}: {rel_path}") + for change in changes: + print(f" - {change}") + + print("=" * 60) + action = "Would modify" if args.dry_run else "Modified" + print(f"{action} {modified_count} files") + + +if __name__ == "__main__": + main() diff --git a/dox/user_guides/foundation_classes/foundation_classes.md b/dox/user_guides/foundation_classes/foundation_classes.md index 83ac31168b..143cb91dd8 100644 --- a/dox/user_guides/foundation_classes/foundation_classes.md +++ b/dox/user_guides/foundation_classes/foundation_classes.md @@ -855,7 +855,7 @@ int main (int argc, char* argv[]) } catch (const Standard_Failure& theFailure) { - std::cerr << "Error " + theFailure.DynamicType()->Name() << " [" << theFailure.GetMessageString() << "]\n"; + std::cerr << "Error " << theFailure.ExceptionType() << " [" << theFailure.what() << "]\n"; } return 1; } diff --git a/src/ApplicationFramework/TKBin/BinDrivers/BinDrivers_DocumentRetrievalDriver.cxx b/src/ApplicationFramework/TKBin/BinDrivers/BinDrivers_DocumentRetrievalDriver.cxx index d9ac8f44a2..e02ca924c5 100644 --- a/src/ApplicationFramework/TKBin/BinDrivers/BinDrivers_DocumentRetrievalDriver.cxx +++ b/src/ApplicationFramework/TKBin/BinDrivers/BinDrivers_DocumentRetrievalDriver.cxx @@ -65,8 +65,7 @@ void BinDrivers_DocumentRetrievalDriver::ReadShapeSection( catch (Standard_Failure const& anException) { const TCollection_ExtendedString aMethStr("BinDrivers_DocumentRetrievalDriver: "); - myMsgDriver->Send(aMethStr + "error of Shape Section " + anException.GetMessageString(), - Message_Fail); + myMsgDriver->Send(aMethStr + "error of Shape Section " + anException.what(), Message_Fail); } } } diff --git a/src/ApplicationFramework/TKBin/BinDrivers/BinDrivers_DocumentStorageDriver.cxx b/src/ApplicationFramework/TKBin/BinDrivers/BinDrivers_DocumentStorageDriver.cxx index dc5102ffa2..2fae27cd69 100644 --- a/src/ApplicationFramework/TKBin/BinDrivers/BinDrivers_DocumentStorageDriver.cxx +++ b/src/ApplicationFramework/TKBin/BinDrivers/BinDrivers_DocumentStorageDriver.cxx @@ -189,7 +189,7 @@ void BinDrivers_DocumentStorageDriver::WriteShapeSection(BinLDrivers_DocumentSec catch (Standard_Failure const& anException) { TCollection_ExtendedString anErrorStr("BinDrivers_DocumentStorageDriver, Shape Section :"); - myMsgDriver->Send(anErrorStr + anException.GetMessageString(), Message_Fail); + myMsgDriver->Send(anErrorStr + anException.what(), Message_Fail); } } diff --git a/src/ApplicationFramework/TKCDF/CDF/CDF_StoreList.cxx b/src/ApplicationFramework/TKCDF/CDF/CDF_StoreList.cxx index f7f9a391f7..b37059140c 100644 --- a/src/ApplicationFramework/TKCDF/CDF/CDF_StoreList.cxx +++ b/src/ApplicationFramework/TKCDF/CDF/CDF_StoreList.cxx @@ -31,7 +31,7 @@ static void CAUGHT(const Standard_Failure& theException, const TCollection_ExtendedString& what) { status += what; - status += theException.GetMessageString(); + status += theException.what(); } CDF_StoreList::CDF_StoreList(const occ::handle& aDocument) diff --git a/src/ApplicationFramework/TKCDF/PCDM/PCDM_DriverError.hxx b/src/ApplicationFramework/TKCDF/PCDM/PCDM_DriverError.hxx index c4d05bf66a..2ac267dbd8 100644 --- a/src/ApplicationFramework/TKCDF/PCDM/PCDM_DriverError.hxx +++ b/src/ApplicationFramework/TKCDF/PCDM/PCDM_DriverError.hxx @@ -17,7 +17,6 @@ #ifndef _PCDM_DriverError_HeaderFile #define _PCDM_DriverError_HeaderFile -#include #include #include #include diff --git a/src/ApplicationFramework/TKLCAF/TDocStd/TDocStd_Application.cxx b/src/ApplicationFramework/TKLCAF/TDocStd/TDocStd_Application.cxx index b5989851b3..82805de9f4 100644 --- a/src/ApplicationFramework/TKLCAF/TDocStd/TDocStd_Application.cxx +++ b/src/ApplicationFramework/TKLCAF/TDocStd/TDocStd_Application.cxx @@ -269,7 +269,7 @@ PCDM_ReaderStatus TDocStd_Application::Open(const TCollection_ExtendedString& // Standard_SStream aMsg; // aMsg << Standard_Failure::Caught() << std::endl; // std::cout << "TDocStd_Application::Open(): " << aMsg.rdbuf()->str() << std::endl; - TCollection_ExtendedString aString(anException.GetMessageString()); + TCollection_ExtendedString aString(anException.what()); MessageDriver()->Send(aString.ToExtString(), Message_Fail); } } @@ -306,7 +306,7 @@ PCDM_ReaderStatus TDocStd_Application::Open(Standard_IStream& { if (!MessageDriver().IsNull()) { - TCollection_ExtendedString aFailureMessage(anException.GetMessageString()); + TCollection_ExtendedString aFailureMessage(anException.what()); MessageDriver()->Send(aFailureMessage.ToExtString(), Message_Fail); } } @@ -345,7 +345,7 @@ PCDM_StoreStatus TDocStd_Application::SaveAs(const occ::handle { if (!MessageDriver().IsNull()) { - TCollection_ExtendedString aString(anException.GetMessageString()); + TCollection_ExtendedString aString(anException.what()); MessageDriver()->Send(aString.ToExtString(), Message_Fail); } } @@ -388,7 +388,7 @@ PCDM_StoreStatus TDocStd_Application::SaveAs(const occ::handle { if (!MessageDriver().IsNull()) { - TCollection_ExtendedString aString(anException.GetMessageString()); + TCollection_ExtendedString aString(anException.what()); MessageDriver()->Send(aString.ToExtString(), Message_Fail); } } @@ -413,7 +413,7 @@ PCDM_StoreStatus TDocStd_Application::Save(const occ::handle& { if (!MessageDriver().IsNull()) { - TCollection_ExtendedString aString(anException.GetMessageString()); + TCollection_ExtendedString aString(anException.what()); MessageDriver()->Send(aString.ToExtString(), Message_Fail); } } @@ -463,7 +463,7 @@ PCDM_StoreStatus TDocStd_Application::SaveAs(const occ::handle { if (!MessageDriver().IsNull()) { - TCollection_ExtendedString aString(anException.GetMessageString()); + TCollection_ExtendedString aString(anException.what()); MessageDriver()->Send(aString.ToExtString(), Message_Fail); } } @@ -513,7 +513,7 @@ PCDM_StoreStatus TDocStd_Application::SaveAs(const occ::handle { if (!MessageDriver().IsNull()) { - TCollection_ExtendedString aString(anException.GetMessageString()); + TCollection_ExtendedString aString(anException.what()); MessageDriver()->Send(aString.ToExtString(), Message_Fail); } } @@ -539,7 +539,7 @@ PCDM_StoreStatus TDocStd_Application::Save(const occ::handle& { if (!MessageDriver().IsNull()) { - TCollection_ExtendedString aString(anException.GetMessageString()); + TCollection_ExtendedString aString(anException.what()); MessageDriver()->Send(aString.ToExtString(), Message_Fail); } } diff --git a/src/ApplicationFramework/TKTObj/TObj/TObj_Application.cxx b/src/ApplicationFramework/TKTObj/TObj/TObj_Application.cxx index 14aca21bda..c2ecb21641 100644 --- a/src/ApplicationFramework/TKTObj/TObj/TObj_Application.cxx +++ b/src/ApplicationFramework/TKTObj/TObj/TObj_Application.cxx @@ -117,7 +117,7 @@ bool TObj_Application::LoadDocument(const TCollection_ExtendedString& theSourceF catch (Standard_Failure const& anException) { #ifdef OCCT_DEBUG - ErrorMessage(Message_Msg("TObj_Appl_Exception") << anException.GetMessageString()); + ErrorMessage(Message_Msg("TObj_Appl_Exception") << anException.what()); #endif (void)anException; } @@ -148,7 +148,7 @@ bool TObj_Application::LoadDocument(Standard_IStream& theIStream, catch (Standard_Failure const& anException) { #ifdef OCCT_DEBUG - ErrorMessage(Message_Msg("TObj_Appl_Exception") << anException.GetMessageString()); + ErrorMessage(Message_Msg("TObj_Appl_Exception") << anException.what()); #endif (void)anException; } diff --git a/src/ApplicationFramework/TKTObj/TObj/TObj_Model.cxx b/src/ApplicationFramework/TKTObj/TObj/TObj_Model.cxx index 1e2c973d98..887c9b1da1 100644 --- a/src/ApplicationFramework/TKTObj/TObj/TObj_Model.cxx +++ b/src/ApplicationFramework/TKTObj/TObj/TObj_Model.cxx @@ -173,7 +173,7 @@ bool TObj_Model::Load(const TCollection_ExtendedString& theFile) catch (Standard_Failure const& anException) { #ifdef OCCT_DEBUG - TCollection_ExtendedString aString(anException.DynamicType()->Name()); + TCollection_ExtendedString aString(anException.ExceptionType()); aString = aString + ": " + anException.GetMessageString(); Messenger()->Send(Message_Msg("TObj_Appl_Exception") << aString); #endif @@ -270,8 +270,7 @@ bool TObj_Model::Load(Standard_IStream& theIStream) catch (Standard_Failure const& anException) { #ifdef OCCT_DEBUG - TCollection_ExtendedString aString(anException.DynamicType()->Name()); - aString = aString + ": " + anException.GetMessageString(); + TCollection_ExtendedString aString(anException.what()); Messenger()->Send(Message_Msg("TObj_Appl_Exception") << aString); #endif (void)anException; diff --git a/src/ApplicationFramework/TKXmlL/XmlLDrivers/XmlLDrivers_DocumentRetrievalDriver.cxx b/src/ApplicationFramework/TKXmlL/XmlLDrivers/XmlLDrivers_DocumentRetrievalDriver.cxx index 67d66497fc..c21f39dcf7 100644 --- a/src/ApplicationFramework/TKXmlL/XmlLDrivers/XmlLDrivers_DocumentRetrievalDriver.cxx +++ b/src/ApplicationFramework/TKXmlL/XmlLDrivers/XmlLDrivers_DocumentRetrievalDriver.cxx @@ -487,7 +487,7 @@ void XmlLDrivers_DocumentRetrievalDriver::ReadFromDomDocument( } catch (Standard_Failure const& anException) { - TCollection_ExtendedString anErrorString(anException.GetMessageString()); + TCollection_ExtendedString anErrorString(anException.what()); aMsgDriver->Send(anErrorString.ToExtString(), Message_Fail); } if (!aPS.More()) diff --git a/src/ApplicationFramework/TKXmlL/XmlLDrivers/XmlLDrivers_DocumentStorageDriver.cxx b/src/ApplicationFramework/TKXmlL/XmlLDrivers/XmlLDrivers_DocumentStorageDriver.cxx index a9b185482a..d058ba6919 100644 --- a/src/ApplicationFramework/TKXmlL/XmlLDrivers/XmlLDrivers_DocumentStorageDriver.cxx +++ b/src/ApplicationFramework/TKXmlL/XmlLDrivers/XmlLDrivers_DocumentStorageDriver.cxx @@ -336,7 +336,7 @@ bool XmlLDrivers_DocumentStorageDriver::WriteToDomDocument( { SetIsError(true); SetStoreStatus(PCDM_SS_Failure); - TCollection_ExtendedString anErrorString(anException.GetMessageString()); + TCollection_ExtendedString anErrorString(anException.what()); aMessageDriver->Send(anErrorString.ToExtString(), Message_Fail); } } diff --git a/src/DataExchange/TKDEOBJ/RWObj/RWObj_Reader.cxx b/src/DataExchange/TKDEOBJ/RWObj/RWObj_Reader.cxx index 955a59b66a..7f0a2f00d6 100644 --- a/src/DataExchange/TKDEOBJ/RWObj/RWObj_Reader.cxx +++ b/src/DataExchange/TKDEOBJ/RWObj/RWObj_Reader.cxx @@ -605,7 +605,7 @@ int RWObj_Reader::triangulatePolygon(const NCollection_Array1& theIndices) catch (Standard_Failure const& theFailure) { Message::SendWarning(TCollection_AsciiString("Error: exception raised during polygon split\n[") - + theFailure.GetMessageString() + "]"); + + theFailure.what() + "]"); } return triangulatePolygonFan(theIndices); } diff --git a/src/DataExchange/TKDESTEP/STEPControl/STEPControl_Reader.cxx b/src/DataExchange/TKDESTEP/STEPControl/STEPControl_Reader.cxx index a45b52116e..db5a115bda 100644 --- a/src/DataExchange/TKDESTEP/STEPControl/STEPControl_Reader.cxx +++ b/src/DataExchange/TKDESTEP/STEPControl/STEPControl_Reader.cxx @@ -122,7 +122,7 @@ IFSelect_ReturnStatus STEPControl_Reader::ReadFile(const char* filename) { Message_Messenger::StreamBuffer sout = Message::SendInfo(); sout << " **** Interruption ReadFile par Exception : ****\n"; - sout << anException.GetMessageString(); + sout << anException.what(); sout << "\n Abandon" << std::endl; status = IFSelect_RetFail; } @@ -166,7 +166,7 @@ IFSelect_ReturnStatus STEPControl_Reader::ReadFile(const char* file { Message_Messenger::StreamBuffer sout = Message::SendInfo(); sout << " **** Interruption ReadFile par Exception : ****\n"; - sout << anException.GetMessageString(); + sout << anException.what(); sout << "\n Abandon" << std::endl; status = IFSelect_RetFail; } @@ -209,7 +209,7 @@ IFSelect_ReturnStatus STEPControl_Reader::ReadStream(const char* theName, std::i { Message_Messenger::StreamBuffer sout = Message::SendInfo(); sout << " **** Interruption ReadFile par Exception : ****\n"; - sout << anException.GetMessageString(); + sout << anException.what(); sout << "\n Abandon" << std::endl; status = IFSelect_RetFail; } @@ -254,7 +254,7 @@ IFSelect_ReturnStatus STEPControl_Reader::ReadStream(const char* th { Message_Messenger::StreamBuffer sout = Message::SendInfo(); sout << " **** Interruption ReadFile par Exception : ****\n"; - sout << anException.GetMessageString(); + sout << anException.what(); sout << "\n Abandon" << std::endl; status = IFSelect_RetFail; } diff --git a/src/DataExchange/TKDESTEP/StepData/StepData_StepReaderTool.cxx b/src/DataExchange/TKDESTEP/StepData/StepData_StepReaderTool.cxx index ef4b57e9bb..6ae92a23bb 100644 --- a/src/DataExchange/TKDESTEP/StepData/StepData_StepReaderTool.cxx +++ b/src/DataExchange/TKDESTEP/StepData/StepData_StepReaderTool.cxx @@ -94,7 +94,7 @@ void StepData_StepReaderTool::Prepare(const bool optim) { Message_Messenger::StreamBuffer sout = Message::SendInfo(); sout << " Exception Raised during Preparation :\n"; - sout << anException.GetMessageString(); + sout << anException.what(); sout << "\n Now, trying to continue, but with presomption of failure\n"; } } diff --git a/src/DataExchange/TKDESTEP/StepToTopoDS/StepToTopoDS_Builder.cxx b/src/DataExchange/TKDESTEP/StepToTopoDS/StepToTopoDS_Builder.cxx index 2ad5c0f7ec..a7e454203f 100644 --- a/src/DataExchange/TKDESTEP/StepToTopoDS/StepToTopoDS_Builder.cxx +++ b/src/DataExchange/TKDESTEP/StepToTopoDS/StepToTopoDS_Builder.cxx @@ -749,7 +749,7 @@ void StepToTopoDS_Builder::Init(const occ::handle& GC { Message_Messenger::StreamBuffer sout = TP->Messenger()->SendInfo(); sout << "StepToTopoDS, GeometricSet, elem " << i << " of " << nbElem << ": exception "; - sout << anException.GetMessageString() << std::endl; + sout << anException.what() << std::endl; } if (!aGeomCrv.IsNull()) { diff --git a/src/DataExchange/TKDESTEP/TopoDSToStep/TopoDSToStep_MakeStepFace.cxx b/src/DataExchange/TKDESTEP/TopoDSToStep/TopoDSToStep_MakeStepFace.cxx index f5b7303f81..fe3ec2b491 100644 --- a/src/DataExchange/TKDESTEP/TopoDSToStep/TopoDSToStep_MakeStepFace.cxx +++ b/src/DataExchange/TKDESTEP/TopoDSToStep/TopoDSToStep_MakeStepFace.cxx @@ -472,7 +472,7 @@ void TopoDSToStep_MakeStepFace::Init(const TopoDS_Face& } catch (Standard_Failure const& theFailure) { - FP->AddFail(errShape, theFailure.GetMessageString()); + FP->AddFail(errShape, theFailure.what()); myError = TopoDSToStep_FaceOther; done = false; } diff --git a/src/DataExchange/TKDESTL/RWStl/RWStl_Reader.hxx b/src/DataExchange/TKDESTL/RWStl/RWStl_Reader.hxx index 62435bcdfe..89cc9c1bfc 100644 --- a/src/DataExchange/TKDESTL/RWStl/RWStl_Reader.hxx +++ b/src/DataExchange/TKDESTL/RWStl/RWStl_Reader.hxx @@ -17,6 +17,7 @@ #define _RWStl_Reader_HeaderFile #include +#include #include #include diff --git a/src/DataExchange/TKRWMesh/RWMesh/RWMesh_MaterialMap.cxx b/src/DataExchange/TKRWMesh/RWMesh/RWMesh_MaterialMap.cxx index 65dfa0e6e5..408db1fa32 100644 --- a/src/DataExchange/TKRWMesh/RWMesh/RWMesh_MaterialMap.cxx +++ b/src/DataExchange/TKRWMesh/RWMesh/RWMesh_MaterialMap.cxx @@ -144,8 +144,7 @@ bool RWMesh_MaterialMap::copyFileTo(const TCollection_AsciiString& theFileSrc, } catch (Standard_Failure const& theException) { - Message::SendFail(TCollection_AsciiString("Failed to copy file\n") - + theException.GetMessageString()); + Message::SendFail(TCollection_AsciiString("Failed to copy file\n") + theException.what()); return false; } } diff --git a/src/DataExchange/TKXSBase/IFSelect/IFSelect_WorkSession.cxx b/src/DataExchange/TKXSBase/IFSelect/IFSelect_WorkSession.cxx index f2bf1a8dc4..1adaefbc26 100644 --- a/src/DataExchange/TKXSBase/IFSelect/IFSelect_WorkSession.cxx +++ b/src/DataExchange/TKXSBase/IFSelect/IFSelect_WorkSession.cxx @@ -182,7 +182,7 @@ IFSelect_ReturnStatus IFSelect_WorkSession::ReadFile(const char* filename) { Message_Messenger::StreamBuffer sout = Message::SendInfo(); sout << " **** ReadFile Interruption by Exception : ****\n"; - sout << anException.GetMessageString(); + sout << anException.what(); sout << "\n Abandon" << std::endl; status = IFSelect_RetFail; } @@ -221,7 +221,7 @@ IFSelect_ReturnStatus IFSelect_WorkSession::ReadStream(const char* theName, { Message_Messenger::StreamBuffer sout = Message::SendInfo(); sout << " **** ReadFile Interruption by Exception : ****\n"; - sout << anException.GetMessageString(); + sout << anException.what(); sout << "\n Abandon" << std::endl; status = IFSelect_RetFail; } @@ -1187,7 +1187,7 @@ Interface_EntityIterator IFSelect_WorkSession::EvalSelection( { Message_Messenger::StreamBuffer sout = Message::SendInfo(); sout << " **** EvalSelection Interrupted by Exception : ****\n"; - sout << anException.GetMessageString(); + sout << anException.what(); sout << "\n Abandon" << std::endl; } errhand = theerrhand; @@ -1226,7 +1226,7 @@ occ::handle>> IFSelect_Wor { Message_Messenger::StreamBuffer sout = Message::SendInfo(); sout << " **** SelectionResult Interrupted by Exception : ****\n"; - sout << anException.GetMessageString(); + sout << anException.what(); sout << "\n Abandon" << std::endl; } errhand = theerrhand; @@ -1883,7 +1883,7 @@ void IFSelect_WorkSession::EvaluateFile() { Message_Messenger::StreamBuffer sout = Message::SendInfo(); sout << " **** EvaluateFile Interrupted by Exception : ****\n"; - sout << anException.GetMessageString(); + sout << anException.what(); sout << "\n Abandon" << std::endl; checks.CCheck(0)->AddFail("Exception Raised -> Abandon"); } @@ -1968,7 +1968,7 @@ bool IFSelect_WorkSession::SendSplit() { Message_Messenger::StreamBuffer sout = Message::SendInfo(); sout << " **** SendSplit Interrupted by Exception : ****\n"; - sout << anException.GetMessageString(); + sout << anException.what(); sout << "\n Abandon" << std::endl; checks.CCheck(0)->AddFail("Exception Raised -> Abandon"); } @@ -2217,7 +2217,7 @@ IFSelect_ReturnStatus IFSelect_WorkSession::SendAll(const char* filename, const { Message_Messenger::StreamBuffer sout = Message::SendInfo(); sout << " **** SendAll Interrupted by Exception : ****\n"; - sout << anException.GetMessageString(); + sout << anException.what(); sout << "\n Abandon" << std::endl; errhand = theerrhand; checks.CCheck(0)->AddFail("Exception Raised -> Abandon"); @@ -2270,7 +2270,7 @@ IFSelect_ReturnStatus IFSelect_WorkSession::SendSelected(const char* filename, { Message_Messenger::StreamBuffer sout = Message::SendInfo(); sout << " **** SendSelected Interrupted by Exception : ****\n"; - sout << anException.GetMessageString(); + sout << anException.what(); sout << "\n Abandon" << std::endl; checks.CCheck(0)->AddFail("Exception Raised -> Abandon"); errhand = theerrhand; @@ -3371,7 +3371,7 @@ void IFSelect_WorkSession::DumpModel(const int level, Standard_OStream& S) { Message_Messenger::StreamBuffer sout = Message::SendInfo(); sout << " **** DumpModel Interrupted by Exception : ****\n"; - sout << anException.GetMessageString(); + sout << anException.what(); sout << "\n Abandon" << std::endl; } } @@ -3558,7 +3558,7 @@ void IFSelect_WorkSession::EvaluateSelection(const occ::handle catch (Standard_Failure const& anException) { sout << " **** EvaluateDispatch Interrupted by Exception **** Title\n"; - sout << anException.GetMessageString(); + sout << anException.what(); sout << "\n Abandon" << std::endl; } errhand = theerrhand; @@ -3694,7 +3694,7 @@ void IFSelect_WorkSession::EvaluateComplete(const int mode) const catch (Standard_Failure const& anException) { sout << " **** EvaluateComplete Interrupted by Exception : ****\n"; - sout << anException.GetMessageString(); + sout << anException.what(); sout << "\n Abandon" << std::endl; } errhand = theerrhand; @@ -3868,7 +3868,7 @@ void IFSelect_WorkSession::ListEntities(const Interface_EntityIterator& iter, catch (Standard_Failure const& anException) { sout << " **** ListEntities Interrupted by Exception : ****\n"; - sout << anException.GetMessageString(); + sout << anException.what(); sout << "\n Abandon" << std::endl; } } diff --git a/src/DataExchange/TKXSBase/Interface/Interface_CheckFailure.hxx b/src/DataExchange/TKXSBase/Interface/Interface_CheckFailure.hxx index 5103038ea6..49a56a16a3 100644 --- a/src/DataExchange/TKXSBase/Interface/Interface_CheckFailure.hxx +++ b/src/DataExchange/TKXSBase/Interface/Interface_CheckFailure.hxx @@ -17,7 +17,6 @@ #ifndef _Interface_CheckFailure_HeaderFile #define _Interface_CheckFailure_HeaderFile -#include #include #include #include diff --git a/src/DataExchange/TKXSBase/Interface/Interface_CheckTool.cxx b/src/DataExchange/TKXSBase/Interface/Interface_CheckTool.cxx index 3f4b9fc44b..c42be35a42 100644 --- a/src/DataExchange/TKXSBase/Interface/Interface_CheckTool.cxx +++ b/src/DataExchange/TKXSBase/Interface/Interface_CheckTool.cxx @@ -41,16 +41,16 @@ static int errh = 1; static void raisecheck(Standard_Failure& theException, occ::handle& ach) { char mess[100]; - Sprintf(mess, "** Exception Raised during Check : %s **", theException.DynamicType()->Name()); + Sprintf(mess, "** Exception Raised during Check : %s **", theException.ExceptionType()); ach->AddFail(mess); #ifdef _WIN32 - if (theException.IsKind(STANDARD_TYPE(OSD_Exception))) + if (dynamic_cast(&theException) != nullptr) { #else - if (theException.IsKind(STANDARD_TYPE(OSD_Signal))) + if (dynamic_cast(&theException) != nullptr) { #endif - theException.SetMessageString("System Signal received, check interrupt"); + throw theException; } } diff --git a/src/DataExchange/TKXSBase/Interface/Interface_FileReaderTool.cxx b/src/DataExchange/TKXSBase/Interface/Interface_FileReaderTool.cxx index 4deddc0ad5..d1c3d79870 100644 --- a/src/DataExchange/TKXSBase/Interface/Interface_FileReaderTool.cxx +++ b/src/DataExchange/TKXSBase/Interface/Interface_FileReaderTool.cxx @@ -343,10 +343,10 @@ void Interface_FileReaderTool::LoadModel(const occ::handle(&anException) != nullptr) ierr = 2; #else - if (anException.IsKind(STANDARD_TYPE(OSD_Signal))) + if (dynamic_cast(&anException) != nullptr) ierr = 2; #endif //: abv 03Apr00: anent is actually a previous one: if (anent.IsNull()) diff --git a/src/DataExchange/TKXSBase/Interface/Interface_InterfaceError.hxx b/src/DataExchange/TKXSBase/Interface/Interface_InterfaceError.hxx index 40f51771a6..1ba0c152be 100644 --- a/src/DataExchange/TKXSBase/Interface/Interface_InterfaceError.hxx +++ b/src/DataExchange/TKXSBase/Interface/Interface_InterfaceError.hxx @@ -17,7 +17,6 @@ #ifndef _Interface_InterfaceError_HeaderFile #define _Interface_InterfaceError_HeaderFile -#include #include #include #include diff --git a/src/DataExchange/TKXSBase/Interface/Interface_InterfaceMismatch.hxx b/src/DataExchange/TKXSBase/Interface/Interface_InterfaceMismatch.hxx index 0eed4a3213..4fe323a3b5 100644 --- a/src/DataExchange/TKXSBase/Interface/Interface_InterfaceMismatch.hxx +++ b/src/DataExchange/TKXSBase/Interface/Interface_InterfaceMismatch.hxx @@ -17,7 +17,6 @@ #ifndef _Interface_InterfaceMismatch_HeaderFile #define _Interface_InterfaceMismatch_HeaderFile -#include #include #include #include diff --git a/src/DataExchange/TKXSBase/MoniTool/MoniTool_CaseData.cxx b/src/DataExchange/TKXSBase/MoniTool/MoniTool_CaseData.cxx index 3314e6f7d2..d762a95b7f 100644 --- a/src/DataExchange/TKXSBase/MoniTool/MoniTool_CaseData.cxx +++ b/src/DataExchange/TKXSBase/MoniTool/MoniTool_CaseData.cxx @@ -148,10 +148,14 @@ void MoniTool_CaseData::AddData(const occ::handle& val, thesubst = 0; } -void MoniTool_CaseData::AddRaised(const occ::handle& theException, - const char* name) +void MoniTool_CaseData::AddRaised(const Standard_Failure& theException, const char* name) { - AddData(theException, 1, name); + // Store exception type and message as text (since Standard_Failure is no longer + // Standard_Transient) + TCollection_AsciiString aText(theException.ExceptionType()); + aText += ": "; + aText += theException.what(); + AddText(aText.ToCString(), name); } void MoniTool_CaseData::AddShape(const TopoDS_Shape& sh, const char* name) diff --git a/src/DataExchange/TKXSBase/MoniTool/MoniTool_CaseData.hxx b/src/DataExchange/TKXSBase/MoniTool/MoniTool_CaseData.hxx index 80ed2828ba..473577b5c9 100644 --- a/src/DataExchange/TKXSBase/MoniTool/MoniTool_CaseData.hxx +++ b/src/DataExchange/TKXSBase/MoniTool/MoniTool_CaseData.hxx @@ -115,9 +115,8 @@ public: const int kind, const char* name = ""); - //! Adds the currently caught exception - Standard_EXPORT void AddRaised(const occ::handle& theException, - const char* name = ""); + //! Adds the currently caught exception (stores exception type and message as text) + Standard_EXPORT void AddRaised(const Standard_Failure& theException, const char* name = ""); //! Adds a Shape (recorded as a HShape) Standard_EXPORT void AddShape(const TopoDS_Shape& sh, const char* name = ""); diff --git a/src/DataExchange/TKXSBase/Transfer/Transfer_ProcessForFinder_0.cxx b/src/DataExchange/TKXSBase/Transfer/Transfer_ProcessForFinder_0.cxx index 17a55b8e40..42804c69e2 100644 --- a/src/DataExchange/TKXSBase/Transfer/Transfer_ProcessForFinder_0.cxx +++ b/src/DataExchange/TKXSBase/Transfer/Transfer_ProcessForFinder_0.cxx @@ -819,7 +819,7 @@ occ::handle Transfer_ProcessForFinder::Transferring( binder->AddFail("Transfer stopped by exception raising"); if (thetrace) { - aSender << " *** Raised : " << anException.GetMessageString() << std::endl; + aSender << " *** Raised : " << anException.what() << std::endl; StartTrace(binder, start, thelevel - 1, 4); } thelevel = oldlev; diff --git a/src/DataExchange/TKXSBase/Transfer/Transfer_ProcessForTransient_0.cxx b/src/DataExchange/TKXSBase/Transfer/Transfer_ProcessForTransient_0.cxx index ae8ee3030a..fbc38ad08b 100644 --- a/src/DataExchange/TKXSBase/Transfer/Transfer_ProcessForTransient_0.cxx +++ b/src/DataExchange/TKXSBase/Transfer/Transfer_ProcessForTransient_0.cxx @@ -812,7 +812,7 @@ occ::handle Transfer_ProcessForTransient::Transferring( binder->AddFail("Transfer stopped by exception raising"); if (thetrace) { - aSender << " *** Raised : " << anException.GetMessageString() << std::endl; + aSender << " *** Raised : " << anException.what() << std::endl; StartTrace(binder, start, thelevel - 1, 4); } thelevel = oldlev; diff --git a/src/DataExchange/TKXSBase/Transfer/Transfer_TransferDeadLoop.hxx b/src/DataExchange/TKXSBase/Transfer/Transfer_TransferDeadLoop.hxx index cf0146cc10..1f64433c93 100644 --- a/src/DataExchange/TKXSBase/Transfer/Transfer_TransferDeadLoop.hxx +++ b/src/DataExchange/TKXSBase/Transfer/Transfer_TransferDeadLoop.hxx @@ -17,7 +17,6 @@ #ifndef _Transfer_TransferDeadLoop_HeaderFile #define _Transfer_TransferDeadLoop_HeaderFile -#include #include #include diff --git a/src/DataExchange/TKXSBase/Transfer/Transfer_TransferFailure.hxx b/src/DataExchange/TKXSBase/Transfer/Transfer_TransferFailure.hxx index ed84c3acaf..3ead131893 100644 --- a/src/DataExchange/TKXSBase/Transfer/Transfer_TransferFailure.hxx +++ b/src/DataExchange/TKXSBase/Transfer/Transfer_TransferFailure.hxx @@ -17,7 +17,6 @@ #ifndef _Transfer_TransferFailure_HeaderFile #define _Transfer_TransferFailure_HeaderFile -#include #include #include #include diff --git a/src/DataExchange/TKXSBase/XSControl/XSControl_TransferWriter.cxx b/src/DataExchange/TKXSBase/XSControl/XSControl_TransferWriter.cxx index 5c5c297f6e..f90d8caaf1 100644 --- a/src/DataExchange/TKXSBase/XSControl/XSControl_TransferWriter.cxx +++ b/src/DataExchange/TKXSBase/XSControl/XSControl_TransferWriter.cxx @@ -104,7 +104,7 @@ IFSelect_ReturnStatus XSControl_TransferWriter::TransferWriteTransient( catch (Standard_Failure const& anException) { sout << "**** **** TransferWriteShape, EXCEPTION : "; - sout << anException.GetMessageString(); + sout << anException.what(); sout << std::endl; status = IFSelect_RetFail; } @@ -159,7 +159,7 @@ IFSelect_ReturnStatus XSControl_TransferWriter::TransferWriteShape( catch (Standard_Failure const& anException) { sout << "**** **** TransferWriteShape, EXCEPTION : "; - sout << anException.GetMessageString(); + sout << anException.what(); sout << std::endl; status = IFSelect_RetFail; } diff --git a/src/Draw/DRAWEXE/DRAWEXE.cxx b/src/Draw/DRAWEXE/DRAWEXE.cxx index 3307ae04ee..1a23f49eda 100644 --- a/src/Draw/DRAWEXE/DRAWEXE.cxx +++ b/src/Draw/DRAWEXE/DRAWEXE.cxx @@ -79,7 +79,7 @@ public: } catch (Standard_Failure& anExcept) { - std::cout << "Failed to evaluate command: " << anExcept.GetMessageString() << std::endl; + std::cout << "Failed to evaluate command: " << anExcept.what() << std::endl; } return aRes; } diff --git a/src/Draw/TKDCAF/DNaming/DNaming_ModelingCommands.cxx b/src/Draw/TKDCAF/DNaming/DNaming_ModelingCommands.cxx index d39450f832..637d5e7777 100644 --- a/src/Draw/TKDCAF/DNaming/DNaming_ModelingCommands.cxx +++ b/src/Draw/TKDCAF/DNaming/DNaming_ModelingCommands.cxx @@ -2188,7 +2188,7 @@ static int DNaming_TestSingle(Draw_Interpretor& theDI, int theNb, const char** t catch (Standard_Failure const& anException) { std::cout << "%%%INFO:Error: ::TestSingleSelection failed :"; - std::cout << anException.GetMessageString() << std::endl; + std::cout << anException.what() << std::endl; } catch (...) { @@ -2342,7 +2342,7 @@ static int DNaming_Multiple(Draw_Interpretor& theDI, int theNb, const char** the catch (Standard_Failure const& anException) { std::cout << "%%%INFO:Error: ::TestSingleSelection failed :"; - std::cout << anException.GetMessageString() << std::endl; + std::cout << anException.what() << std::endl; } catch (...) { diff --git a/src/Draw/TKDraw/DBRep/DBRep_Debug.cxx b/src/Draw/TKDraw/DBRep/DBRep_Debug.cxx index 2ba4d8026d..eb72a6b901 100644 --- a/src/Draw/TKDraw/DBRep/DBRep_Debug.cxx +++ b/src/Draw/TKDraw/DBRep/DBRep_Debug.cxx @@ -43,7 +43,7 @@ Standard_EXPORT const char* DBRep_Set(const char* theNameStr, void* theShapePtr) } catch (Standard_Failure const& anException) { - return anException.GetMessageString(); + return anException.what(); } } diff --git a/src/Draw/TKDraw/Draw/Draw_Debug.cxx b/src/Draw/TKDraw/Draw/Draw_Debug.cxx index 095c835691..805313e16e 100644 --- a/src/Draw/TKDraw/Draw/Draw_Debug.cxx +++ b/src/Draw/TKDraw/Draw/Draw_Debug.cxx @@ -38,6 +38,6 @@ Standard_EXPORT const char* Draw_Eval(const char* theCommandStr) } catch (Standard_Failure const& anException) { - return anException.GetMessageString(); + return anException.what(); } } diff --git a/src/Draw/TKDraw/Draw/Draw_Failure.hxx b/src/Draw/TKDraw/Draw/Draw_Failure.hxx index e2e240adfd..b3408dd399 100644 --- a/src/Draw/TKDraw/Draw/Draw_Failure.hxx +++ b/src/Draw/TKDraw/Draw/Draw_Failure.hxx @@ -17,7 +17,6 @@ #ifndef _Draw_Failure_HeaderFile #define _Draw_Failure_HeaderFile -#include #include #include #include diff --git a/src/Draw/TKDraw/Draw/Draw_Window.cxx b/src/Draw/TKDraw/Draw/Draw_Window.cxx index e8f0aa0504..8ab8297564 100644 --- a/src/Draw/TKDraw/Draw/Draw_Window.cxx +++ b/src/Draw/TKDraw/Draw/Draw_Window.cxx @@ -1644,7 +1644,7 @@ bool Init_Appli(HINSTANCE hInst, HINSTANCE hPrevInst, int nShow, HWND& hWndFrame } catch (Standard_Failure& anExcept) { - std::cout << "Failed to initialize Tk: " << anExcept.GetMessageString() << std::endl; + std::cout << "Failed to initialize Tk: " << anExcept.what() << std::endl; } Tcl_StaticPackage(interp, "Tk", Tk_Init, (Tcl_PackageInitProc*)NULL); diff --git a/src/Draw/TKDraw/DrawTrSurf/DrawTrSurf_Debug.cxx b/src/Draw/TKDraw/DrawTrSurf/DrawTrSurf_Debug.cxx index 7a6ce51b8f..b24a511525 100644 --- a/src/Draw/TKDraw/DrawTrSurf/DrawTrSurf_Debug.cxx +++ b/src/Draw/TKDraw/DrawTrSurf/DrawTrSurf_Debug.cxx @@ -54,7 +54,7 @@ Standard_EXPORT const char* DrawTrSurf_Set(const char* theNameStr, void* theHand } catch (Standard_Failure const& anException) { - return anException.GetMessageString(); + return anException.what(); } } @@ -80,7 +80,7 @@ Standard_EXPORT const char* DrawTrSurf_SetPnt(const char* theNameStr, void* theP } catch (Standard_Failure const& anException) { - return anException.GetMessageString(); + return anException.what(); } } @@ -101,7 +101,7 @@ Standard_EXPORT const char* DrawTrSurf_SetPnt2d(const char* theNameStr, void* th } catch (Standard_Failure const& anException) { - return anException.GetMessageString(); + return anException.what(); } } diff --git a/src/Draw/TKQADraw/QABugs/QABugs_11.cxx b/src/Draw/TKQADraw/QABugs/QABugs_11.cxx index ae656b4b2d..e75cfd3831 100644 --- a/src/Draw/TKQADraw/QABugs/QABugs_11.cxx +++ b/src/Draw/TKQADraw/QABugs/QABugs_11.cxx @@ -2097,7 +2097,7 @@ static int OCC6143(Draw_Interpretor& di, int argc, const char** argv) catch (Standard_Failure const& anException) { di << " Caught ("; - di << anException.GetMessageString(); + di << anException.what(); di << ")... KO\n"; Succes = false; } @@ -2134,7 +2134,7 @@ static int OCC6143(Draw_Interpretor& di, int argc, const char** argv) { // std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl; di << " Caught ("; - di << anException.GetMessageString(); + di << anException.what(); di << ")... KO\n"; Succes = false; } @@ -2177,7 +2177,7 @@ static int OCC6143(Draw_Interpretor& di, int argc, const char** argv) { // std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl; di << " Caught ("; - di << anException.GetMessageString(); + di << anException.what(); di << ")... KO\n"; Succes = false; } @@ -2211,7 +2211,7 @@ static int OCC6143(Draw_Interpretor& di, int argc, const char** argv) { // std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl; di << " Caught ("; - di << anException.GetMessageString(); + di << anException.what(); di << ")... KO\n"; Succes = false; } @@ -2248,7 +2248,7 @@ static int OCC6143(Draw_Interpretor& di, int argc, const char** argv) { // std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl; di << " Caught ("; - di << anException.GetMessageString(); + di << anException.what(); di << ")... KO\n"; Succes = false; } @@ -2275,7 +2275,7 @@ static int OCC6143(Draw_Interpretor& di, int argc, const char** argv) { // std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl; di << " Caught ("; - di << anException.GetMessageString(); + di << anException.what(); di << ")... KO\n"; Succes = false; } @@ -2306,7 +2306,7 @@ static int OCC6143(Draw_Interpretor& di, int argc, const char** argv) { // std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl; di << " Caught ("; - di << anException.GetMessageString(); + di << anException.what(); di << ")... KO\n"; Succes = false; } @@ -2333,7 +2333,7 @@ static int OCC6143(Draw_Interpretor& di, int argc, const char** argv) { // std::cout << " Caught (" << Standard_Failure::Caught() << ")... KO" << std::endl; di << " Caught ("; - di << anException.GetMessageString(); + di << anException.what(); di << ")... KO\n"; Succes = false; } @@ -2427,14 +2427,14 @@ static Standard_NOINLINE int OCC30762(Draw_Interpretor& theDI, int theNbArgs, co #endif { theDI << " Caught ("; - theDI << aSegException.GetMessageString(); + theDI << aSegException.what(); theDI << aSegException.GetStackString(); theDI << ")... OK\n"; } catch (Standard_Failure const& anException) { theDI << " Caught ("; - theDI << anException.GetMessageString(); + theDI << anException.what(); theDI << anException.GetStackString(); theDI << ")... KO\n"; } @@ -2504,7 +2504,7 @@ static int OCC7141(Draw_Interpretor& di, int argc, const char** argv) { di << "Failed :\n\n"; // std::cout << Standard_Failure::Caught() << std::endl; - di << anException.GetMessageString(); + di << anException.what(); } di << argv[0] << " : Finish\n"; @@ -4752,7 +4752,7 @@ int CR23403(Draw_Interpretor& di, int argc, const char** argv) } catch (Standard_Failure const& anException) { - di << "Exception : " << anException.GetMessageString() << "\n"; + di << "Exception : " << anException.what() << "\n"; } return 0; diff --git a/src/Draw/TKTopTest/BRepTest/BRepTest_CheckCommands.cxx b/src/Draw/TKTopTest/BRepTest/BRepTest_CheckCommands.cxx index ff101cd380..93a26b81cd 100644 --- a/src/Draw/TKTopTest/BRepTest/BRepTest_CheckCommands.cxx +++ b/src/Draw/TKTopTest/BRepTest/BRepTest_CheckCommands.cxx @@ -1049,7 +1049,7 @@ static int checkshape(Draw_Interpretor& theCommands, int narg, const char** a) catch (Standard_Failure const& anException) { theCommands << "checkshape exception : "; - theCommands << anException.GetMessageString(); + theCommands << anException.what(); theCommands << "\n"; return 1; } diff --git a/src/Draw/TKTopTest/MeshTest/MeshTest_Debug.cxx b/src/Draw/TKTopTest/MeshTest/MeshTest_Debug.cxx index d5f56eb2a9..3222528f00 100644 --- a/src/Draw/TKTopTest/MeshTest/MeshTest_Debug.cxx +++ b/src/Draw/TKTopTest/MeshTest/MeshTest_Debug.cxx @@ -61,7 +61,7 @@ Standard_EXPORT const char* MeshTest_DrawLinks(const char* theNameStr, void* the } catch (Standard_Failure const& anException) { - return anException.GetMessageString(); + return anException.what(); } } @@ -108,6 +108,6 @@ Standard_EXPORT const char* MeshTest_DrawTriangles(const char* theNameStr, void* } catch (Standard_Failure const& anException) { - return anException.GetMessageString(); + return anException.what(); } } diff --git a/src/Draw/TKXDEDRAW/XDEDRAW/XDEDRAW_Props.cxx b/src/Draw/TKXDEDRAW/XDEDRAW/XDEDRAW_Props.cxx index 7bc215d219..cbabeb0bdf 100644 --- a/src/Draw/TKXDEDRAW/XDEDRAW/XDEDRAW_Props.cxx +++ b/src/Draw/TKXDEDRAW/XDEDRAW/XDEDRAW_Props.cxx @@ -737,7 +737,7 @@ static int CheckProps(Draw_Interpretor& di, int argc, const char** argv) #ifdef OCCT_DEBUG // fflush ( stdout ); di << ": "; - di << anException.GetMessageString(); + di << anException.what(); di << " ** Skip\n"; #endif (void)anException; diff --git a/src/Draw/TKXSDRAWIGES/XSDRAWIGES/XSDRAWIGES.cxx b/src/Draw/TKXSDRAWIGES/XSDRAWIGES/XSDRAWIGES.cxx index dc5af32cb3..cec524e44f 100644 --- a/src/Draw/TKXSDRAWIGES/XSDRAWIGES/XSDRAWIGES.cxx +++ b/src/Draw/TKXSDRAWIGES/XSDRAWIGES/XSDRAWIGES.cxx @@ -301,7 +301,7 @@ static int igesbrep(Draw_Interpretor& theDI, int theNbArgs, const char** theArgV catch (Standard_Failure const& anException) { theDI << "** Exception : "; - theDI << anException.GetMessageString(); + theDI << anException.what(); theDI << " ** Skip\n"; theDI << "Saving shape in variable Draw : " << fname << "\n"; WriteShape(shape, 1); @@ -333,7 +333,7 @@ static int igesbrep(Draw_Interpretor& theDI, int theNbArgs, const char** theArgV catch (Standard_Failure const& anException) { theDI << "** Exception : "; - theDI << anException.GetMessageString(); + theDI << anException.what(); theDI << " ** Skip\n"; } } @@ -408,7 +408,7 @@ static int igesbrep(Draw_Interpretor& theDI, int theNbArgs, const char** theArgV catch (Standard_Failure const& anException) { theDI << "** Exception : "; - theDI << anException.GetMessageString(); + theDI << anException.what(); theDI << " ** Skip\n"; theDI << "Saving shape in variable Draw : " << fname << "\n"; WriteShape(shape, 1); diff --git a/src/FoundationClasses/TKMath/gp/gp_VectorWithNullMagnitude.hxx b/src/FoundationClasses/TKMath/gp/gp_VectorWithNullMagnitude.hxx index cd652fe645..9e06491f5e 100644 --- a/src/FoundationClasses/TKMath/gp/gp_VectorWithNullMagnitude.hxx +++ b/src/FoundationClasses/TKMath/gp/gp_VectorWithNullMagnitude.hxx @@ -17,14 +17,10 @@ #ifndef _gp_VectorWithNullMagnitude_HeaderFile #define _gp_VectorWithNullMagnitude_HeaderFile -#include #include #include #include -class gp_VectorWithNullMagnitude; -DEFINE_STANDARD_HANDLE(gp_VectorWithNullMagnitude, Standard_DomainError) - #if !defined No_Exception && !defined No_gp_VectorWithNullMagnitude #define gp_VectorWithNullMagnitude_Raise_if(CONDITION, MESSAGE) \ if (CONDITION) \ diff --git a/src/FoundationClasses/TKMath/math/math_NotSquare.hxx b/src/FoundationClasses/TKMath/math/math_NotSquare.hxx index 2c6688f080..2dd367f960 100644 --- a/src/FoundationClasses/TKMath/math/math_NotSquare.hxx +++ b/src/FoundationClasses/TKMath/math/math_NotSquare.hxx @@ -17,7 +17,6 @@ #ifndef _math_NotSquare_HeaderFile #define _math_NotSquare_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKMath/math/math_SingularMatrix.hxx b/src/FoundationClasses/TKMath/math/math_SingularMatrix.hxx index 36b4ddbc2f..63a2557650 100644 --- a/src/FoundationClasses/TKMath/math/math_SingularMatrix.hxx +++ b/src/FoundationClasses/TKMath/math/math_SingularMatrix.hxx @@ -17,7 +17,6 @@ #ifndef _math_SingularMatrix_HeaderFile #define _math_SingularMatrix_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/NCollection/NCollection_AliasedArray.hxx b/src/FoundationClasses/TKernel/NCollection/NCollection_AliasedArray.hxx index 203d329de1..14bb5448a6 100644 --- a/src/FoundationClasses/TKernel/NCollection/NCollection_AliasedArray.hxx +++ b/src/FoundationClasses/TKernel/NCollection/NCollection_AliasedArray.hxx @@ -20,6 +20,8 @@ #include #include +#include + //! Defines an array of values of configurable size. //! For instance, this class allows defining an array of 32-bit or 64-bit integer values with //! bitness determined in runtime. The element size in bytes (stride) should be specified at diff --git a/src/FoundationClasses/TKernel/NCollection/NCollection_SparseArrayBase.cxx b/src/FoundationClasses/TKernel/NCollection/NCollection_SparseArrayBase.cxx index 63826253ea..5b8ddb7149 100644 --- a/src/FoundationClasses/TKernel/NCollection/NCollection_SparseArrayBase.cxx +++ b/src/FoundationClasses/TKernel/NCollection/NCollection_SparseArrayBase.cxx @@ -18,6 +18,7 @@ #include #include +#include //================================================================================================= diff --git a/src/FoundationClasses/TKernel/OSD/OSD_Exception.hxx b/src/FoundationClasses/TKernel/OSD/OSD_Exception.hxx index e40930a67c..f274d612ba 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_Exception.hxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_Exception.hxx @@ -15,7 +15,6 @@ #ifndef _OSD_Exception_HeaderFile #define _OSD_Exception_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/OSD/OSD_Exception_ACCESS_VIOLATION.hxx b/src/FoundationClasses/TKernel/OSD/OSD_Exception_ACCESS_VIOLATION.hxx index 6566319d50..277530301c 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_Exception_ACCESS_VIOLATION.hxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_Exception_ACCESS_VIOLATION.hxx @@ -15,7 +15,6 @@ #ifndef _OSD_Exception_ACCESS_VIOLATION_HeaderFile #define _OSD_Exception_ACCESS_VIOLATION_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/OSD/OSD_Exception_ARRAY_BOUNDS_EXCEEDED.hxx b/src/FoundationClasses/TKernel/OSD/OSD_Exception_ARRAY_BOUNDS_EXCEEDED.hxx index 440acd0633..5f494d1fc3 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_Exception_ARRAY_BOUNDS_EXCEEDED.hxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_Exception_ARRAY_BOUNDS_EXCEEDED.hxx @@ -15,7 +15,6 @@ #ifndef _OSD_Exception_ARRAY_BOUNDS_EXCEEDED_HeaderFile #define _OSD_Exception_ARRAY_BOUNDS_EXCEEDED_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/OSD/OSD_Exception_CTRL_BREAK.hxx b/src/FoundationClasses/TKernel/OSD/OSD_Exception_CTRL_BREAK.hxx index 37b9784783..82250becd2 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_Exception_CTRL_BREAK.hxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_Exception_CTRL_BREAK.hxx @@ -15,7 +15,6 @@ #ifndef _OSD_Exception_CTRL_BREAK_HeaderFile #define _OSD_Exception_CTRL_BREAK_HeaderFile -#include #include #include diff --git a/src/FoundationClasses/TKernel/OSD/OSD_Exception_ILLEGAL_INSTRUCTION.hxx b/src/FoundationClasses/TKernel/OSD/OSD_Exception_ILLEGAL_INSTRUCTION.hxx index d8c561bba5..96606906c1 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_Exception_ILLEGAL_INSTRUCTION.hxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_Exception_ILLEGAL_INSTRUCTION.hxx @@ -15,7 +15,6 @@ #ifndef _OSD_Exception_ILLEGAL_INSTRUCTION_HeaderFile #define _OSD_Exception_ILLEGAL_INSTRUCTION_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/OSD/OSD_Exception_INT_OVERFLOW.hxx b/src/FoundationClasses/TKernel/OSD/OSD_Exception_INT_OVERFLOW.hxx index a2173c05f8..a13752ebbb 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_Exception_INT_OVERFLOW.hxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_Exception_INT_OVERFLOW.hxx @@ -15,7 +15,6 @@ #ifndef _OSD_Exception_INT_OVERFLOW_HeaderFile #define _OSD_Exception_INT_OVERFLOW_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/OSD/OSD_Exception_INVALID_DISPOSITION.hxx b/src/FoundationClasses/TKernel/OSD/OSD_Exception_INVALID_DISPOSITION.hxx index 8c9ee85b0c..820bb134b2 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_Exception_INVALID_DISPOSITION.hxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_Exception_INVALID_DISPOSITION.hxx @@ -15,7 +15,6 @@ #ifndef _OSD_Exception_INVALID_DISPOSITION_HeaderFile #define _OSD_Exception_INVALID_DISPOSITION_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/OSD/OSD_Exception_IN_PAGE_ERROR.hxx b/src/FoundationClasses/TKernel/OSD/OSD_Exception_IN_PAGE_ERROR.hxx index a53ff0e127..b1c0f1e7e4 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_Exception_IN_PAGE_ERROR.hxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_Exception_IN_PAGE_ERROR.hxx @@ -15,7 +15,6 @@ #ifndef _OSD_Exception_IN_PAGE_ERROR_HeaderFile #define _OSD_Exception_IN_PAGE_ERROR_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/OSD/OSD_Exception_NONCONTINUABLE_EXCEPTION.hxx b/src/FoundationClasses/TKernel/OSD/OSD_Exception_NONCONTINUABLE_EXCEPTION.hxx index 9dcafb5e13..c58de7fafb 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_Exception_NONCONTINUABLE_EXCEPTION.hxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_Exception_NONCONTINUABLE_EXCEPTION.hxx @@ -15,7 +15,6 @@ #ifndef _OSD_Exception_NONCONTINUABLE_EXCEPTION_HeaderFile #define _OSD_Exception_NONCONTINUABLE_EXCEPTION_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/OSD/OSD_Exception_PRIV_INSTRUCTION.hxx b/src/FoundationClasses/TKernel/OSD/OSD_Exception_PRIV_INSTRUCTION.hxx index 03ae7c5f4e..8f44bdab12 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_Exception_PRIV_INSTRUCTION.hxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_Exception_PRIV_INSTRUCTION.hxx @@ -15,7 +15,6 @@ #ifndef _OSD_Exception_PRIV_INSTRUCTION_HeaderFile #define _OSD_Exception_PRIV_INSTRUCTION_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/OSD/OSD_Exception_STACK_OVERFLOW.hxx b/src/FoundationClasses/TKernel/OSD/OSD_Exception_STACK_OVERFLOW.hxx index b9acacc0bd..69d4c0afec 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_Exception_STACK_OVERFLOW.hxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_Exception_STACK_OVERFLOW.hxx @@ -15,7 +15,6 @@ #ifndef _OSD_Exception_STACK_OVERFLOW_HeaderFile #define _OSD_Exception_STACK_OVERFLOW_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/OSD/OSD_Exception_STATUS_NO_MEMORY.hxx b/src/FoundationClasses/TKernel/OSD/OSD_Exception_STATUS_NO_MEMORY.hxx index 0762ff91e4..743b7fef56 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_Exception_STATUS_NO_MEMORY.hxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_Exception_STATUS_NO_MEMORY.hxx @@ -15,7 +15,6 @@ #ifndef _OSD_Exception_STATUS_NO_MEMORY_HeaderFile #define _OSD_Exception_STATUS_NO_MEMORY_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/OSD/OSD_OSDError.hxx b/src/FoundationClasses/TKernel/OSD/OSD_OSDError.hxx index e949bc9520..d0d30c05fe 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_OSDError.hxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_OSDError.hxx @@ -15,7 +15,6 @@ #ifndef _OSD_OSDError_HeaderFile #define _OSD_OSDError_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/OSD/OSD_SIGBUS.hxx b/src/FoundationClasses/TKernel/OSD/OSD_SIGBUS.hxx index 4d6d443a97..08faf65d95 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_SIGBUS.hxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_SIGBUS.hxx @@ -15,7 +15,6 @@ #ifndef _OSD_SIGBUS_HeaderFile #define _OSD_SIGBUS_HeaderFile -#include #include #include diff --git a/src/FoundationClasses/TKernel/OSD/OSD_SIGHUP.hxx b/src/FoundationClasses/TKernel/OSD/OSD_SIGHUP.hxx index c925fe6e55..0ec5fa9015 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_SIGHUP.hxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_SIGHUP.hxx @@ -15,7 +15,6 @@ #ifndef _OSD_SIGHUP_HeaderFile #define _OSD_SIGHUP_HeaderFile -#include #include #include diff --git a/src/FoundationClasses/TKernel/OSD/OSD_SIGILL.hxx b/src/FoundationClasses/TKernel/OSD/OSD_SIGILL.hxx index 242a6dd5df..5b5ad82bfa 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_SIGILL.hxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_SIGILL.hxx @@ -15,7 +15,6 @@ #ifndef _OSD_SIGILL_HeaderFile #define _OSD_SIGILL_HeaderFile -#include #include #include diff --git a/src/FoundationClasses/TKernel/OSD/OSD_SIGINT.hxx b/src/FoundationClasses/TKernel/OSD/OSD_SIGINT.hxx index 7425352b1c..132f11c0d7 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_SIGINT.hxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_SIGINT.hxx @@ -15,7 +15,6 @@ #ifndef _OSD_SIGINT_HeaderFile #define _OSD_SIGINT_HeaderFile -#include #include #include diff --git a/src/FoundationClasses/TKernel/OSD/OSD_SIGKILL.hxx b/src/FoundationClasses/TKernel/OSD/OSD_SIGKILL.hxx index 08efebef5b..33ade56cd8 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_SIGKILL.hxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_SIGKILL.hxx @@ -15,7 +15,6 @@ #ifndef _OSD_SIGKILL_HeaderFile #define _OSD_SIGKILL_HeaderFile -#include #include #include diff --git a/src/FoundationClasses/TKernel/OSD/OSD_SIGQUIT.hxx b/src/FoundationClasses/TKernel/OSD/OSD_SIGQUIT.hxx index 10a296a361..a8616b4f2b 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_SIGQUIT.hxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_SIGQUIT.hxx @@ -15,7 +15,6 @@ #ifndef _OSD_SIGQUIT_HeaderFile #define _OSD_SIGQUIT_HeaderFile -#include #include #include diff --git a/src/FoundationClasses/TKernel/OSD/OSD_SIGSEGV.hxx b/src/FoundationClasses/TKernel/OSD/OSD_SIGSEGV.hxx index 20adf2ca03..d1c2f6911c 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_SIGSEGV.hxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_SIGSEGV.hxx @@ -15,7 +15,6 @@ #ifndef _OSD_SIGSEGV_HeaderFile #define _OSD_SIGSEGV_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/OSD/OSD_SIGSYS.hxx b/src/FoundationClasses/TKernel/OSD/OSD_SIGSYS.hxx index ee8b13c95e..059db16ac7 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_SIGSYS.hxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_SIGSYS.hxx @@ -15,7 +15,6 @@ #ifndef _OSD_SIGSYS_HeaderFile #define _OSD_SIGSYS_HeaderFile -#include #include #include diff --git a/src/FoundationClasses/TKernel/OSD/OSD_Signal.hxx b/src/FoundationClasses/TKernel/OSD/OSD_Signal.hxx index 1ec1501226..7072201b34 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_Signal.hxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_Signal.hxx @@ -15,7 +15,6 @@ #ifndef _OSD_Signal_HeaderFile #define _OSD_Signal_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/OSD/OSD_ThreadPool.cxx b/src/FoundationClasses/TKernel/OSD/OSD_ThreadPool.cxx index cc6a5106f5..61364ce9f3 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_ThreadPool.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_ThreadPool.cxx @@ -217,7 +217,7 @@ void OSD_ThreadPool::Launcher::wait() aThreadIter.Next()) { aThreadIter.ChangeValue()->WaitIdle(); - if (!aThreadIter.Value()->myFailure.IsNull()) + if (aThreadIter.Value()->myFailure) { ++aNbFailures; } @@ -232,18 +232,19 @@ void OSD_ThreadPool::Launcher::wait() aThreadIter.More() && aThreadIter.Value() != nullptr; aThreadIter.Next()) { - if (!aThreadIter.Value()->myFailure.IsNull()) + if (aThreadIter.Value()->myFailure) { if (aNbFailures == 1) { - aThreadIter.Value()->myFailure->Reraise(); + // Re-throw the single exception directly + throw *aThreadIter.Value()->myFailure; } if (!aFailures.IsEmpty()) { aFailures += "\n"; } - aFailures += aThreadIter.Value()->myFailure->GetMessageString(); + aFailures += aThreadIter.Value()->myFailure->what(); } } @@ -253,9 +254,9 @@ void OSD_ThreadPool::Launcher::wait() //================================================================================================= -void OSD_ThreadPool::performJob(occ::handle& theFailure, - OSD_ThreadPool::JobInterface* theJob, - int theThreadIndex) +void OSD_ThreadPool::performJob(std::optional& theFailure, + OSD_ThreadPool::JobInterface* theJob, + int theThreadIndex) { try { @@ -265,18 +266,18 @@ void OSD_ThreadPool::performJob(occ::handle& theFailure, catch (Standard_Failure const& aFailure) { TCollection_AsciiString aMsg = - TCollection_AsciiString(aFailure.DynamicType()->Name()) + ": " + aFailure.GetMessageString(); - theFailure = new Standard_ProgramError(aMsg.ToCString(), aFailure.GetStackString()); + TCollection_AsciiString(aFailure.ExceptionType()) + ": " + aFailure.what(); + theFailure.emplace(aMsg.ToCString(), aFailure.GetStackString()); } catch (std::exception& anStdException) { TCollection_AsciiString aMsg = TCollection_AsciiString(typeid(anStdException).name()) + ": " + anStdException.what(); - theFailure = new Standard_ProgramError(aMsg.ToCString(), nullptr); + theFailure.emplace(aMsg.ToCString(), nullptr); } catch (...) { - theFailure = new Standard_ProgramError("Error: Unknown exception", nullptr); + theFailure.emplace("Error: Unknown exception", nullptr); } } @@ -294,7 +295,7 @@ void OSD_ThreadPool::EnumeratedThread::performThread() return; } - myFailure.Nullify(); + myFailure.reset(); if (myJob != nullptr) { OSD::SetThreadLocalSignal(OSD::SignalMode(), myToCatchFpe); diff --git a/src/FoundationClasses/TKernel/OSD/OSD_ThreadPool.hxx b/src/FoundationClasses/TKernel/OSD/OSD_ThreadPool.hxx index e8084f1244..c9e283f153 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_ThreadPool.hxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_ThreadPool.hxx @@ -19,7 +19,10 @@ #include #include +#include + #include +#include //! Class defining a thread pool for executing algorithms in multi-threaded mode. //! Thread pool allocates requested amount of threads and keep them alive @@ -183,16 +186,16 @@ protected: static void* runThread(void* theTask); private: - OSD_ThreadPool* myPool; - JobInterface* myJob; - occ::handle myFailure; - Standard_Condition myWakeEvent; - Standard_Condition myIdleEvent; - int myThreadIndex; - std::atomic myUsageCounter; - bool myIsStarted; - bool myToCatchFpe; - bool myIsSelfThread; + OSD_ThreadPool* myPool; + JobInterface* myJob; + std::optional myFailure; + Standard_Condition myWakeEvent; + Standard_Condition myIdleEvent; + int myThreadIndex; + std::atomic myUsageCounter; + bool myIsStarted; + bool myToCatchFpe; + bool myIsSelfThread; }; public: @@ -336,9 +339,9 @@ protected: void release(); //! Perform the job and catch exceptions. - static void performJob(occ::handle& theFailure, - OSD_ThreadPool::JobInterface* theJob, - int theThreadIndex); + static void performJob(std::optional& theFailure, + OSD_ThreadPool::JobInterface* theJob, + int theThreadIndex); private: //! This method should not be called (prohibited). diff --git a/src/FoundationClasses/TKernel/OSD/OSD_signal.cxx b/src/FoundationClasses/TKernel/OSD/OSD_signal.cxx index 03b08dfcfc..8fc77876ed 100644 --- a/src/FoundationClasses/TKernel/OSD/OSD_signal.cxx +++ b/src/FoundationClasses/TKernel/OSD/OSD_signal.cxx @@ -12,6 +12,7 @@ // commercial license or contractual agreement. #include +#include #include #include #include @@ -106,7 +107,7 @@ static LONG _osd_debug(void); #define _OSD_FPX (_EM_INVALID | _EM_DENORMAL | _EM_ZERODIVIDE | _EM_OVERFLOW) #ifdef OCC_CONVERT_SIGNALS - #define THROW_OR_JUMP(Type, Message, Stack) Type::NewInstance(Message, Stack)->Jump() + #define THROW_OR_JUMP(Type, Message, Stack) Standard_ErrorHandler::Abort(Type(Message, Stack)) #else #define THROW_OR_JUMP(Type, Message, Stack) throw Type(Message, Stack) #endif @@ -818,41 +819,41 @@ static void Handler(const int theSignal) switch (theSignal) { case SIGHUP: - OSD_SIGHUP::NewInstance("SIGHUP 'hangup' detected.")->Jump(); + Standard_ErrorHandler::Abort(OSD_SIGHUP("SIGHUP 'hangup' detected.")); exit(SIGHUP); break; case SIGINT: // For safe handling of Control-C as stop event, arm a variable but do not // generate longjump (we are out of context anyway) fCtrlBrk = true; - // OSD_SIGINT::NewInstance("SIGINT 'interrupt' detected.")->Jump(); + // Standard_ErrorHandler::Abort(OSD_SIGINT("SIGINT 'interrupt' detected.")); // exit(SIGINT); break; case SIGQUIT: - OSD_SIGQUIT::NewInstance("SIGQUIT 'quit' detected.")->Jump(); + Standard_ErrorHandler::Abort(OSD_SIGQUIT("SIGQUIT 'quit' detected.")); exit(SIGQUIT); break; case SIGILL: - OSD_SIGILL::NewInstance("SIGILL 'illegal instruction' detected.")->Jump(); + Standard_ErrorHandler::Abort(OSD_SIGILL("SIGILL 'illegal instruction' detected.")); exit(SIGILL); break; case SIGKILL: - OSD_SIGKILL::NewInstance("SIGKILL 'kill' detected.")->Jump(); + Standard_ErrorHandler::Abort(OSD_SIGKILL("SIGKILL 'kill' detected.")); exit(SIGKILL); break; case SIGBUS: sigaddset(&set, SIGBUS); sigprocmask(SIG_UNBLOCK, &set, nullptr); - OSD_SIGBUS::NewInstance("SIGBUS 'bus error' detected.")->Jump(); + Standard_ErrorHandler::Abort(OSD_SIGBUS("SIGBUS 'bus error' detected.")); exit(SIGBUS); break; case SIGSEGV: - OSD_SIGSEGV::NewInstance("SIGSEGV 'segmentation violation' detected.")->Jump(); + Standard_ErrorHandler::Abort(OSD_SIGSEGV("SIGSEGV 'segmentation violation' detected.")); exit(SIGSEGV); break; #ifdef SIGSYS case SIGSYS: - OSD_SIGSYS::NewInstance("SIGSYS 'bad argument to system call' detected.")->Jump(); + Standard_ErrorHandler::Abort(OSD_SIGSYS("SIGSYS 'bad argument to system call' detected.")); exit(SIGSYS); break; #endif @@ -863,7 +864,7 @@ static void Handler(const int theSignal) OSD::SetFloatingSignal(true); #endif #if (!defined(__sun)) && (!defined(SOLARIS)) - Standard_NumericError::NewInstance("SIGFPE Arithmetic exception detected")->Jump(); + Standard_ErrorHandler::Abort(Standard_NumericError("SIGFPE Arithmetic exception detected")); break; #else // Reste SOLARIS @@ -872,34 +873,34 @@ static void Handler(const int theSignal) switch (aSigInfo->si_code) { case FPE_FLTDIV_TRAP: - Standard_DivideByZero::NewInstance("Floating Divide By Zero")->Jump(); + Standard_ErrorHandler::Abort(Standard_DivideByZero("Floating Divide By Zero")); break; case FPE_INTDIV_TRAP: - Standard_DivideByZero::NewInstance("Integer Divide By Zero")->Jump(); + Standard_ErrorHandler::Abort(Standard_DivideByZero("Integer Divide By Zero")); break; case FPE_FLTOVF_TRAP: - Standard_Overflow::NewInstance("Floating Overflow")->Jump(); + Standard_ErrorHandler::Abort(Standard_Overflow("Floating Overflow")); break; case FPE_INTOVF_TRAP: - Standard_Overflow::NewInstance("Integer Overflow")->Jump(); + Standard_ErrorHandler::Abort(Standard_Overflow("Integer Overflow")); break; case FPE_FLTUND_TRAP: - Standard_NumericError::NewInstance("Floating Underflow")->Jump(); + Standard_ErrorHandler::Abort(Standard_NumericError("Floating Underflow")); break; case FPE_FLTRES_TRAP: - Standard_NumericError::NewInstance("Floating Point Inexact Result")->Jump(); + Standard_ErrorHandler::Abort(Standard_NumericError("Floating Point Inexact Result")); break; case FPE_FLTINV_TRAP: - Standard_NumericError::NewInstance("Invalid Floating Point Operation")->Jump(); + Standard_ErrorHandler::Abort(Standard_NumericError("Invalid Floating Point Operation")); break; default: - Standard_NumericError::NewInstance("Numeric Error")->Jump(); + Standard_ErrorHandler::Abort(Standard_NumericError("Numeric Error")); break; } } else { - Standard_NumericError::NewInstance("SIGFPE Arithmetic exception detected")->Jump(); + Standard_ErrorHandler::Abort(Standard_NumericError("SIGFPE Arithmetic exception detected")); } #endif break; @@ -940,7 +941,7 @@ static void SegvHandler(const int theSignal, siginfo_t* theSigInfo, void* const Standard::StackTrace(aStackBuffer, aStackBufLen, aStackLength); } - OSD_SIGSEGV::NewInstance(aMsg, aStackBuffer)->Jump(); + Standard_ErrorHandler::Abort(OSD_SIGSEGV(aMsg, aStackBuffer)); } } #ifdef OCCT_DEBUG @@ -965,7 +966,7 @@ static void SegvHandler(const int theSignal, siginfo_t* theSigInfo, void* const { char aMsg[100]; Sprintf(aMsg, "SIGSEGV 'segmentation violation' detected. Address %lx", anOffset); - OSD_SIGSEGV::NewInstance(aMsg)->Jump(); + Standard_ErrorHandler::Abort(OSD_SIGSEGV(aMsg)); } } #ifdef OCCT_DEBUG diff --git a/src/FoundationClasses/TKernel/Plugin/Plugin_Failure.hxx b/src/FoundationClasses/TKernel/Plugin/Plugin_Failure.hxx index 8923f92113..8d8f158d4b 100644 --- a/src/FoundationClasses/TKernel/Plugin/Plugin_Failure.hxx +++ b/src/FoundationClasses/TKernel/Plugin/Plugin_Failure.hxx @@ -17,7 +17,6 @@ #ifndef _Plugin_Failure_HeaderFile #define _Plugin_Failure_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Quantity/Quantity_DateDefinitionError.hxx b/src/FoundationClasses/TKernel/Quantity/Quantity_DateDefinitionError.hxx index 98fe15ba8e..2ab861a4ab 100644 --- a/src/FoundationClasses/TKernel/Quantity/Quantity_DateDefinitionError.hxx +++ b/src/FoundationClasses/TKernel/Quantity/Quantity_DateDefinitionError.hxx @@ -17,7 +17,6 @@ #ifndef _Quantity_DateDefinitionError_HeaderFile #define _Quantity_DateDefinitionError_HeaderFile -#include #include #include diff --git a/src/FoundationClasses/TKernel/Quantity/Quantity_PeriodDefinitionError.hxx b/src/FoundationClasses/TKernel/Quantity/Quantity_PeriodDefinitionError.hxx index 09fb2b4752..9014250e06 100644 --- a/src/FoundationClasses/TKernel/Quantity/Quantity_PeriodDefinitionError.hxx +++ b/src/FoundationClasses/TKernel/Quantity/Quantity_PeriodDefinitionError.hxx @@ -17,7 +17,6 @@ #ifndef _Quantity_PeriodDefinitionError_HeaderFile #define _Quantity_PeriodDefinitionError_HeaderFile -#include #include #include diff --git a/src/FoundationClasses/TKernel/Resource/Resource_NoSuchResource.hxx b/src/FoundationClasses/TKernel/Resource/Resource_NoSuchResource.hxx index 333aca15fb..0265649977 100644 --- a/src/FoundationClasses/TKernel/Resource/Resource_NoSuchResource.hxx +++ b/src/FoundationClasses/TKernel/Resource/Resource_NoSuchResource.hxx @@ -17,7 +17,6 @@ #ifndef _Resource_NoSuchResource_HeaderFile #define _Resource_NoSuchResource_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Standard/Standard_AbortiveTransaction.hxx b/src/FoundationClasses/TKernel/Standard/Standard_AbortiveTransaction.hxx index 70581ba45a..46385a34f0 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_AbortiveTransaction.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_AbortiveTransaction.hxx @@ -17,7 +17,6 @@ #ifndef _Standard_AbortiveTransaction_HeaderFile #define _Standard_AbortiveTransaction_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Standard/Standard_ConstructionError.hxx b/src/FoundationClasses/TKernel/Standard/Standard_ConstructionError.hxx index de309b6b14..2c29f549f6 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_ConstructionError.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_ConstructionError.hxx @@ -17,7 +17,6 @@ #ifndef _Standard_ConstructionError_HeaderFile #define _Standard_ConstructionError_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Standard/Standard_DefineException.hxx b/src/FoundationClasses/TKernel/Standard/Standard_DefineException.hxx index 8227f18a66..0681f81e4f 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_DefineException.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_DefineException.hxx @@ -14,59 +14,41 @@ #ifndef _Standard_DefineException_HeaderFile #define _Standard_DefineException_HeaderFile -#include +#include -//! Defines an exception class \a C1 that inherits an exception class \a C2. -/*! \a C2 must be Standard_Failure or its ancestor. - The macro defines empty constructor, copy constructor and static methods Raise() and - NewInstance(). Since Standard_Failure implements class manipulated by handle, - DEFINE_STANDARD_RTTI macro is also added to enable RTTI. - - When using DEFINE_STANDARD_EXCEPTION in your code make sure you also insert a macro - DEFINE_STANDARD_HANDLE(C1,C2) before it. -*/ +#include +//! @brief Defines an exception class inheriting from Standard_Failure. +//! +//! This macro creates a complete exception class with: +//! - Constructors that forward to base class +//! - ExceptionType() override returning the class name +//! +//! Usage: +//! @code +//! DEFINE_STANDARD_EXCEPTION(Standard_OutOfRange, Standard_RangeError) +//! @endcode +//! +//! @param C1 Name of the exception class to define +//! @param C2 Name of the parent exception class (must be Standard_Failure or derived) #define DEFINE_STANDARD_EXCEPTION(C1, C2) \ - \ class C1 : public C2 \ { \ - void Throw() const override \ - { \ - throw *this; \ - } \ - \ public: \ - C1() {} \ - C1(const char* theMessage) \ + C1(const char* theMessage = "") \ : C2(theMessage) \ { \ } \ + \ C1(const char* theMessage, const char* theStackTrace) \ : C2(theMessage, theStackTrace) \ { \ } \ - static void Raise(const char* theMessage = "") \ + \ + const char* ExceptionType() const noexcept override \ { \ - occ::handle _E = new C1; \ - _E->Reraise(theMessage); \ + return #C1; \ } \ - static void Raise(Standard_SStream& theMessage) \ - { \ - occ::handle _E = new C1; \ - _E->Reraise(theMessage); \ - } \ - static occ::handle NewInstance(const char* theMessage = "") \ - { \ - return new C1(theMessage); \ - } \ - static occ::handle NewInstance(const char* theMessage, const char* theStackTrace) \ - { \ - return new C1(theMessage, theStackTrace); \ - } \ - DEFINE_STANDARD_RTTI_INLINE(C1, C2) \ }; -//! Obsolete macro, kept for compatibility with old code -#define IMPLEMENT_STANDARD_EXCEPTION(C1) - #endif diff --git a/src/FoundationClasses/TKernel/Standard/Standard_DimensionError.hxx b/src/FoundationClasses/TKernel/Standard/Standard_DimensionError.hxx index f394d0e177..5c04640e4a 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_DimensionError.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_DimensionError.hxx @@ -17,7 +17,6 @@ #ifndef _Standard_DimensionError_HeaderFile #define _Standard_DimensionError_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Standard/Standard_DimensionMismatch.hxx b/src/FoundationClasses/TKernel/Standard/Standard_DimensionMismatch.hxx index 002b6c46d8..603a981981 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_DimensionMismatch.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_DimensionMismatch.hxx @@ -17,7 +17,6 @@ #ifndef _Standard_DimensionMismatch_HeaderFile #define _Standard_DimensionMismatch_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Standard/Standard_DivideByZero.hxx b/src/FoundationClasses/TKernel/Standard/Standard_DivideByZero.hxx index 440f857093..ecd4c8558b 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_DivideByZero.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_DivideByZero.hxx @@ -17,7 +17,6 @@ #ifndef _Standard_DivideByZero_HeaderFile #define _Standard_DivideByZero_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Standard/Standard_DomainError.hxx b/src/FoundationClasses/TKernel/Standard/Standard_DomainError.hxx index 42c2e20e88..cee75fb662 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_DomainError.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_DomainError.hxx @@ -17,7 +17,6 @@ #ifndef _Standard_DomainError_HeaderFile #define _Standard_DomainError_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Standard/Standard_ErrorHandler.cxx b/src/FoundationClasses/TKernel/Standard/Standard_ErrorHandler.cxx index 043ed25353..3f7ff5264a 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_ErrorHandler.cxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_ErrorHandler.cxx @@ -14,8 +14,6 @@ #include -#include - // During [sig]setjmp()/[sig]longjmp() K_SETJMP is non zero (try) // So if there is an abort request and if K_SETJMP is non zero, the abort // request will be ignored. If the abort request do a raise during a setjmp @@ -77,34 +75,25 @@ bool Standard_ErrorHandler::IsInTryBlock() //================================================================================================= -void Standard_ErrorHandler::Abort(const occ::handle& theError) -{ - Standard_ErrorHandler* anActive = FindHandler(); - - if (anActive == nullptr) - { - std::cerr << "*** Abort *** an exception was raised, but no catch was found." << std::endl; - if (!theError.IsNull()) - std::cerr << "\t... The exception is:" << theError->GetMessageString() << std::endl; - exit(1); - } - - anActive->myCaughtError = theError; - longjmp(anActive->myLabel, true); -} - -//================================================================================================= - void Standard_ErrorHandler::Raise() { - if (myCaughtError.IsNull()) + if (std::holds_alternative(myCaughtError)) { - std::cerr << "*** Abort *** an exception handler was called, but not exception object is set." + std::cerr << "*** Abort *** an exception handler was called, but no exception object is set." << std::endl; exit(1); } - myCaughtError->Reraise(); + // Visit the variant and throw the appropriate exception type + std::visit( + [](auto&& theException) { + using T = std::decay_t; + if constexpr (!std::is_same_v) + { + throw theException; + } + }, + myCaughtError); } //================================================================================================= diff --git a/src/FoundationClasses/TKernel/Standard/Standard_ErrorHandler.hxx b/src/FoundationClasses/TKernel/Standard/Standard_ErrorHandler.hxx index 945e3065d3..b2b85efd3a 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_ErrorHandler.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_ErrorHandler.hxx @@ -18,10 +18,35 @@ #define _Standard_ErrorHandler_HeaderFile #include -#include -#include #include +#include +#include + +// Signal exception types for variant storage +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include //! @file //! Support of handling of C signals as C++-style exceptions, and implementation @@ -65,8 +90,6 @@ #endif -class Standard_Failure; - //! Class implementing mechanics of conversion of signals to exceptions. //! //! Each instance of it stores data for jump placement, @@ -76,6 +99,34 @@ class Standard_Failure; //! to find appropriate handler when signal is raised. class Standard_ErrorHandler { +public: + //! Variant type holding all possible signal exceptions. + //! Used to store exception across longjmp without heap allocation. + using SignalException = std::variant; + public: DEFINE_STANDARD_ALLOC @@ -96,23 +147,25 @@ public: //! Returns label for jump jmp_buf& Label() { return myLabel; } - //! Returns the current Error. - const occ::handle& Error() const { return myCaughtError; } + //! Returns the current Error variant. + const SignalException& Error() const { return myCaughtError; } //! Test if the code is currently running in a try block Standard_EXPORT static bool IsInTryBlock(); + //! Abort with specific exception type. + //! Finds nearest error handler, stores exception, and performs longjmp. + //! @tparam T Exception type (must be one of Standard_SignalException variant types) + //! @param theError Exception to store and throw after longjmp + template + static void Abort(const T& theError); + private: //! Removes handler from the list. void Unlink(); - //! Finds nearest error handler in the stack and sets its exception object to @p theError - //! and long jump which then throw normal C++ exception. - //! If handler not found, prints error and exit program with error code @c 1. - static void Abort(const occ::handle& theError); - //! Returns the current handler (closest in the stack in the current execution thread) - static Standard_ErrorHandler* FindHandler(); + Standard_EXPORT static Standard_ErrorHandler* FindHandler(); public: //! Defines a base class for callback objects that can be registered @@ -178,14 +231,31 @@ public: }; private: - Standard_ErrorHandler* myPrevious = nullptr; - occ::handle myCaughtError; - jmp_buf myLabel = {}; - Callback* myCallbackPtr = nullptr; - - friend class Standard_Failure; + SignalException myCaughtError; + Standard_ErrorHandler* myPrevious = nullptr; + Callback* myCallbackPtr = nullptr; + jmp_buf myLabel = {}; }; +//! Template implementation of Abort - stores exception and performs longjmp. +template +void Standard_ErrorHandler::Abort(const T& theError) +{ +#ifndef OCC_CONVERT_SIGNALS + throw theError; +#else + Standard_ErrorHandler* anActive = FindHandler(); + if (anActive == nullptr) + { + std::cerr << "*** Abort *** an exception was raised, but no catch was found." << std::endl; + std::cerr << "\t... The exception is: " << theError.what() << std::endl; + exit(1); + } + anActive->myCaughtError = theError; + longjmp(anActive->myLabel, true); +#endif +} + // If OCC_CONVERT_SIGNALS is not defined, // provide empty inline implementation #if !defined(OCC_CONVERT_SIGNALS) diff --git a/src/FoundationClasses/TKernel/Standard/Standard_Failure.cxx b/src/FoundationClasses/TKernel/Standard/Standard_Failure.cxx index e1b2dd48d8..96401f4fd5 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_Failure.cxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_Failure.cxx @@ -15,16 +15,10 @@ #include #include -#include -#include -#include -#include -#include +#include #include -IMPLEMENT_STANDARD_RTTIEXT(Standard_Failure, Standard_Transient) - namespace { //! Global parameter defining default length of stack trace. @@ -33,18 +27,18 @@ static int Standard_Failure_DefaultStackTraceLength = 0; //================================================================================================= -Standard_Failure::StringRef* Standard_Failure::StringRef::allocate_message(const char* theString) +Standard_Failure::StringRef* Standard_Failure::StringRef::Allocate(const char* theString) { - if (theString == nullptr || *theString == '\0') + if (theString == nullptr || theString[0] == '\0') { return nullptr; } - const size_t aLen = strlen(theString); + const size_t aLen = std::strlen(theString); StringRef* aStrPtr = (StringRef*)Standard::AllocateOptimal(aLen + sizeof(int) + 1); if (aStrPtr != nullptr) { - strcpy((char*)&aStrPtr->Message[0], theString); + std::strcpy(&aStrPtr->Message[0], theString); aStrPtr->Counter = 1; } return aStrPtr; @@ -52,8 +46,7 @@ Standard_Failure::StringRef* Standard_Failure::StringRef::allocate_message(const //================================================================================================= -Standard_Failure::StringRef* Standard_Failure::StringRef::copy_message( - Standard_Failure::StringRef* theString) +Standard_Failure::StringRef* Standard_Failure::StringRef::Copy(StringRef* theString) { if (theString == nullptr) { @@ -66,13 +59,34 @@ Standard_Failure::StringRef* Standard_Failure::StringRef::copy_message( //================================================================================================= -void Standard_Failure::StringRef::deallocate_message(Standard_Failure::StringRef* theString) +void Standard_Failure::StringRef::Free(StringRef* theString) { if (theString != nullptr) { if (--theString->Counter == 0) { - Standard::Free((void*)theString); + Standard::Free(theString); + } + } +} + +//================================================================================================= + +void Standard_Failure::captureStackTrace() +{ + const int aStackLength = Standard_Failure_DefaultStackTraceLength; + if (aStackLength > 0) + { + // Limit stack allocation to 64KB to prevent stack overflow + const int aStackBufLen = std::clamp(aStackLength * 200, 2048, 65536); + char* aStackBuffer = (char*)alloca(aStackBufLen); + if (aStackBuffer != nullptr) + { + std::memset(aStackBuffer, 0, aStackBufLen); + if (Standard::StackTrace(aStackBuffer, aStackBufLen, aStackLength, nullptr, 1)) + { + myStackTrace = StringRef::Allocate(aStackBuffer); + } } } } @@ -83,94 +97,71 @@ Standard_Failure::Standard_Failure() : myMessage(nullptr), myStackTrace(nullptr) { - const int aStackLength = Standard_Failure_DefaultStackTraceLength; - if (aStackLength > 0) - { - int aStackBufLen = std::max(aStackLength * 200, 2048); - char* aStackBuffer = (char*)alloca(aStackBufLen); - if (aStackBuffer != nullptr) - { - memset(aStackBuffer, 0, aStackBufLen); - if (Standard::StackTrace(aStackBuffer, aStackBufLen, aStackLength, nullptr, 1)) - { - myStackTrace = StringRef::allocate_message(aStackBuffer); - } - } - } + captureStackTrace(); } //================================================================================================= -Standard_Failure::Standard_Failure(const char* theDesc) +Standard_Failure::Standard_Failure(const char* theMessage) : myMessage(nullptr), myStackTrace(nullptr) { - myMessage = StringRef::allocate_message(theDesc); - const int aStackLength = Standard_Failure_DefaultStackTraceLength; - if (aStackLength > 0) - { - int aStackBufLen = std::max(aStackLength * 200, 2048); - char* aStackBuffer = (char*)alloca(aStackBufLen); - if (aStackBuffer != nullptr) - { - memset(aStackBuffer, 0, aStackBufLen); - Standard::StackTrace(aStackBuffer, aStackBufLen, aStackLength, nullptr, 1); - myStackTrace = StringRef::allocate_message(aStackBuffer); - } - } + myMessage = StringRef::Allocate(theMessage); + captureStackTrace(); } //================================================================================================= -Standard_Failure::Standard_Failure(const char* theDesc, const char* theStackTrace) +Standard_Failure::Standard_Failure(const char* theMessage, const char* theStackTrace) : myMessage(nullptr), myStackTrace(nullptr) { - myMessage = StringRef::allocate_message(theDesc); - myStackTrace = StringRef::allocate_message(theStackTrace); + myMessage = StringRef::Allocate(theMessage); + myStackTrace = StringRef::Allocate(theStackTrace); } //================================================================================================= -Standard_Failure::Standard_Failure(const Standard_Failure& theFailure) - : Standard_Transient(theFailure), +Standard_Failure::Standard_Failure(const Standard_Failure& theOther) + : std::exception(theOther), myMessage(nullptr), myStackTrace(nullptr) { - myMessage = StringRef::copy_message(theFailure.myMessage); - myStackTrace = StringRef::copy_message(theFailure.myStackTrace); + myMessage = StringRef::Copy(theOther.myMessage); + myStackTrace = StringRef::Copy(theOther.myStackTrace); +} + +//================================================================================================= + +Standard_Failure& Standard_Failure::operator=(const Standard_Failure& theOther) +{ + if (this != &theOther) + { + StringRef::Free(myMessage); + StringRef::Free(myStackTrace); + myMessage = StringRef::Copy(theOther.myMessage); + myStackTrace = StringRef::Copy(theOther.myStackTrace); + } + return *this; } //================================================================================================= Standard_Failure::~Standard_Failure() { - StringRef::deallocate_message(myMessage); - StringRef::deallocate_message(myStackTrace); + StringRef::Free(myMessage); + StringRef::Free(myStackTrace); } //================================================================================================= -const char* Standard_Failure::GetMessageString() const +const char* Standard_Failure::what() const noexcept { return myMessage != nullptr ? myMessage->GetMessage() : ""; } //================================================================================================= -void Standard_Failure::SetMessageString(const char* theDesc) -{ - if (theDesc == GetMessageString()) - { - return; - } - - StringRef::deallocate_message(myMessage); - myMessage = StringRef::allocate_message(theDesc); -} - -//================================================================================================= - const char* Standard_Failure::GetStackString() const { return myStackTrace != nullptr ? myStackTrace->GetMessage() : ""; @@ -178,109 +169,24 @@ const char* Standard_Failure::GetStackString() const //================================================================================================= -void Standard_Failure::SetStackString(const char* theStack) -{ - if (theStack == GetStackString()) - { - return; - } - - StringRef::deallocate_message(myStackTrace); - myStackTrace = StringRef::allocate_message(theStack); -} - -//================================================================================================= - -void Standard_Failure::Raise(const char* theDesc) -{ - occ::handle aFailure = new Standard_Failure(); - aFailure->Reraise(theDesc); -} - -//================================================================================================= - -void Standard_Failure::Raise(const Standard_SStream& theReason) -{ - occ::handle aFailure = new Standard_Failure(); - aFailure->Reraise(theReason); -} - -//================================================================================================= - -void Standard_Failure::Reraise(const char* theDesc) -{ - SetMessageString(theDesc); - Reraise(); -} - -//================================================================================================= - -void Standard_Failure::Reraise(const Standard_SStream& theReason) -{ - SetMessageString(theReason.str().c_str()); - Reraise(); -} - -//================================================================================================= - -void Standard_Failure::Reraise() -{ - Throw(); -} - -//================================================================================================= - -void Standard_Failure::Jump() -{ -#if defined(OCC_CONVERT_SIGNALS) - Standard_ErrorHandler::Abort(this); -#else - Throw(); -#endif -} - -//================================================================================================= - -void Standard_Failure::Throw() const -{ - throw *this; -} - -//================================================================================================= - void Standard_Failure::Print(Standard_OStream& theStream) const { if (myMessage != nullptr) { - theStream << DynamicType() << ": " << GetMessageString(); + theStream << ExceptionType() << ": " << myMessage->GetMessage(); } else { - theStream << DynamicType(); + theStream << ExceptionType(); } if (myStackTrace != nullptr) { - theStream << GetStackString(); + theStream << myStackTrace->GetMessage(); } } //================================================================================================= -occ::handle Standard_Failure::NewInstance(const char* theString) -{ - return new Standard_Failure(theString); -} - -//================================================================================================= - -occ::handle Standard_Failure::NewInstance(const char* theMessage, - const char* theStackTrace) -{ - return new Standard_Failure(theMessage, theStackTrace); -} - -//================================================================================================= - int Standard_Failure::DefaultStackTraceLength() { return Standard_Failure_DefaultStackTraceLength; diff --git a/src/FoundationClasses/TKernel/Standard/Standard_Failure.hxx b/src/FoundationClasses/TKernel/Standard/Standard_Failure.hxx index 175174d599..b46e7e55c7 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_Failure.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_Failure.hxx @@ -17,82 +17,62 @@ #ifndef _Standard_Failure_HeaderFile #define _Standard_Failure_HeaderFile -#include - -#include -#include +#include #include #include +#include + //! Forms the root of the entire exception hierarchy. -class Standard_Failure : public Standard_Transient +//! Inherits from std::exception and implements what() interface. +class Standard_Failure : public std::exception { public: + DEFINE_STANDARD_ALLOC + //! Creates a status object of type "Failure". Standard_EXPORT Standard_Failure(); //! Copy constructor - Standard_EXPORT Standard_Failure(const Standard_Failure& f); + Standard_EXPORT Standard_Failure(const Standard_Failure& theOther); - //! Creates a status object of type "Failure". - //! @param[in] theDesc exception description - Standard_EXPORT Standard_Failure(const char* theDesc); + //! Creates a status object of type "Failure" with message. + //! @param[in] theMessage exception description + Standard_EXPORT Standard_Failure(const char* theMessage); - //! Creates a status object of type "Failure" with stack trace. - //! @param[in] theDesc exception description - //! @param[in] theStackTrace associated stack trace - Standard_EXPORT Standard_Failure(const char* theDesc, const char* theStackTrace); + //! Creates a status object of type "Failure" with message and stack trace. + //! @param[in] theMessage exception description + //! @param[in] theStackTrace stack trace string + Standard_EXPORT Standard_Failure(const char* theMessage, const char* theStackTrace); //! Assignment operator - Standard_EXPORT Standard_Failure& operator=(const Standard_Failure& f); + Standard_EXPORT Standard_Failure& operator=(const Standard_Failure& theOther); //! Destructor Standard_EXPORT ~Standard_Failure() override; - //! Prints on the stream @p theStream the exception name followed by the error message. - //! - //! Note: there is a short-cut @c operator<< (Standard_OStream&, occ::handle&) - Standard_EXPORT void Print(Standard_OStream& theStream) const; + //! Returns error message (implements std::exception interface). + //! Returns empty string "" if no message was set. + Standard_EXPORT const char* what() const noexcept override; //! Returns error message - Standard_EXPORT virtual const char* GetMessageString() const; + Standard_DEPRECATED("Use what() instead") + const char* GetMessageString() const noexcept { return what(); } - //! Sets error message - Standard_EXPORT virtual void SetMessageString(const char* theMessage); + //! Returns the exception type name. + //! Default implementation returns "Standard_Failure". + //! Derived classes override this to return their own type name. + virtual const char* ExceptionType() const noexcept { return "Standard_Failure"; } - //! Returns the stack trace string - Standard_EXPORT virtual const char* GetStackString() const; + //! Returns the stack trace string (empty string if not available). + Standard_EXPORT const char* GetStackString() const; - //! Sets the stack trace string - Standard_EXPORT virtual void SetStackString(const char* theStack); - - Standard_EXPORT void Reraise(); - - Standard_EXPORT void Reraise(const char* aMessage); - - //! Reraises a caught exception and changes its error message. - Standard_EXPORT void Reraise(const Standard_SStream& aReason); + //! Prints on the stream @p theStream the exception name followed by the error message. + //! + //! Note: there is a short-cut @c operator<< (Standard_OStream&, const Standard_Failure&) + Standard_EXPORT void Print(Standard_OStream& theStream) const; public: - //! Raises an exception of type "Failure" and associates - //! an error message to it. The message can be printed - //! in an exception handler. - Standard_EXPORT static void Raise(const char* aMessage = ""); - - //! Raises an exception of type "Failure" and associates - //! an error message to it. The message can be constructed - //! at run-time. - Standard_EXPORT static void Raise(const Standard_SStream& aReason); - - //! Used to construct an instance of the exception object as a handle. - //! Shall be used to protect against possible construction of exception object in C stack, - //! which is dangerous since some of methods require that object was allocated dynamically. - Standard_EXPORT static occ::handle NewInstance(const char* theMessage); - - //! Used to construct an instance of the exception object as a handle. - Standard_EXPORT static occ::handle NewInstance(const char* theMessage, - const char* theStackTrace); - //! Returns the default length of stack trace to be captured by Standard_Failure constructor; //! 0 by default meaning no stack trace. Standard_EXPORT static int DefaultStackTraceLength(); @@ -100,65 +80,37 @@ public: //! Sets default length of stack trace to be captured by Standard_Failure constructor. Standard_EXPORT static void SetDefaultStackTraceLength(int theNbStackTraces); -public: - //! Used to throw CASCADE exception from C signal handler. - //! On platforms that do not allow throwing C++ exceptions - //! from this handler (e.g. Linux), uses longjump to get to - //! the current active signal handler, and only then is - //! converted to C++ exception. - Standard_EXPORT void Jump(); - - DEFINE_STANDARD_RTTIEXT(Standard_Failure, Standard_Transient) - -protected: - //! Used only if standard C++ exceptions are used. - //! Throws exception of the same type as this by C++ throw, - //! and stores current object as last thrown exception, - //! to be accessible by method Caught() - Standard_EXPORT virtual void Throw() const; - private: - //! Reference-counted string, - //! Memory block is allocated with an extra 4-byte header (int representing number of references) - //! using low-level malloc() to avoid exceptions. + //! Reference-counted string using malloc/free for exception safety. + //! Memory block has a 4-byte header (int for reference count). struct StringRef { int Counter; char Message[1]; //! Return message string. - const char* GetMessage() const { return (const char*)&Message[0]; } + const char* GetMessage() const { return &Message[0]; } //! Allocate reference-counted message string. - static StringRef* allocate_message(const char* theString); + static StringRef* Allocate(const char* theString); - //! Copy reference-counted message string. - static StringRef* copy_message(StringRef* theString); + //! Copy reference-counted message string (increments counter). + static StringRef* Copy(StringRef* theString); //! Release reference-counted message string. - static void deallocate_message(StringRef* theString); + static void Free(StringRef* theString); }; + //! Captures stack trace if configured. + void captureStackTrace(); + private: - StringRef* myMessage; - StringRef* myStackTrace; + StringRef* myMessage; //!< Exception message + StringRef* myStackTrace; //!< Stack trace (optional) }; -// ======================================================================= -// function : operator<< -// purpose : -// ======================================================================= -inline Standard_OStream& operator<<(Standard_OStream& theStream, - const occ::handle& theFailure) -{ - theFailure->Print(theStream); - return theStream; -} +//================================================================================================= -// ======================================================================= -// function : operator<< -// purpose : -// ======================================================================= inline Standard_OStream& operator<<(Standard_OStream& theStream, const Standard_Failure& theFailure) { theFailure.Print(theStream); diff --git a/src/FoundationClasses/TKernel/Standard/Standard_ImmutableObject.hxx b/src/FoundationClasses/TKernel/Standard/Standard_ImmutableObject.hxx index ba9ee7e261..f443cb6cc6 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_ImmutableObject.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_ImmutableObject.hxx @@ -17,7 +17,6 @@ #ifndef _Standard_ImmutableObject_HeaderFile #define _Standard_ImmutableObject_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Standard/Standard_LicenseError.hxx b/src/FoundationClasses/TKernel/Standard/Standard_LicenseError.hxx index 1eb5514a3e..70704e426c 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_LicenseError.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_LicenseError.hxx @@ -17,7 +17,6 @@ #ifndef _Standard_LicenseError_HeaderFile #define _Standard_LicenseError_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Standard/Standard_LicenseNotFound.hxx b/src/FoundationClasses/TKernel/Standard/Standard_LicenseNotFound.hxx index 7e010ae0f7..92d7d7b8ee 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_LicenseNotFound.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_LicenseNotFound.hxx @@ -17,7 +17,6 @@ #ifndef _Standard_LicenseNotFound_HeaderFile #define _Standard_LicenseNotFound_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Standard/Standard_MMgrOpt.cxx b/src/FoundationClasses/TKernel/Standard/Standard_MMgrOpt.cxx index 4659e9fc08..83c4686889 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_MMgrOpt.cxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_MMgrOpt.cxx @@ -21,6 +21,7 @@ #include #include +#include #include #include diff --git a/src/FoundationClasses/TKernel/Standard/Standard_MultiplyDefined.hxx b/src/FoundationClasses/TKernel/Standard/Standard_MultiplyDefined.hxx index 9cc3fc3ff1..e2399d5cbb 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_MultiplyDefined.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_MultiplyDefined.hxx @@ -17,7 +17,6 @@ #ifndef _Standard_MultiplyDefined_HeaderFile #define _Standard_MultiplyDefined_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Standard/Standard_NegativeValue.hxx b/src/FoundationClasses/TKernel/Standard/Standard_NegativeValue.hxx index 4d1ceb032d..81e1530a83 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_NegativeValue.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_NegativeValue.hxx @@ -17,7 +17,6 @@ #ifndef _Standard_NegativeValue_HeaderFile #define _Standard_NegativeValue_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Standard/Standard_NoMoreObject.hxx b/src/FoundationClasses/TKernel/Standard/Standard_NoMoreObject.hxx index 649a6b72c0..68654156de 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_NoMoreObject.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_NoMoreObject.hxx @@ -17,7 +17,6 @@ #ifndef _Standard_NoMoreObject_HeaderFile #define _Standard_NoMoreObject_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Standard/Standard_NoSuchObject.hxx b/src/FoundationClasses/TKernel/Standard/Standard_NoSuchObject.hxx index 3b565d5ff2..22c51bbbe3 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_NoSuchObject.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_NoSuchObject.hxx @@ -17,7 +17,6 @@ #ifndef _Standard_NoSuchObject_HeaderFile #define _Standard_NoSuchObject_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Standard/Standard_NotImplemented.hxx b/src/FoundationClasses/TKernel/Standard/Standard_NotImplemented.hxx index 1beef1d874..deb4934af5 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_NotImplemented.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_NotImplemented.hxx @@ -17,7 +17,6 @@ #ifndef _Standard_NotImplemented_HeaderFile #define _Standard_NotImplemented_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Standard/Standard_NullObject.hxx b/src/FoundationClasses/TKernel/Standard/Standard_NullObject.hxx index 26f4c720f6..4095ca72e3 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_NullObject.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_NullObject.hxx @@ -17,7 +17,6 @@ #ifndef _Standard_NullObject_HeaderFile #define _Standard_NullObject_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Standard/Standard_NullValue.hxx b/src/FoundationClasses/TKernel/Standard/Standard_NullValue.hxx index 497d7d8d94..2e6af6ee4e 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_NullValue.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_NullValue.hxx @@ -17,7 +17,6 @@ #ifndef _Standard_NullValue_HeaderFile #define _Standard_NullValue_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Standard/Standard_NumericError.hxx b/src/FoundationClasses/TKernel/Standard/Standard_NumericError.hxx index 983c295c92..33ac3915ff 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_NumericError.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_NumericError.hxx @@ -17,7 +17,6 @@ #ifndef _Standard_NumericError_HeaderFile #define _Standard_NumericError_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Standard/Standard_OutOfMemory.cxx b/src/FoundationClasses/TKernel/Standard/Standard_OutOfMemory.cxx index ed933c1dff..4f6310893c 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_OutOfMemory.cxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_OutOfMemory.cxx @@ -15,26 +15,22 @@ #include -#ifdef min - #undef min -#endif - #include #include - -IMPLEMENT_STANDARD_RTTIEXT(Standard_OutOfMemory, Standard_ProgramError) +#include //================================================================================================= Standard_OutOfMemory::Standard_OutOfMemory(const char* theMessage) { + myBuffer[0] = '\0'; // call explicitly own method (non-virtual call) Standard_OutOfMemory::SetMessageString(theMessage); } //================================================================================================= -const char* Standard_OutOfMemory::GetMessageString() const +const char* Standard_OutOfMemory::what() const noexcept { return myBuffer; } @@ -44,50 +40,11 @@ const char* Standard_OutOfMemory::GetMessageString() const void Standard_OutOfMemory::SetMessageString(const char* theMessage) { // restrict length of the message by buffer size - size_t n = (theMessage ? std::min(strlen(theMessage), sizeof(myBuffer) - 1) : 0); + const size_t aLength = (theMessage ? std::min(std::strlen(theMessage), sizeof(myBuffer) - 1) : 0); - // first set line end symbol to be safe in case of concurrent call - myBuffer[n] = '\0'; - if (n > 0) - memcpy(myBuffer, theMessage, n); -} - -//================================================================================================= - -void Standard_OutOfMemory::Raise(const char* theMessage) -{ - NewInstance(theMessage)->Reraise(); -} - -//================================================================================================= - -void Standard_OutOfMemory::Raise(Standard_SStream& theMessage) -{ - NewInstance(theMessage.str().c_str())->Reraise(); -} - -//================================================================================================= - -// global instance must be allocated at load-time -static occ::handle anOutOfMemInstance = new Standard_OutOfMemory; - -occ::handle Standard_OutOfMemory::NewInstance(const char* theMessage) -{ - anOutOfMemInstance->SetMessageString(theMessage); - return anOutOfMemInstance; -} - -occ::handle Standard_OutOfMemory::NewInstance(const char* theMessage, - const char* theStackTrace) -{ - anOutOfMemInstance->SetMessageString(theMessage); - anOutOfMemInstance->SetStackString(theStackTrace); - return anOutOfMemInstance; -} - -//================================================================================================= - -void Standard_OutOfMemory::Throw() const -{ - throw *this; + myBuffer[aLength] = '\0'; + if (aLength > 0) + { + std::memcpy(myBuffer, theMessage, aLength); + } } diff --git a/src/FoundationClasses/TKernel/Standard/Standard_OutOfMemory.hxx b/src/FoundationClasses/TKernel/Standard/Standard_OutOfMemory.hxx index d2dcc4e8fc..88e1751bf3 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_OutOfMemory.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_OutOfMemory.hxx @@ -17,9 +17,10 @@ #ifndef _Standard_OutOfMemory_HeaderFile #define _Standard_OutOfMemory_HeaderFile -#include #include +#include + #if !defined No_Exception && !defined No_Standard_OutOfMemory #define Standard_OutOfMemory_Raise_if(CONDITION, MESSAGE) \ if (CONDITION) \ @@ -32,46 +33,30 @@ //! macro DEFINE_STANDARD_EXCEPTION, to avoid necessity of dynamic //! memory allocations during throwing and stack unwinding: //! -//! - method NewInstance() returns static instance (singleton) -//! - method Raise() raises copy of that singleton, resetting -//! its message string //! - message string is stored as field, not allocated dynamically //! (storable message length is limited by buffer size) //! //! The reason is that in out-of-memory condition any memory allocation can //! fail, thus use of operator new for allocation of new exception instance //! is dangerous (can cause recursion until stack overflow, see #24836). - class Standard_OutOfMemory : public Standard_ProgramError { - Standard_EXPORT void Throw() const override; - public: - //! Constructor is kept public for backward compatibility + //! Constructor is kept public for backward compatibility. + //! @param theMessage optional error message Standard_EXPORT Standard_OutOfMemory(const char* theMessage = nullptr); - //! Returns error message - Standard_EXPORT const char* GetMessageString() const override; + //! Returns error message (implements std::exception interface). + Standard_EXPORT const char* what() const noexcept override; - //! Sets error message - Standard_EXPORT void SetMessageString(const char* aMessage) override; + //! Returns the exception type name. + const char* ExceptionType() const noexcept override { return "Standard_OutOfMemory"; } - //! Raises exception with specified message string - Standard_EXPORT static void Raise(const char* theMessage = ""); + //! Sets error message. + //! @param theMessage error message (can be nullptr) + Standard_EXPORT void SetMessageString(const char* theMessage); - //! Raises exception with specified message string - Standard_EXPORT static void Raise(Standard_SStream& theMessage); - - //! Returns global instance of exception - Standard_EXPORT static occ::handle NewInstance(const char* theMessage = ""); - - //! Returns global instance of exception - Standard_EXPORT static occ::handle NewInstance(const char* theMessage, - const char* theStackTrace); - - DEFINE_STANDARD_RTTIEXT(Standard_OutOfMemory, Standard_ProgramError) - -protected: +private: char myBuffer[1024]; }; diff --git a/src/FoundationClasses/TKernel/Standard/Standard_OutOfRange.hxx b/src/FoundationClasses/TKernel/Standard/Standard_OutOfRange.hxx index 976ab20fc8..799dd8bbc9 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_OutOfRange.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_OutOfRange.hxx @@ -17,7 +17,6 @@ #ifndef _Standard_OutOfRange_HeaderFile #define _Standard_OutOfRange_HeaderFile -#include #include #include diff --git a/src/FoundationClasses/TKernel/Standard/Standard_Overflow.hxx b/src/FoundationClasses/TKernel/Standard/Standard_Overflow.hxx index 702ca08b3e..cdefbaf398 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_Overflow.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_Overflow.hxx @@ -17,7 +17,6 @@ #ifndef _Standard_Overflow_HeaderFile #define _Standard_Overflow_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Standard/Standard_ProgramError.hxx b/src/FoundationClasses/TKernel/Standard/Standard_ProgramError.hxx index 46836d24e7..876924c6f4 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_ProgramError.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_ProgramError.hxx @@ -17,7 +17,6 @@ #ifndef _Standard_ProgramError_HeaderFile #define _Standard_ProgramError_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Standard/Standard_RangeError.hxx b/src/FoundationClasses/TKernel/Standard/Standard_RangeError.hxx index f9763ccca9..cbcb7c60cf 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_RangeError.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_RangeError.hxx @@ -17,7 +17,6 @@ #ifndef _Standard_RangeError_HeaderFile #define _Standard_RangeError_HeaderFile -#include #include #include diff --git a/src/FoundationClasses/TKernel/Standard/Standard_TypeMismatch.hxx b/src/FoundationClasses/TKernel/Standard/Standard_TypeMismatch.hxx index fc7c855f68..302d14ca6d 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_TypeMismatch.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_TypeMismatch.hxx @@ -17,7 +17,6 @@ #ifndef _Standard_TypeMismatch_HeaderFile #define _Standard_TypeMismatch_HeaderFile -#include #include #include diff --git a/src/FoundationClasses/TKernel/Standard/Standard_Underflow.hxx b/src/FoundationClasses/TKernel/Standard/Standard_Underflow.hxx index 31369278bc..548bba8399 100644 --- a/src/FoundationClasses/TKernel/Standard/Standard_Underflow.hxx +++ b/src/FoundationClasses/TKernel/Standard/Standard_Underflow.hxx @@ -17,7 +17,6 @@ #ifndef _Standard_Underflow_HeaderFile #define _Standard_Underflow_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/StdFail/StdFail_InfiniteSolutions.hxx b/src/FoundationClasses/TKernel/StdFail/StdFail_InfiniteSolutions.hxx index bd3080983f..28af380d99 100644 --- a/src/FoundationClasses/TKernel/StdFail/StdFail_InfiniteSolutions.hxx +++ b/src/FoundationClasses/TKernel/StdFail/StdFail_InfiniteSolutions.hxx @@ -17,7 +17,6 @@ #ifndef _StdFail_InfiniteSolutions_HeaderFile #define _StdFail_InfiniteSolutions_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/StdFail/StdFail_NotDone.hxx b/src/FoundationClasses/TKernel/StdFail/StdFail_NotDone.hxx index 7b92e79ee3..1971a85d67 100644 --- a/src/FoundationClasses/TKernel/StdFail/StdFail_NotDone.hxx +++ b/src/FoundationClasses/TKernel/StdFail/StdFail_NotDone.hxx @@ -17,7 +17,6 @@ #ifndef _StdFail_NotDone_HeaderFile #define _StdFail_NotDone_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/StdFail/StdFail_Undefined.hxx b/src/FoundationClasses/TKernel/StdFail/StdFail_Undefined.hxx index 4474a2c64c..48e43228aa 100644 --- a/src/FoundationClasses/TKernel/StdFail/StdFail_Undefined.hxx +++ b/src/FoundationClasses/TKernel/StdFail/StdFail_Undefined.hxx @@ -17,7 +17,6 @@ #ifndef _StdFail_Undefined_HeaderFile #define _StdFail_Undefined_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/StdFail/StdFail_UndefinedDerivative.hxx b/src/FoundationClasses/TKernel/StdFail/StdFail_UndefinedDerivative.hxx index 0a4ecbfca6..cbf87ec7d2 100644 --- a/src/FoundationClasses/TKernel/StdFail/StdFail_UndefinedDerivative.hxx +++ b/src/FoundationClasses/TKernel/StdFail/StdFail_UndefinedDerivative.hxx @@ -17,7 +17,6 @@ #ifndef _StdFail_UndefinedDerivative_HeaderFile #define _StdFail_UndefinedDerivative_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/StdFail/StdFail_UndefinedValue.hxx b/src/FoundationClasses/TKernel/StdFail/StdFail_UndefinedValue.hxx index a93ef6c088..071550985b 100644 --- a/src/FoundationClasses/TKernel/StdFail/StdFail_UndefinedValue.hxx +++ b/src/FoundationClasses/TKernel/StdFail/StdFail_UndefinedValue.hxx @@ -17,7 +17,6 @@ #ifndef _StdFail_UndefinedValue_HeaderFile #define _StdFail_UndefinedValue_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Storage/Storage_StreamExtCharParityError.hxx b/src/FoundationClasses/TKernel/Storage/Storage_StreamExtCharParityError.hxx index 7256bf3838..94e648cb0e 100644 --- a/src/FoundationClasses/TKernel/Storage/Storage_StreamExtCharParityError.hxx +++ b/src/FoundationClasses/TKernel/Storage/Storage_StreamExtCharParityError.hxx @@ -17,7 +17,6 @@ #ifndef _Storage_StreamExtCharParityError_HeaderFile #define _Storage_StreamExtCharParityError_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Storage/Storage_StreamFormatError.hxx b/src/FoundationClasses/TKernel/Storage/Storage_StreamFormatError.hxx index 3b1098818d..171f720de9 100644 --- a/src/FoundationClasses/TKernel/Storage/Storage_StreamFormatError.hxx +++ b/src/FoundationClasses/TKernel/Storage/Storage_StreamFormatError.hxx @@ -17,7 +17,6 @@ #ifndef _Storage_StreamFormatError_HeaderFile #define _Storage_StreamFormatError_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Storage/Storage_StreamModeError.hxx b/src/FoundationClasses/TKernel/Storage/Storage_StreamModeError.hxx index 121d5210b4..6771687537 100644 --- a/src/FoundationClasses/TKernel/Storage/Storage_StreamModeError.hxx +++ b/src/FoundationClasses/TKernel/Storage/Storage_StreamModeError.hxx @@ -17,7 +17,6 @@ #ifndef _Storage_StreamModeError_HeaderFile #define _Storage_StreamModeError_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Storage/Storage_StreamReadError.hxx b/src/FoundationClasses/TKernel/Storage/Storage_StreamReadError.hxx index f89782bfd7..e79643dcf3 100644 --- a/src/FoundationClasses/TKernel/Storage/Storage_StreamReadError.hxx +++ b/src/FoundationClasses/TKernel/Storage/Storage_StreamReadError.hxx @@ -17,7 +17,6 @@ #ifndef _Storage_StreamReadError_HeaderFile #define _Storage_StreamReadError_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Storage/Storage_StreamTypeMismatchError.hxx b/src/FoundationClasses/TKernel/Storage/Storage_StreamTypeMismatchError.hxx index bca9f539df..a07f706765 100644 --- a/src/FoundationClasses/TKernel/Storage/Storage_StreamTypeMismatchError.hxx +++ b/src/FoundationClasses/TKernel/Storage/Storage_StreamTypeMismatchError.hxx @@ -17,7 +17,6 @@ #ifndef _Storage_StreamTypeMismatchError_HeaderFile #define _Storage_StreamTypeMismatchError_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Storage/Storage_StreamUnknownTypeError.hxx b/src/FoundationClasses/TKernel/Storage/Storage_StreamUnknownTypeError.hxx index 36de72cf06..0aaddd7efd 100644 --- a/src/FoundationClasses/TKernel/Storage/Storage_StreamUnknownTypeError.hxx +++ b/src/FoundationClasses/TKernel/Storage/Storage_StreamUnknownTypeError.hxx @@ -17,7 +17,6 @@ #ifndef _Storage_StreamUnknownTypeError_HeaderFile #define _Storage_StreamUnknownTypeError_HeaderFile -#include #include #include diff --git a/src/FoundationClasses/TKernel/Storage/Storage_StreamWriteError.hxx b/src/FoundationClasses/TKernel/Storage/Storage_StreamWriteError.hxx index 8caf8ce65d..a31274884d 100644 --- a/src/FoundationClasses/TKernel/Storage/Storage_StreamWriteError.hxx +++ b/src/FoundationClasses/TKernel/Storage/Storage_StreamWriteError.hxx @@ -17,7 +17,6 @@ #ifndef _Storage_StreamWriteError_HeaderFile #define _Storage_StreamWriteError_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/TColStd/TColStd_HPackedMapOfInteger.hxx b/src/FoundationClasses/TKernel/TColStd/TColStd_HPackedMapOfInteger.hxx index 94647fb241..8351a8514b 100644 --- a/src/FoundationClasses/TKernel/TColStd/TColStd_HPackedMapOfInteger.hxx +++ b/src/FoundationClasses/TKernel/TColStd/TColStd_HPackedMapOfInteger.hxx @@ -18,6 +18,7 @@ #include +#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Units/Units_NoSuchType.hxx b/src/FoundationClasses/TKernel/Units/Units_NoSuchType.hxx index 1a0878d9f5..a6890511c2 100644 --- a/src/FoundationClasses/TKernel/Units/Units_NoSuchType.hxx +++ b/src/FoundationClasses/TKernel/Units/Units_NoSuchType.hxx @@ -17,7 +17,6 @@ #ifndef _Units_NoSuchType_HeaderFile #define _Units_NoSuchType_HeaderFile -#include #include #include #include diff --git a/src/FoundationClasses/TKernel/Units/Units_NoSuchUnit.hxx b/src/FoundationClasses/TKernel/Units/Units_NoSuchUnit.hxx index 38961afb30..f29aac7ab8 100644 --- a/src/FoundationClasses/TKernel/Units/Units_NoSuchUnit.hxx +++ b/src/FoundationClasses/TKernel/Units/Units_NoSuchUnit.hxx @@ -17,7 +17,6 @@ #ifndef _Units_NoSuchUnit_HeaderFile #define _Units_NoSuchUnit_HeaderFile -#include #include #include #include diff --git a/src/ModelingAlgorithms/TKExpress/Expr/Expr_ExprFailure.hxx b/src/ModelingAlgorithms/TKExpress/Expr/Expr_ExprFailure.hxx index f7a4be6797..080556d38f 100644 --- a/src/ModelingAlgorithms/TKExpress/Expr/Expr_ExprFailure.hxx +++ b/src/ModelingAlgorithms/TKExpress/Expr/Expr_ExprFailure.hxx @@ -17,7 +17,6 @@ #ifndef _Expr_ExprFailure_HeaderFile #define _Expr_ExprFailure_HeaderFile -#include #include #include #include diff --git a/src/ModelingAlgorithms/TKExpress/Expr/Expr_InvalidAssignment.hxx b/src/ModelingAlgorithms/TKExpress/Expr/Expr_InvalidAssignment.hxx index 0b0747b5f2..65eb866270 100644 --- a/src/ModelingAlgorithms/TKExpress/Expr/Expr_InvalidAssignment.hxx +++ b/src/ModelingAlgorithms/TKExpress/Expr/Expr_InvalidAssignment.hxx @@ -17,7 +17,6 @@ #ifndef _Expr_InvalidAssignment_HeaderFile #define _Expr_InvalidAssignment_HeaderFile -#include #include #include #include diff --git a/src/ModelingAlgorithms/TKExpress/Expr/Expr_InvalidFunction.hxx b/src/ModelingAlgorithms/TKExpress/Expr/Expr_InvalidFunction.hxx index c591a81808..45df3e5c3b 100644 --- a/src/ModelingAlgorithms/TKExpress/Expr/Expr_InvalidFunction.hxx +++ b/src/ModelingAlgorithms/TKExpress/Expr/Expr_InvalidFunction.hxx @@ -17,7 +17,6 @@ #ifndef _Expr_InvalidFunction_HeaderFile #define _Expr_InvalidFunction_HeaderFile -#include #include #include #include diff --git a/src/ModelingAlgorithms/TKExpress/Expr/Expr_InvalidOperand.hxx b/src/ModelingAlgorithms/TKExpress/Expr/Expr_InvalidOperand.hxx index 9eee69633b..74f8a3bec9 100644 --- a/src/ModelingAlgorithms/TKExpress/Expr/Expr_InvalidOperand.hxx +++ b/src/ModelingAlgorithms/TKExpress/Expr/Expr_InvalidOperand.hxx @@ -17,7 +17,6 @@ #ifndef _Expr_InvalidOperand_HeaderFile #define _Expr_InvalidOperand_HeaderFile -#include #include #include #include diff --git a/src/ModelingAlgorithms/TKExpress/Expr/Expr_NotAssigned.hxx b/src/ModelingAlgorithms/TKExpress/Expr/Expr_NotAssigned.hxx index 502906af24..d8bfc526e9 100644 --- a/src/ModelingAlgorithms/TKExpress/Expr/Expr_NotAssigned.hxx +++ b/src/ModelingAlgorithms/TKExpress/Expr/Expr_NotAssigned.hxx @@ -17,7 +17,6 @@ #ifndef _Expr_NotAssigned_HeaderFile #define _Expr_NotAssigned_HeaderFile -#include #include #include #include diff --git a/src/ModelingAlgorithms/TKExpress/Expr/Expr_NotEvaluable.hxx b/src/ModelingAlgorithms/TKExpress/Expr/Expr_NotEvaluable.hxx index 9356d443b7..cb30b5c1b3 100644 --- a/src/ModelingAlgorithms/TKExpress/Expr/Expr_NotEvaluable.hxx +++ b/src/ModelingAlgorithms/TKExpress/Expr/Expr_NotEvaluable.hxx @@ -17,7 +17,6 @@ #ifndef _Expr_NotEvaluable_HeaderFile #define _Expr_NotEvaluable_HeaderFile -#include #include #include #include diff --git a/src/ModelingAlgorithms/TKExpress/ExprIntrp/ExprIntrp_SyntaxError.hxx b/src/ModelingAlgorithms/TKExpress/ExprIntrp/ExprIntrp_SyntaxError.hxx index 8c6e0c463b..b5ab236e95 100644 --- a/src/ModelingAlgorithms/TKExpress/ExprIntrp/ExprIntrp_SyntaxError.hxx +++ b/src/ModelingAlgorithms/TKExpress/ExprIntrp/ExprIntrp_SyntaxError.hxx @@ -17,7 +17,6 @@ #ifndef _ExprIntrp_SyntaxError_HeaderFile #define _ExprIntrp_SyntaxError_HeaderFile -#include #include #include #include diff --git a/src/ModelingAlgorithms/TKGeomAlgo/GccAna/GccAna_NoSolution.hxx b/src/ModelingAlgorithms/TKGeomAlgo/GccAna/GccAna_NoSolution.hxx index cf6a2bc387..4509b075f8 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/GccAna/GccAna_NoSolution.hxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/GccAna/GccAna_NoSolution.hxx @@ -17,7 +17,6 @@ #ifndef _GccAna_NoSolution_HeaderFile #define _GccAna_NoSolution_HeaderFile -#include #include #include #include diff --git a/src/ModelingAlgorithms/TKGeomAlgo/GccEnt/GccEnt_BadQualifier.hxx b/src/ModelingAlgorithms/TKGeomAlgo/GccEnt/GccEnt_BadQualifier.hxx index e316a7c985..d3039ef71a 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/GccEnt/GccEnt_BadQualifier.hxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/GccEnt/GccEnt_BadQualifier.hxx @@ -17,7 +17,6 @@ #ifndef _GccEnt_BadQualifier_HeaderFile #define _GccEnt_BadQualifier_HeaderFile -#include #include #include #include diff --git a/src/ModelingAlgorithms/TKGeomAlgo/Geom2dGcc/Geom2dGcc_IsParallel.hxx b/src/ModelingAlgorithms/TKGeomAlgo/Geom2dGcc/Geom2dGcc_IsParallel.hxx index 101eca3d19..fc152385c8 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/Geom2dGcc/Geom2dGcc_IsParallel.hxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/Geom2dGcc/Geom2dGcc_IsParallel.hxx @@ -17,7 +17,6 @@ #ifndef _Geom2dGcc_IsParallel_HeaderFile #define _Geom2dGcc_IsParallel_HeaderFile -#include #include #include diff --git a/src/ModelingAlgorithms/TKGeomAlgo/NLPlate/NLPlate_HGPPConstraint.hxx b/src/ModelingAlgorithms/TKGeomAlgo/NLPlate/NLPlate_HGPPConstraint.hxx index 6c5cac428f..7dd18c6555 100644 --- a/src/ModelingAlgorithms/TKGeomAlgo/NLPlate/NLPlate_HGPPConstraint.hxx +++ b/src/ModelingAlgorithms/TKGeomAlgo/NLPlate/NLPlate_HGPPConstraint.hxx @@ -21,8 +21,10 @@ #include #include +#include #include #include + class gp_XYZ; class Plate_D1; class Plate_D2; diff --git a/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_PolyInternalNode.hxx b/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_PolyInternalNode.hxx index 2e47d8f257..e5afb0cb1e 100644 --- a/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_PolyInternalNode.hxx +++ b/src/ModelingAlgorithms/TKHLR/HLRAlgo/HLRAlgo_PolyInternalNode.hxx @@ -21,6 +21,7 @@ #include #include +#include #include #include #include diff --git a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_DataStructureOfDelaun.cxx b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_DataStructureOfDelaun.cxx index 50eb6fe476..fd92ccde07 100644 --- a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_DataStructureOfDelaun.cxx +++ b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_DataStructureOfDelaun.cxx @@ -494,7 +494,7 @@ const char* BRepMesh_Dump(void* theMeshHandlePtr, const char* theFileNameStr) } catch (Standard_Failure const& anException) { - return anException.GetMessageString(); + return anException.what(); } return theFileNameStr; diff --git a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_Delaun.cxx b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_Delaun.cxx index 6e44356346..8351d0bf27 100644 --- a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_Delaun.cxx +++ b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_Delaun.cxx @@ -2591,7 +2591,7 @@ const char* BRepMesh_DumpPoly(void* thePolygon, void* theMeshHandlePtr, const ch } catch (Standard_Failure const& anException) { - return anException.GetMessageString(); + return anException.what(); } return theFileNameStr; diff --git a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_Triangulator.cxx b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_Triangulator.cxx index dd19b70abb..74e81c77b0 100644 --- a/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_Triangulator.cxx +++ b/src/ModelingAlgorithms/TKMesh/BRepMesh/BRepMesh_Triangulator.cxx @@ -266,7 +266,7 @@ bool BRepMesh_Triangulator::triangulate(NCollection_List& thePoly { TCollection_AsciiString aStr( "makeTrianglesUsingBRepMesh: Exception raised during polygon triangulation: "); - aStr.AssignCat(aFailure.GetMessageString()); + aStr.AssignCat(aFailure.what()); myMess->Send(aStr.ToCString(), Message_Fail); return false; } diff --git a/src/ModelingAlgorithms/TKShHealing/ShapeProcess/ShapeProcess.cxx b/src/ModelingAlgorithms/TKShHealing/ShapeProcess/ShapeProcess.cxx index cc74847111..3237d0396b 100644 --- a/src/ModelingAlgorithms/TKShHealing/ShapeProcess/ShapeProcess.cxx +++ b/src/ModelingAlgorithms/TKShHealing/ShapeProcess/ShapeProcess.cxx @@ -169,7 +169,7 @@ bool ShapeProcess::Perform(const occ::handle& context, catch (Standard_Failure const& anException) { Message_Msg SMSG2("SP.Sequence.Error.Except"); // Operator %s failed with exception %s - SMSG2 << oper << anException.GetMessageString(); + SMSG2 << oper << anException.what(); context->Messenger()->Send(SMSG2, Message_Alarm); } } @@ -213,7 +213,7 @@ bool ShapeProcess::Perform(const occ::handle& theContext, catch (const Standard_Failure& anException) { Message_Msg aMessage("SP.Sequence.Error.Except"); // Operator %s failed with exception %s - aMessage << anOperationName << anException.GetMessageString(); + aMessage << anOperationName << anException.what(); theContext->Messenger()->Send(aMessage, Message_Alarm); } } diff --git a/src/ModelingAlgorithms/TKTopAlgo/BRepExtrema/BRepExtrema_UnCompatibleShape.hxx b/src/ModelingAlgorithms/TKTopAlgo/BRepExtrema/BRepExtrema_UnCompatibleShape.hxx index 0bdb7854b1..9e375303a4 100644 --- a/src/ModelingAlgorithms/TKTopAlgo/BRepExtrema/BRepExtrema_UnCompatibleShape.hxx +++ b/src/ModelingAlgorithms/TKTopAlgo/BRepExtrema/BRepExtrema_UnCompatibleShape.hxx @@ -17,7 +17,6 @@ #ifndef _BRepExtrema_UnCompatibleShape_HeaderFile #define _BRepExtrema_UnCompatibleShape_HeaderFile -#include #include #include #include diff --git a/src/ModelingData/TKBRep/BRepTools/BRepTools_Debug.cxx b/src/ModelingData/TKBRep/BRepTools/BRepTools_Debug.cxx index 3371bc7f0b..074ee061f8 100644 --- a/src/ModelingData/TKBRep/BRepTools/BRepTools_Debug.cxx +++ b/src/ModelingData/TKBRep/BRepTools/BRepTools_Debug.cxx @@ -39,7 +39,7 @@ const char* BRepTools_Write(const char* theFileStr, void* theShapePtr) } catch (Standard_Failure const& anException) { - return anException.GetMessageString(); + return anException.what(); } } @@ -62,7 +62,7 @@ const char* BRepTools_Dump(void* theShapePtr) } catch (Standard_Failure const& anException) { - return anException.GetMessageString(); + return anException.what(); } } @@ -87,7 +87,7 @@ const char* BRepTools_DumpLoc(void* theLocationPtr) } catch (Standard_Failure const& anException) { - return anException.GetMessageString(); + return anException.what(); } } diff --git a/src/ModelingData/TKBRep/TopoDS/TopoDS_FrozenShape.hxx b/src/ModelingData/TKBRep/TopoDS/TopoDS_FrozenShape.hxx index 1c29f977a5..e1479eade2 100644 --- a/src/ModelingData/TKBRep/TopoDS/TopoDS_FrozenShape.hxx +++ b/src/ModelingData/TKBRep/TopoDS/TopoDS_FrozenShape.hxx @@ -17,7 +17,6 @@ #ifndef _TopoDS_FrozenShape_HeaderFile #define _TopoDS_FrozenShape_HeaderFile -#include #include #include #include diff --git a/src/ModelingData/TKBRep/TopoDS/TopoDS_LockedShape.hxx b/src/ModelingData/TKBRep/TopoDS/TopoDS_LockedShape.hxx index 86d363a51c..b80526519f 100644 --- a/src/ModelingData/TKBRep/TopoDS/TopoDS_LockedShape.hxx +++ b/src/ModelingData/TKBRep/TopoDS/TopoDS_LockedShape.hxx @@ -17,7 +17,6 @@ #ifndef _TopoDS_LockedShape_HeaderFile #define _TopoDS_LockedShape_HeaderFile -#include #include #include #include diff --git a/src/ModelingData/TKBRep/TopoDS/TopoDS_UnCompatibleShapes.hxx b/src/ModelingData/TKBRep/TopoDS/TopoDS_UnCompatibleShapes.hxx index b51a4e48cd..b37758ada5 100644 --- a/src/ModelingData/TKBRep/TopoDS/TopoDS_UnCompatibleShapes.hxx +++ b/src/ModelingData/TKBRep/TopoDS/TopoDS_UnCompatibleShapes.hxx @@ -17,7 +17,6 @@ #ifndef _TopoDS_UnCompatibleShapes_HeaderFile #define _TopoDS_UnCompatibleShapes_HeaderFile -#include #include #include #include diff --git a/src/ModelingData/TKG2d/Geom2d/Geom2d_UndefinedDerivative.hxx b/src/ModelingData/TKG2d/Geom2d/Geom2d_UndefinedDerivative.hxx index 9c7628f08d..5469af7f10 100644 --- a/src/ModelingData/TKG2d/Geom2d/Geom2d_UndefinedDerivative.hxx +++ b/src/ModelingData/TKG2d/Geom2d/Geom2d_UndefinedDerivative.hxx @@ -17,7 +17,6 @@ #ifndef _Geom2d_UndefinedDerivative_HeaderFile #define _Geom2d_UndefinedDerivative_HeaderFile -#include #include #include #include diff --git a/src/ModelingData/TKG2d/Geom2d/Geom2d_UndefinedValue.hxx b/src/ModelingData/TKG2d/Geom2d/Geom2d_UndefinedValue.hxx index 18db7c12ef..65a8684b04 100644 --- a/src/ModelingData/TKG2d/Geom2d/Geom2d_UndefinedValue.hxx +++ b/src/ModelingData/TKG2d/Geom2d/Geom2d_UndefinedValue.hxx @@ -17,7 +17,6 @@ #ifndef _Geom2d_UndefinedValue_HeaderFile #define _Geom2d_UndefinedValue_HeaderFile -#include #include #include #include diff --git a/src/ModelingData/TKG2d/LProp/LProp_BadContinuity.hxx b/src/ModelingData/TKG2d/LProp/LProp_BadContinuity.hxx index 7d0fb5f302..81e9bca121 100644 --- a/src/ModelingData/TKG2d/LProp/LProp_BadContinuity.hxx +++ b/src/ModelingData/TKG2d/LProp/LProp_BadContinuity.hxx @@ -17,7 +17,6 @@ #ifndef _LProp_BadContinuity_HeaderFile #define _LProp_BadContinuity_HeaderFile -#include #include #include #include diff --git a/src/ModelingData/TKG2d/LProp/LProp_NotDefined.hxx b/src/ModelingData/TKG2d/LProp/LProp_NotDefined.hxx index a72b4f860d..5a836761b6 100644 --- a/src/ModelingData/TKG2d/LProp/LProp_NotDefined.hxx +++ b/src/ModelingData/TKG2d/LProp/LProp_NotDefined.hxx @@ -17,7 +17,6 @@ #ifndef _LProp_NotDefined_HeaderFile #define _LProp_NotDefined_HeaderFile -#include #include #include #include diff --git a/src/ModelingData/TKG3d/GProp/GProp_UndefinedAxis.hxx b/src/ModelingData/TKG3d/GProp/GProp_UndefinedAxis.hxx index d25695c204..e73b5fa5d1 100644 --- a/src/ModelingData/TKG3d/GProp/GProp_UndefinedAxis.hxx +++ b/src/ModelingData/TKG3d/GProp/GProp_UndefinedAxis.hxx @@ -17,7 +17,6 @@ #ifndef _GProp_UndefinedAxis_HeaderFile #define _GProp_UndefinedAxis_HeaderFile -#include #include #include diff --git a/src/ModelingData/TKG3d/Geom/Geom_UndefinedDerivative.hxx b/src/ModelingData/TKG3d/Geom/Geom_UndefinedDerivative.hxx index 0af8c83a37..d63625eb39 100644 --- a/src/ModelingData/TKG3d/Geom/Geom_UndefinedDerivative.hxx +++ b/src/ModelingData/TKG3d/Geom/Geom_UndefinedDerivative.hxx @@ -17,7 +17,6 @@ #ifndef _Geom_UndefinedDerivative_HeaderFile #define _Geom_UndefinedDerivative_HeaderFile -#include #include #include #include diff --git a/src/ModelingData/TKG3d/Geom/Geom_UndefinedValue.hxx b/src/ModelingData/TKG3d/Geom/Geom_UndefinedValue.hxx index 1d3c302d1b..8df61be60c 100644 --- a/src/ModelingData/TKG3d/Geom/Geom_UndefinedValue.hxx +++ b/src/ModelingData/TKG3d/Geom/Geom_UndefinedValue.hxx @@ -17,7 +17,6 @@ #ifndef _Geom_UndefinedValue_HeaderFile #define _Geom_UndefinedValue_HeaderFile -#include #include #include #include diff --git a/src/ModelingData/TKGeomBase/Extrema/Extrema_GCurveLocator.hxx b/src/ModelingData/TKGeomBase/Extrema/Extrema_GCurveLocator.hxx index 3857ba388c..435d4457b2 100644 --- a/src/ModelingData/TKGeomBase/Extrema/Extrema_GCurveLocator.hxx +++ b/src/ModelingData/TKGeomBase/Extrema/Extrema_GCurveLocator.hxx @@ -16,6 +16,7 @@ #define _Extrema_GCurveLocator_HeaderFile #include +#include #include #include diff --git a/src/ModelingData/TKGeomBase/GeomTools/GeomTools_Debug.cxx b/src/ModelingData/TKGeomBase/GeomTools/GeomTools_Debug.cxx index fdcf2183a4..aadbf18069 100644 --- a/src/ModelingData/TKGeomBase/GeomTools/GeomTools_Debug.cxx +++ b/src/ModelingData/TKGeomBase/GeomTools/GeomTools_Debug.cxx @@ -71,7 +71,7 @@ const char* GeomTools_Dump(void* theHandlePtr) } catch (Standard_Failure const& anException) { - return anException.GetMessageString(); + return anException.what(); } } diff --git a/src/Visualization/TKIVtk/IVtkOCC/IVtkOCC_SelectableObject.cxx b/src/Visualization/TKIVtk/IVtkOCC/IVtkOCC_SelectableObject.cxx index 69b8a65f78..7c3e6ace47 100644 --- a/src/Visualization/TKIVtk/IVtkOCC/IVtkOCC_SelectableObject.cxx +++ b/src/Visualization/TKIVtk/IVtkOCC/IVtkOCC_SelectableObject.cxx @@ -101,7 +101,7 @@ void IVtkOCC_SelectableObject::ComputeSelection( catch (const Standard_Failure& anException) { Message::SendFail(TCollection_AsciiString("Error: IVtkOCC_SelectableObject::ComputeSelection(") - + theMode + ") has failed (" + anException.GetMessageString() + ")"); + + theMode + ") has failed (" + anException.what() + ")"); if (theMode == 0) { Bnd_Box aBndBox = BoundingBox(); diff --git a/src/Visualization/TKIVtk/IVtkOCC/IVtkOCC_ShapeMesher.cxx b/src/Visualization/TKIVtk/IVtkOCC/IVtkOCC_ShapeMesher.cxx index c99b7dfd81..d2643926a6 100644 --- a/src/Visualization/TKIVtk/IVtkOCC/IVtkOCC_ShapeMesher.cxx +++ b/src/Visualization/TKIVtk/IVtkOCC/IVtkOCC_ShapeMesher.cxx @@ -93,7 +93,7 @@ void IVtkOCC_ShapeMesher::internalBuild() { Message::SendFail(TCollection_AsciiString( "Error: addWireFrameFaces() wireframe presentation builder has failed (") - + anException.GetMessageString() + ")"); + + anException.what() + ")"); } } diff --git a/src/Visualization/TKService/Aspect/Aspect_AspectFillAreaDefinitionError.hxx b/src/Visualization/TKService/Aspect/Aspect_AspectFillAreaDefinitionError.hxx index d13ece91d0..1675c6ca33 100644 --- a/src/Visualization/TKService/Aspect/Aspect_AspectFillAreaDefinitionError.hxx +++ b/src/Visualization/TKService/Aspect/Aspect_AspectFillAreaDefinitionError.hxx @@ -16,7 +16,6 @@ #ifndef _Aspect_AspectFillAreaDefinitionError_HeaderFile #define _Aspect_AspectFillAreaDefinitionError_HeaderFile -#include #include #include diff --git a/src/Visualization/TKService/Aspect/Aspect_AspectLineDefinitionError.hxx b/src/Visualization/TKService/Aspect/Aspect_AspectLineDefinitionError.hxx index 4450f22e51..0f8dbba9cf 100644 --- a/src/Visualization/TKService/Aspect/Aspect_AspectLineDefinitionError.hxx +++ b/src/Visualization/TKService/Aspect/Aspect_AspectLineDefinitionError.hxx @@ -16,7 +16,6 @@ #ifndef _Aspect_AspectLineDefinitionError_HeaderFile #define _Aspect_AspectLineDefinitionError_HeaderFile -#include #include #include diff --git a/src/Visualization/TKService/Aspect/Aspect_AspectMarkerDefinitionError.hxx b/src/Visualization/TKService/Aspect/Aspect_AspectMarkerDefinitionError.hxx index 98f4cb4aff..67e3c4e739 100644 --- a/src/Visualization/TKService/Aspect/Aspect_AspectMarkerDefinitionError.hxx +++ b/src/Visualization/TKService/Aspect/Aspect_AspectMarkerDefinitionError.hxx @@ -16,7 +16,6 @@ #ifndef _Aspect_AspectMarkerDefinitionError_HeaderFile #define _Aspect_AspectMarkerDefinitionError_HeaderFile -#include #include #include diff --git a/src/Visualization/TKService/Aspect/Aspect_DisplayConnectionDefinitionError.hxx b/src/Visualization/TKService/Aspect/Aspect_DisplayConnectionDefinitionError.hxx index 89e8461302..0509214518 100644 --- a/src/Visualization/TKService/Aspect/Aspect_DisplayConnectionDefinitionError.hxx +++ b/src/Visualization/TKService/Aspect/Aspect_DisplayConnectionDefinitionError.hxx @@ -16,7 +16,6 @@ #ifndef _Aspect_DisplayConnectionDefinitionError_HeaderFile #define _Aspect_DisplayConnectionDefinitionError_HeaderFile -#include #include #include #include diff --git a/src/Visualization/TKService/Aspect/Aspect_GraphicDeviceDefinitionError.hxx b/src/Visualization/TKService/Aspect/Aspect_GraphicDeviceDefinitionError.hxx index 5f94f60d22..898f59bd8e 100644 --- a/src/Visualization/TKService/Aspect/Aspect_GraphicDeviceDefinitionError.hxx +++ b/src/Visualization/TKService/Aspect/Aspect_GraphicDeviceDefinitionError.hxx @@ -16,7 +16,6 @@ #ifndef _Aspect_GraphicDeviceDefinitionError_HeaderFile #define _Aspect_GraphicDeviceDefinitionError_HeaderFile -#include #include #include #include diff --git a/src/Visualization/TKService/Aspect/Aspect_IdentDefinitionError.hxx b/src/Visualization/TKService/Aspect/Aspect_IdentDefinitionError.hxx index 8e40f177a4..3a4043f3ae 100644 --- a/src/Visualization/TKService/Aspect/Aspect_IdentDefinitionError.hxx +++ b/src/Visualization/TKService/Aspect/Aspect_IdentDefinitionError.hxx @@ -16,7 +16,6 @@ #ifndef _Aspect_IdentDefinitionError_HeaderFile #define _Aspect_IdentDefinitionError_HeaderFile -#include #include #include #include diff --git a/src/Visualization/TKService/Aspect/Aspect_WindowDefinitionError.hxx b/src/Visualization/TKService/Aspect/Aspect_WindowDefinitionError.hxx index a1a20a92d5..dd927371a5 100644 --- a/src/Visualization/TKService/Aspect/Aspect_WindowDefinitionError.hxx +++ b/src/Visualization/TKService/Aspect/Aspect_WindowDefinitionError.hxx @@ -16,7 +16,6 @@ #ifndef _Aspect_WindowDefinitionError_HeaderFile #define _Aspect_WindowDefinitionError_HeaderFile -#include #include #include #include diff --git a/src/Visualization/TKService/Aspect/Aspect_WindowError.hxx b/src/Visualization/TKService/Aspect/Aspect_WindowError.hxx index 95e2e648a4..edb8f00959 100644 --- a/src/Visualization/TKService/Aspect/Aspect_WindowError.hxx +++ b/src/Visualization/TKService/Aspect/Aspect_WindowError.hxx @@ -16,7 +16,6 @@ #ifndef _Aspect_WindowError_HeaderFile #define _Aspect_WindowError_HeaderFile -#include #include #include #include diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_GroupDefinitionError.hxx b/src/Visualization/TKService/Graphic3d/Graphic3d_GroupDefinitionError.hxx index 629d8aafd7..6021895119 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_GroupDefinitionError.hxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_GroupDefinitionError.hxx @@ -17,7 +17,6 @@ #ifndef _Graphic3d_GroupDefinitionError_HeaderFile #define _Graphic3d_GroupDefinitionError_HeaderFile -#include #include #include #include diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_MaterialDefinitionError.hxx b/src/Visualization/TKService/Graphic3d/Graphic3d_MaterialDefinitionError.hxx index 2e62abcb09..4b7250c815 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_MaterialDefinitionError.hxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_MaterialDefinitionError.hxx @@ -17,7 +17,6 @@ #ifndef _Graphic3d_MaterialDefinitionError_HeaderFile #define _Graphic3d_MaterialDefinitionError_HeaderFile -#include #include #include #include diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_PriorityDefinitionError.hxx b/src/Visualization/TKService/Graphic3d/Graphic3d_PriorityDefinitionError.hxx index 3215eee4a3..4f8b5d5a1c 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_PriorityDefinitionError.hxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_PriorityDefinitionError.hxx @@ -17,7 +17,6 @@ #ifndef _Graphic3d_PriorityDefinitionError_HeaderFile #define _Graphic3d_PriorityDefinitionError_HeaderFile -#include #include #include #include diff --git a/src/Visualization/TKService/Graphic3d/Graphic3d_StructureDefinitionError.hxx b/src/Visualization/TKService/Graphic3d/Graphic3d_StructureDefinitionError.hxx index cf1df67691..2439a35529 100644 --- a/src/Visualization/TKService/Graphic3d/Graphic3d_StructureDefinitionError.hxx +++ b/src/Visualization/TKService/Graphic3d/Graphic3d_StructureDefinitionError.hxx @@ -17,7 +17,6 @@ #ifndef _Graphic3d_StructureDefinitionError_HeaderFile #define _Graphic3d_StructureDefinitionError_HeaderFile -#include #include #include #include diff --git a/src/Visualization/TKService/WNT/WNT_ClassDefinitionError.hxx b/src/Visualization/TKService/WNT/WNT_ClassDefinitionError.hxx index 66f1eac5cf..8d2ab5cad0 100644 --- a/src/Visualization/TKService/WNT/WNT_ClassDefinitionError.hxx +++ b/src/Visualization/TKService/WNT/WNT_ClassDefinitionError.hxx @@ -17,7 +17,6 @@ #ifndef _WNT_ClassDefinitionError_HeaderFile #define _WNT_ClassDefinitionError_HeaderFile -#include #include #include #include diff --git a/src/Visualization/TKV3d/AIS/AIS_Shape.cxx b/src/Visualization/TKV3d/AIS/AIS_Shape.cxx index 498675311a..557f8f66ce 100644 --- a/src/Visualization/TKV3d/AIS/AIS_Shape.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_Shape.cxx @@ -134,7 +134,7 @@ void AIS_Shape::Compute(const occ::handle&, Message::SendFail( TCollection_AsciiString( "Error: AIS_Shape::Compute() wireframe presentation builder has failed (") - + anException.GetMessageString() + ")"); + + anException.what() + ")"); } break; } @@ -170,7 +170,7 @@ void AIS_Shape::Compute(const occ::handle&, Message::SendFail( TCollection_AsciiString( "Error: AIS_Shape::Compute() shaded presentation builder has failed (") - + anException.GetMessageString() + ")"); + + anException.what() + ")"); StdPrs_WFShape::Add(thePrs, myshape, myDrawer); } } @@ -273,7 +273,7 @@ void AIS_Shape::computeHlrPresentation(const occ::handle& th { Message::SendFail( TCollection_AsciiString("Error: AIS_Shape::Compute() HLR Algorithm has failed (") - + anException.GetMessageString() + ")"); + + anException.what() + ")"); StdPrs_WFShape::Add(thePrs, theShape, theDrawer); } } @@ -314,7 +314,7 @@ void AIS_Shape::ComputeSelection(const occ::handle& aSelect catch (Standard_Failure const& anException) { Message::SendFail(TCollection_AsciiString("Error: AIS_Shape::ComputeSelection(") + aMode - + ") has failed (" + anException.GetMessageString() + ")"); + + ") has failed (" + anException.what() + ")"); if (aMode == 0) { aSelection->Clear(); diff --git a/src/Visualization/TKV3d/AIS/AIS_ViewController.cxx b/src/Visualization/TKV3d/AIS/AIS_ViewController.cxx index 59e627af02..de3e05979c 100644 --- a/src/Visualization/TKV3d/AIS/AIS_ViewController.cxx +++ b/src/Visualization/TKV3d/AIS/AIS_ViewController.cxx @@ -2977,7 +2977,7 @@ void AIS_ViewController::handleSelectionPoly(const occ::handleName() + ", " + theEx.GetMessageString()); + + theEx.ExceptionType() + ", " + theEx.what()); myRubberBand->ClearPoints(); } if (!theView->Viewer()->ZLayerSettings(myRubberBand->ZLayer()).IsImmediate()) diff --git a/src/Visualization/TKV3d/Prs3d/Prs3d_InvalidAngle.hxx b/src/Visualization/TKV3d/Prs3d/Prs3d_InvalidAngle.hxx index 1e78893663..177e1494c3 100644 --- a/src/Visualization/TKV3d/Prs3d/Prs3d_InvalidAngle.hxx +++ b/src/Visualization/TKV3d/Prs3d/Prs3d_InvalidAngle.hxx @@ -17,7 +17,6 @@ #ifndef _Prs3d_InvalidAngle_HeaderFile #define _Prs3d_InvalidAngle_HeaderFile -#include #include #include #include diff --git a/src/Visualization/TKV3d/SelectMgr/SelectMgr_BVHThreadPool.cxx b/src/Visualization/TKV3d/SelectMgr/SelectMgr_BVHThreadPool.cxx index 623be0ecc4..55d3ca5fc1 100644 --- a/src/Visualization/TKV3d/SelectMgr/SelectMgr_BVHThreadPool.cxx +++ b/src/Visualization/TKV3d/SelectMgr/SelectMgr_BVHThreadPool.cxx @@ -142,8 +142,8 @@ void SelectMgr_BVHThreadPool::BVHThread::performThread() } catch (Standard_Failure const& aFailure) { - TCollection_AsciiString aMsg = TCollection_AsciiString(aFailure.DynamicType()->Name()) - + ": " + aFailure.GetMessageString(); + TCollection_AsciiString aMsg = + TCollection_AsciiString(aFailure.ExceptionType()) + ": " + aFailure.what(); Message::DefaultMessenger()->SendFail(aMsg); } catch (std::exception& anStdException) diff --git a/src/Visualization/TKV3d/V3d/V3d_BadValue.hxx b/src/Visualization/TKV3d/V3d/V3d_BadValue.hxx index 1be6686833..22ad49dd8c 100644 --- a/src/Visualization/TKV3d/V3d/V3d_BadValue.hxx +++ b/src/Visualization/TKV3d/V3d/V3d_BadValue.hxx @@ -17,7 +17,6 @@ #ifndef _V3d_BadValue_HeaderFile #define _V3d_BadValue_HeaderFile -#include #include #include #include diff --git a/src/Visualization/TKV3d/V3d/V3d_UnMapped.hxx b/src/Visualization/TKV3d/V3d/V3d_UnMapped.hxx index 6f74d8662f..16c5abae8c 100644 --- a/src/Visualization/TKV3d/V3d/V3d_UnMapped.hxx +++ b/src/Visualization/TKV3d/V3d/V3d_UnMapped.hxx @@ -17,7 +17,6 @@ #ifndef _V3d_UnMapped_HeaderFile #define _V3d_UnMapped_HeaderFile -#include #include #include #include