Skip to content

Commit

Permalink
Removed checks/workarounds for pre-C++89 compatibility
Browse files Browse the repository at this point in the history
After 30+ years, just assume that the following exist:
- extension-less includes
- namespaces
- std::
- static_cast
- bool
  • Loading branch information
seanm committed Mar 8, 2021
1 parent 5f376cc commit 01b451b
Show file tree
Hide file tree
Showing 37 changed files with 6 additions and 235 deletions.
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1107,9 +1107,6 @@ if (EXISTS "${HDF5_SOURCE_DIR}/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/c++")
include (${HDF_RESOURCES_EXT_DIR}/HDFUseCXX.cmake)
include (${HDF_RESOURCES_DIR}/HDFCXXCompilerFlags.cmake)

if (CMAKE_NO_STD_NAMESPACE)
set (H5_NO_STD 1)
endif ()
add_subdirectory (c++)
if (HDF5_BUILD_HL_LIB)
if (EXISTS "${HDF5_SOURCE_DIR}/hl/c++" AND IS_DIRECTORY "${HDF5_SOURCE_DIR}/hl/c++")
Expand Down
4 changes: 0 additions & 4 deletions c++/examples/chunks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@
* We will read from the file created by extend.cpp
*/

#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
using std::cout;
using std::endl;

Expand Down
4 changes: 0 additions & 4 deletions c++/examples/compound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@
* and read back fields' subsets.
*/

#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
using std::cout;
using std::endl;

Expand Down
4 changes: 0 additions & 4 deletions c++/examples/create.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,7 @@
* This example writes a dataset to a new HDF5 file.
*/

#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif

#include <string>
#include "H5Cpp.h"
Expand Down
4 changes: 0 additions & 4 deletions c++/examples/extend_ds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@
*
*/

#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>

using std::cout;
Expand Down
4 changes: 0 additions & 4 deletions c++/examples/h5group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
* the C version is used in this example.
*/

#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
using std::cout;
using std::endl;

Expand Down
4 changes: 0 additions & 4 deletions c++/examples/readdata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@
// information about the dataset in the SDS.h5 file is obtained.
//

#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
using std::cout;
using std::endl;

Expand Down
36 changes: 6 additions & 30 deletions c++/examples/testh5c++.sh.in
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,7 @@ temp_FILES="a.out $applib"
cat > $appmain <<EOF
#include <string>
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include "H5Cpp.h"
Expand All @@ -95,19 +91,11 @@ EOF

# generate prog1
cat > $prog1 <<EOF
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <iostream>
#include <string>
#ifndef H5_NO_NAMESPACE
#ifndef H5_NO_STD
using std::cout;
using std::endl;
#endif // H5_NO_STD
#endif
using std::cout;
using std::endl;
int sub1(void)
{
cout << "in sub1" << endl;
Expand All @@ -117,19 +105,11 @@ EOF

# generate prog2
cat > $prog2 <<EOF
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <iostream>
#include <string>
#ifndef H5_NO_NAMESPACE
#ifndef H5_NO_STD
using std::cout;
using std::endl;
#endif // H5_NO_STD
#endif
using std::cout;
using std::endl;
int sub2(void)
{
cout << "in sub2" << endl;
Expand All @@ -142,11 +122,7 @@ EOF
cat > $hdf5main <<EOF
#include <string>
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include "H5Cpp.h"
Expand Down
4 changes: 0 additions & 4 deletions c++/examples/writedata.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
* file is closed. Program reopens the file and reads and displays the result.
*/

#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
using std::cout;
using std::endl;

Expand Down
4 changes: 0 additions & 4 deletions c++/src/H5Attribute.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>

#include "H5private.h" // for HDfree
Expand Down
4 changes: 0 additions & 4 deletions c++/src/H5DataSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>

#include "H5private.h" // for HDfree
Expand Down
4 changes: 0 additions & 4 deletions c++/src/H5DataSpace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>

#include "H5Include.h"
Expand Down
4 changes: 0 additions & 4 deletions c++/src/H5DataType.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>

#include "H5Include.h"
Expand Down
4 changes: 0 additions & 4 deletions c++/src/H5Exception.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@
#include <string>

namespace H5 {
#ifdef H5_NO_STD
#define H5std_string ::string
#else
#define H5std_string std::string
#endif

/*! \class Exception
\brief Exception provides wrappers of HDF5 error handling functions.
Expand Down
4 changes: 0 additions & 4 deletions c++/src/H5FaccProp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>

using std::cerr;
Expand Down
4 changes: 0 additions & 4 deletions c++/src/H5File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>

#include "H5Include.h"
Expand Down
4 changes: 0 additions & 4 deletions c++/src/H5Group.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>

#include "H5Include.h"
Expand Down
13 changes: 0 additions & 13 deletions c++/src/H5Include.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,6 @@

#include <hdf5.h>

// Define bool type for platforms that don't support bool yet
#ifdef BOOL_NOTDEFINED
#ifdef false
#undef false
#endif
#ifdef true
#undef true
#endif
typedef int bool;
const bool false = 0;
const bool true = 1;
#endif

// These are defined in H5Opkg.h, which should not be included in the C++ API,
// so re-define them here for now.

Expand Down
4 changes: 0 additions & 4 deletions c++/src/H5PropList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */

#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif

#include <string>

Expand Down
4 changes: 0 additions & 4 deletions c++/test/dsets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@
***************************************************************************/

#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
using std::cerr;
using std::endl;

Expand Down
4 changes: 0 additions & 4 deletions c++/test/h5cpputil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,7 @@
***************************************************************************/

#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
using std::cerr;
using std::endl;

Expand Down
4 changes: 0 additions & 4 deletions c++/test/tarray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@
tarray.cpp - HDF5 C++ testing the array datatype functionality
***************************************************************************/
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
using std::cerr;
using std::endl;

Expand Down
4 changes: 0 additions & 4 deletions c++/test/tattr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@
C attribute interface (H5A)
***************************************************************************/
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
using std::cerr;
using std::endl;

Expand Down
4 changes: 0 additions & 4 deletions c++/test/tcompound.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@
tcompound.cpp - HDF5 C++ testing the compound data type functionality
***************************************************************************/
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
using std::cerr;
using std::endl;

Expand Down
4 changes: 0 additions & 4 deletions c++/test/tdspl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,7 @@
list functionality
***************************************************************************/
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
using std::cerr;
using std::endl;

Expand Down
4 changes: 0 additions & 4 deletions c++/test/testhdf5.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,7 @@
GetTestNumErrs() -- Retrieve the number of testing errors
***************************************************************************/
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
using std::cerr;
using std::endl;

Expand Down
4 changes: 0 additions & 4 deletions c++/test/tfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,7 @@
h5_fileaccess() -- in h5test.c, returns a file access template
***************************************************************************/
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
using std::cerr;
using std::endl;

Expand Down
4 changes: 0 additions & 4 deletions c++/test/tfilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@
tfilter.cpp - HDF5 C++ testing various filters and their combination.
***************************************************************************/
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
using std::cerr;
using std::endl;

Expand Down
Loading

0 comments on commit 01b451b

Please sign in to comment.