From ff565cd175fa5c4c1563496572aa27b0e9484acd Mon Sep 17 00:00:00 2001 From: Binh-Minh Ribler Date: Tue, 18 Mar 2014 14:31:18 -0500 Subject: [svn-r24830] Purpose: HDFFV-8623 Description: Applied patch from user Jason Newton. JIRA issue HDFFV-8623, patch 9, improve c++ compatibility with exceptions. All additions of "throw()" are included. Exception::what() is not added because it is not necessary. It was suggested for the name, which follows stdlib. Platforms tested: Linux/ppc64 (ostrich) Linux/32 2.6 (jam) Linux/64 2.6 (koala)/PGI compilers --- c++/src/H5Exception.cpp | 22 +++++++++++----------- c++/src/H5Exception.h | 22 +++++++++++----------- c++/test/h5cpputil.cpp | 4 ++-- c++/test/h5cpputil.h | 4 ++-- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/c++/src/H5Exception.cpp b/c++/src/H5Exception.cpp index 8513372..ddc1d00 100644 --- a/c++/src/H5Exception.cpp +++ b/c++/src/H5Exception.cpp @@ -312,7 +312,7 @@ void Exception::printError( FILE* stream ) const ///\brief Noop destructor // Programmer Binh-Minh Ribler - 2000 //-------------------------------------------------------------------------- -Exception::~Exception() {} +Exception::~Exception() throw() {} //-------------------------------------------------------------------------- // Subclass: FileIException @@ -335,7 +335,7 @@ FileIException::FileIException(const H5std_string& func_name, const H5std_string // Function: FileIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -FileIException::~FileIException() {} +FileIException::~FileIException() throw() {} //-------------------------------------------------------------------------- // Subclass: GroupIException @@ -358,7 +358,7 @@ GroupIException::GroupIException(const H5std_string& func_name, const H5std_stri // Function: GroupIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -GroupIException::~GroupIException() {} +GroupIException::~GroupIException() throw() {} //-------------------------------------------------------------------------- // Subclass: DataSpaceIException @@ -381,7 +381,7 @@ DataSpaceIException::DataSpaceIException(const H5std_string& func_name, const H5 // Function: DataSpaceIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -DataSpaceIException::~DataSpaceIException() {} +DataSpaceIException::~DataSpaceIException() throw() {} //-------------------------------------------------------------------------- // Subclass: DataTypeIException @@ -404,7 +404,7 @@ DataTypeIException::DataTypeIException(const H5std_string& func_name, const H5st // Function: DataTypeIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -DataTypeIException::~DataTypeIException() {} +DataTypeIException::~DataTypeIException() throw() {} //-------------------------------------------------------------------------- // Subclass: PropListIException @@ -427,7 +427,7 @@ PropListIException::PropListIException(const H5std_string& func_name, const H5st // Function: PropListIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -PropListIException::~PropListIException() {} +PropListIException::~PropListIException() throw() {} //-------------------------------------------------------------------------- // Subclass: DataSetIException @@ -450,7 +450,7 @@ DataSetIException::DataSetIException(const H5std_string& func_name, const H5std_ // Function: DataSetIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -DataSetIException::~DataSetIException() {} +DataSetIException::~DataSetIException() throw() {} //-------------------------------------------------------------------------- // Subclass: AttributeIException @@ -473,7 +473,7 @@ AttributeIException::AttributeIException(const H5std_string& func_name, const H5 // Function: AttributeIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -AttributeIException::~AttributeIException() {} +AttributeIException::~AttributeIException() throw() {} //-------------------------------------------------------------------------- // Subclass: ReferenceException @@ -496,7 +496,7 @@ ReferenceException::ReferenceException(const H5std_string& func_name, const H5st // Function: ReferenceException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -ReferenceException::~ReferenceException() {} +ReferenceException::~ReferenceException() throw() {} //-------------------------------------------------------------------------- // Subclass: LibraryIException @@ -519,7 +519,7 @@ LibraryIException::LibraryIException(const H5std_string& func_name, const H5std_ // Function: LibraryIException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -LibraryIException::~LibraryIException() {} +LibraryIException::~LibraryIException() throw() {} //-------------------------------------------------------------------------- // Subclass: IdComponentException @@ -542,7 +542,7 @@ IdComponentException::IdComponentException(const H5std_string& func_name, const // Function: IdComponentException destructor ///\brief Noop destructor. //-------------------------------------------------------------------------- -IdComponentException::~IdComponentException() {} +IdComponentException::~IdComponentException() throw() {} #ifndef H5_NO_NAMESPACE } // end namespace #endif diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h index 30fe537..d747af3 100644 --- a/c++/src/H5Exception.h +++ b/c++/src/H5Exception.h @@ -81,7 +81,7 @@ class H5_DLLCPP Exception { Exception( const Exception& orig); // virtual Destructor - virtual ~Exception(); + virtual ~Exception() throw(); protected: // Default value for detail_message @@ -96,70 +96,70 @@ class H5_DLLCPP FileIException : public Exception { public: FileIException( const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); FileIException(); - virtual ~FileIException(); + virtual ~FileIException() throw(); }; class H5_DLLCPP GroupIException : public Exception { public: GroupIException( const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); GroupIException(); - virtual ~GroupIException(); + virtual ~GroupIException() throw(); }; class H5_DLLCPP DataSpaceIException : public Exception { public: DataSpaceIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); DataSpaceIException(); - virtual ~DataSpaceIException(); + virtual ~DataSpaceIException() throw(); }; class H5_DLLCPP DataTypeIException : public Exception { public: DataTypeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); DataTypeIException(); - virtual ~DataTypeIException(); + virtual ~DataTypeIException() throw(); }; class H5_DLLCPP PropListIException : public Exception { public: PropListIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); PropListIException(); - virtual ~PropListIException(); + virtual ~PropListIException() throw(); }; class H5_DLLCPP DataSetIException : public Exception { public: DataSetIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); DataSetIException(); - virtual ~DataSetIException(); + virtual ~DataSetIException() throw(); }; class H5_DLLCPP AttributeIException : public Exception { public: AttributeIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); AttributeIException(); - virtual ~AttributeIException(); + virtual ~AttributeIException() throw(); }; class H5_DLLCPP ReferenceException : public Exception { public: ReferenceException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); ReferenceException(); - virtual ~ReferenceException(); + virtual ~ReferenceException() throw(); }; class H5_DLLCPP LibraryIException : public Exception { public: LibraryIException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); LibraryIException(); - virtual ~LibraryIException(); + virtual ~LibraryIException() throw(); }; class H5_DLLCPP IdComponentException : public Exception { public: IdComponentException(const H5std_string& func_name, const H5std_string& message = DEFAULT_MSG); IdComponentException(); - virtual ~IdComponentException(); + virtual ~IdComponentException() throw(); }; #ifndef H5_NO_NAMESPACE diff --git a/c++/test/h5cpputil.cpp b/c++/test/h5cpputil.cpp index cd85b6e..40e81cc 100644 --- a/c++/test/h5cpputil.cpp +++ b/c++/test/h5cpputil.cpp @@ -220,7 +220,7 @@ InvalidActionException::InvalidActionException(const H5std_string func_name, con //-------------------------------------------------------------------------- // Function: InvalidActionException destructor //-------------------------------------------------------------------------- -InvalidActionException::~InvalidActionException() {} +InvalidActionException::~InvalidActionException() throw() {} //-------------------------------------------------------------------------- // Function: TestFailedException default constructor @@ -242,5 +242,5 @@ TestFailedException::TestFailedException(const H5std_string func_name, const H5s //-------------------------------------------------------------------------- // Function: TestFailedException destructor //-------------------------------------------------------------------------- -TestFailedException::~TestFailedException() {} +TestFailedException::~TestFailedException() throw() {} diff --git a/c++/test/h5cpputil.h b/c++/test/h5cpputil.h index e6aba79..b107045 100644 --- a/c++/test/h5cpputil.h +++ b/c++/test/h5cpputil.h @@ -49,14 +49,14 @@ class InvalidActionException : public Exception { public: InvalidActionException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG); InvalidActionException(); - virtual ~InvalidActionException(); + virtual ~InvalidActionException() throw(); }; class TestFailedException : public Exception { public: TestFailedException(const H5std_string func_name, const H5std_string message = DEFAULT_MSG); TestFailedException(); - virtual ~TestFailedException(); + virtual ~TestFailedException() throw(); }; // Overloaded/Template functions to verify values and display proper info -- cgit v0.12