[svn-r23427] Purpose: Fix bug HDFFV-8067

Description:
  + The C++ test failed with the new PGI compilers versions 12.4 and 12.5
  + An exception thrown by an internal function, which was called by
    a constructor, was not propagating to the test program during the stack
    unwinding, so it couldn't be caught by the test and the program terminated.
  + Various trials and errors indicated that the problem is where an STD string
    converted to a char* being passed to the internal function, but confirmation
    has not been found yet.  It could be a compiler bug.
Solution:
  + Added a try/catch in the constructor around the internal function and
    re-throw the exception when it is caught.  This is a workaround.
  + Unrelated minor fixes: removed unused variables and MESSAGE's; commented
    out tvlstr.cpp/test_read_vl_string_attribute because it may be redundant,
    and commented out H5Tpkg.h inclusion because TEST_ALIGNMENT is not added
    yet and probably not necessary in the C++ API.
Platforms tested:
    Linux/32 2.6 (jam) with PGI compilers
    Linux/32 2.6 (jam) with GNU compilers
    Linux/64 2.6 (koala)
This commit is contained in:
Binh-Minh Ribler
2013-03-22 12:56:05 -05:00
parent 030a17ca60
commit c8018386da
11 changed files with 31 additions and 27 deletions

View File

@@ -77,11 +77,18 @@ H5File::H5File() : H5Location(), id(0) {}
/// please refer to the \b Special \b case section in the C layer
/// Reference Manual at:
/// http://www.hdfgroup.org/HDF5/doc/RM/RM_H5F.html#File-Create
// Notes With a PGI compiler (~2012-2013), the exception thrown by p_get_file
// could not be caught in the applications. Added try block here
// to catch then re-throw it. -BMR 2013/03/21
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(0)
{
p_get_file(name, flags, create_plist, access_plist);
try {
p_get_file(name, flags, create_plist, access_plist);
} catch (FileIException open_file) {
throw open_file;
}
}
//--------------------------------------------------------------------------
@@ -95,11 +102,18 @@ H5File::H5File( const char* name, unsigned int flags, const FileCreatPropList& c
/// FileCreatPropList::DEFAULT
///\param access_plist - IN: File access property list. Default to
/// FileCreatPropList::DEFAULT
// Notes With a PGI compiler (~2012-2013), the exception thrown by p_get_file
// could not be caught in the applications. Added try block here
// to catch then re-throw it. -BMR 2013/03/21
// Programmer Binh-Minh Ribler - 2000
//--------------------------------------------------------------------------
H5File::H5File( const H5std_string& name, unsigned int flags, const FileCreatPropList& create_plist, const FileAccPropList& access_plist ) : H5Location(0)
{
p_get_file(name.c_str(), flags, create_plist, access_plist);
try {
p_get_file(name.c_str(), flags, create_plist, access_plist);
} catch (FileIException open_file) {
throw open_file;
}
}
//--------------------------------------------------------------------------