From 20c452fe5c0955a81ae1222d846632f1525f08f4 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Wed, 10 Mar 2021 12:51:45 -0500 Subject: Removed checks/workarounds for pre-C++89 compatibility (#449) After 30+ years, just assume that the following exist: - extension-less includes - namespaces - std:: - static_cast - bool --- CMakeLists.txt | 3 -- c++/examples/chunks.cpp | 4 --- c++/examples/compound.cpp | 4 --- c++/examples/create.cpp | 4 --- c++/examples/extend_ds.cpp | 4 --- c++/examples/h5group.cpp | 4 --- c++/examples/readdata.cpp | 4 --- c++/examples/testh5c++.sh.in | 36 ++++------------------- c++/examples/writedata.cpp | 4 --- c++/src/H5Attribute.cpp | 4 --- c++/src/H5DataSet.cpp | 4 --- c++/src/H5DataSpace.cpp | 4 --- c++/src/H5DataType.cpp | 4 --- c++/src/H5Exception.h | 4 --- c++/src/H5FaccProp.cpp | 4 --- c++/src/H5File.cpp | 4 --- c++/src/H5Group.cpp | 4 --- c++/src/H5Include.h | 13 --------- c++/src/H5PropList.cpp | 4 --- c++/test/dsets.cpp | 4 --- c++/test/h5cpputil.cpp | 4 --- c++/test/tarray.cpp | 4 --- c++/test/tattr.cpp | 4 --- c++/test/tcompound.cpp | 4 --- c++/test/tdspl.cpp | 4 --- c++/test/testhdf5.cpp | 4 --- c++/test/tfile.cpp | 4 --- c++/test/tfilter.cpp | 4 --- c++/test/th5s.cpp | 4 --- c++/test/titerate.cpp | 4 --- c++/test/tlinks.cpp | 4 --- c++/test/tobject.cpp | 4 --- c++/test/trefer.cpp | 4 --- c++/test/ttypes.cpp | 4 --- c++/test/tvlstr.cpp | 4 --- config/cmake_ext_mod/HDFCXXTests.cpp | 56 ------------------------------------ config/cmake_ext_mod/HDFUseCXX.cmake | 5 ---- 37 files changed, 6 insertions(+), 235 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 04e34f1..9809339 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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++") diff --git a/c++/examples/chunks.cpp b/c++/examples/chunks.cpp index 365a7da..3717fcb 100644 --- a/c++/examples/chunks.cpp +++ b/c++/examples/chunks.cpp @@ -16,11 +16,7 @@ * We will read from the file created by extend.cpp */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cout; using std::endl; diff --git a/c++/examples/compound.cpp b/c++/examples/compound.cpp index 31a572a..8975845 100644 --- a/c++/examples/compound.cpp +++ b/c++/examples/compound.cpp @@ -17,11 +17,7 @@ * and read back fields' subsets. */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cout; using std::endl; diff --git a/c++/examples/create.cpp b/c++/examples/create.cpp index ef2de36..e55230f 100644 --- a/c++/examples/create.cpp +++ b/c++/examples/create.cpp @@ -15,11 +15,7 @@ * This example writes a dataset to a new HDF5 file. */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include #include "H5Cpp.h" diff --git a/c++/examples/extend_ds.cpp b/c++/examples/extend_ds.cpp index e69c1c0..24f5f3e 100644 --- a/c++/examples/extend_ds.cpp +++ b/c++/examples/extend_ds.cpp @@ -18,11 +18,7 @@ * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include using std::cout; diff --git a/c++/examples/h5group.cpp b/c++/examples/h5group.cpp index 793ff8f..f9ec176 100644 --- a/c++/examples/h5group.cpp +++ b/c++/examples/h5group.cpp @@ -20,11 +20,7 @@ * the C version is used in this example. */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cout; using std::endl; diff --git a/c++/examples/readdata.cpp b/c++/examples/readdata.cpp index 7441420..e247a8e 100644 --- a/c++/examples/readdata.cpp +++ b/c++/examples/readdata.cpp @@ -17,11 +17,7 @@ // information about the dataset in the SDS.h5 file is obtained. // -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cout; using std::endl; diff --git a/c++/examples/testh5c++.sh.in b/c++/examples/testh5c++.sh.in index 46fe5eb..44dc9e7 100644 --- a/c++/examples/testh5c++.sh.in +++ b/c++/examples/testh5c++.sh.in @@ -67,11 +67,7 @@ temp_FILES="a.out $applib" cat > $appmain < -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include "H5Cpp.h" @@ -95,19 +91,11 @@ EOF # generate prog1 cat > $prog1 < -#else - #include -#endif +#include #include -#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; @@ -117,19 +105,11 @@ EOF # generate prog2 cat > $prog2 < -#else - #include -#endif +#include #include -#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; @@ -142,11 +122,7 @@ EOF cat > $hdf5main < -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include "H5Cpp.h" diff --git a/c++/examples/writedata.cpp b/c++/examples/writedata.cpp index ddd3460..f2b715a 100644 --- a/c++/examples/writedata.cpp +++ b/c++/examples/writedata.cpp @@ -20,11 +20,7 @@ * file is closed. Program reopens the file and reads and displays the result. */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cout; using std::endl; diff --git a/c++/src/H5Attribute.cpp b/c++/src/H5Attribute.cpp index 81e656f..d893fec 100644 --- a/c++/src/H5Attribute.cpp +++ b/c++/src/H5Attribute.cpp @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include #include "H5private.h" // for HDfree diff --git a/c++/src/H5DataSet.cpp b/c++/src/H5DataSet.cpp index 9027d79..5dc44b8 100644 --- a/c++/src/H5DataSet.cpp +++ b/c++/src/H5DataSet.cpp @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include #include "H5private.h" // for HDfree diff --git a/c++/src/H5DataSpace.cpp b/c++/src/H5DataSpace.cpp index 9c997d1..0485530 100644 --- a/c++/src/H5DataSpace.cpp +++ b/c++/src/H5DataSpace.cpp @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include #include "H5Include.h" diff --git a/c++/src/H5DataType.cpp b/c++/src/H5DataType.cpp index a943a55..1689912 100644 --- a/c++/src/H5DataType.cpp +++ b/c++/src/H5DataType.cpp @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include #include "H5Include.h" diff --git a/c++/src/H5Exception.h b/c++/src/H5Exception.h index 566c818..18974fc 100644 --- a/c++/src/H5Exception.h +++ b/c++/src/H5Exception.h @@ -18,11 +18,7 @@ #include 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. diff --git a/c++/src/H5FaccProp.cpp b/c++/src/H5FaccProp.cpp index c8c2b24..8166d05 100644 --- a/c++/src/H5FaccProp.cpp +++ b/c++/src/H5FaccProp.cpp @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include using std::cerr; diff --git a/c++/src/H5File.cpp b/c++/src/H5File.cpp index cdc9b45..bbdcd6b 100644 --- a/c++/src/H5File.cpp +++ b/c++/src/H5File.cpp @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include #include "H5Include.h" diff --git a/c++/src/H5Group.cpp b/c++/src/H5Group.cpp index 392f31a..2fc6899 100644 --- a/c++/src/H5Group.cpp +++ b/c++/src/H5Group.cpp @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include #include "H5Include.h" diff --git a/c++/src/H5Include.h b/c++/src/H5Include.h index 1f03150..e662d90 100644 --- a/c++/src/H5Include.h +++ b/c++/src/H5Include.h @@ -14,19 +14,6 @@ #include -// 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. diff --git a/c++/src/H5PropList.cpp b/c++/src/H5PropList.cpp index 3780220..c4eda5e 100644 --- a/c++/src/H5PropList.cpp +++ b/c++/src/H5PropList.cpp @@ -11,11 +11,7 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include diff --git a/c++/test/dsets.cpp b/c++/test/dsets.cpp index 03e4927..93c266f 100644 --- a/c++/test/dsets.cpp +++ b/c++/test/dsets.cpp @@ -23,11 +23,7 @@ ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/h5cpputil.cpp b/c++/test/h5cpputil.cpp index e38b34a..d42fc8c 100644 --- a/c++/test/h5cpputil.cpp +++ b/c++/test/h5cpputil.cpp @@ -19,11 +19,7 @@ ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp index ab66174..7525c5f 100644 --- a/c++/test/tarray.cpp +++ b/c++/test/tarray.cpp @@ -16,11 +16,7 @@ tarray.cpp - HDF5 C++ testing the array datatype functionality ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp index 047d360..e659e8e 100644 --- a/c++/test/tattr.cpp +++ b/c++/test/tattr.cpp @@ -17,11 +17,7 @@ C attribute interface (H5A) ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/tcompound.cpp b/c++/test/tcompound.cpp index 641002e..4c5e3e0 100644 --- a/c++/test/tcompound.cpp +++ b/c++/test/tcompound.cpp @@ -16,11 +16,7 @@ tcompound.cpp - HDF5 C++ testing the compound data type functionality ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/tdspl.cpp b/c++/test/tdspl.cpp index fc73a6a..257233e 100644 --- a/c++/test/tdspl.cpp +++ b/c++/test/tdspl.cpp @@ -17,11 +17,7 @@ list functionality ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/testhdf5.cpp b/c++/test/testhdf5.cpp index da5e2a4..71428ce 100644 --- a/c++/test/testhdf5.cpp +++ b/c++/test/testhdf5.cpp @@ -38,11 +38,7 @@ GetTestNumErrs() -- Retrieve the number of testing errors ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/tfile.cpp b/c++/test/tfile.cpp index b082f0a..5e4e91b 100644 --- a/c++/test/tfile.cpp +++ b/c++/test/tfile.cpp @@ -20,11 +20,7 @@ h5_fileaccess() -- in h5test.c, returns a file access template ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/tfilter.cpp b/c++/test/tfilter.cpp index 2df88b2..e89838c 100644 --- a/c++/test/tfilter.cpp +++ b/c++/test/tfilter.cpp @@ -16,11 +16,7 @@ tfilter.cpp - HDF5 C++ testing various filters and their combination. ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/th5s.cpp b/c++/test/th5s.cpp index e57ac04..a005170 100644 --- a/c++/test/th5s.cpp +++ b/c++/test/th5s.cpp @@ -19,11 +19,7 @@ EXTERNAL ROUTINES/VARIABLES: ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/titerate.cpp b/c++/test/titerate.cpp index 1fb2f57..17620ca 100644 --- a/c++/test/titerate.cpp +++ b/c++/test/titerate.cpp @@ -16,11 +16,7 @@ titerate.cpp - HDF5 C++ testing iterate related functionality ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/tlinks.cpp b/c++/test/tlinks.cpp index 231bff2..22e69da 100644 --- a/c++/test/tlinks.cpp +++ b/c++/test/tlinks.cpp @@ -16,11 +16,7 @@ C link interface (H5L) ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/tobject.cpp b/c++/test/tobject.cpp index 87abd43..5892f39 100644 --- a/c++/test/tobject.cpp +++ b/c++/test/tobject.cpp @@ -16,11 +16,7 @@ tobject.cpp - HDF5 C++ testing object related functionality ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif #include #include "H5Cpp.h" // C++ API header file diff --git a/c++/test/trefer.cpp b/c++/test/trefer.cpp index 5ec04cd..939b0ee 100644 --- a/c++/test/trefer.cpp +++ b/c++/test/trefer.cpp @@ -17,11 +17,7 @@ Reference interface (H5R) ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/ttypes.cpp b/c++/test/ttypes.cpp index cf32b2b..5fc82a5 100644 --- a/c++/test/ttypes.cpp +++ b/c++/test/ttypes.cpp @@ -16,11 +16,7 @@ ttypes.cpp - HDF5 C++ testing the general datatype functionality ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/c++/test/tvlstr.cpp b/c++/test/tvlstr.cpp index 5d671d1..780d1b9 100644 --- a/c++/test/tvlstr.cpp +++ b/c++/test/tvlstr.cpp @@ -18,11 +18,7 @@ EXTERNAL ROUTINES/VARIABLES: ***************************************************************************/ -#ifdef OLD_HEADER_FILENAME -#include -#else #include -#endif using std::cerr; using std::endl; diff --git a/config/cmake_ext_mod/HDFCXXTests.cpp b/config/cmake_ext_mod/HDFCXXTests.cpp index f05151b..08ccb34 100644 --- a/config/cmake_ext_mod/HDFCXXTests.cpp +++ b/config/cmake_ext_mod/HDFCXXTests.cpp @@ -10,62 +10,6 @@ * help@hdfgroup.org. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ -#ifdef OLD_HEADER_FILENAME - -#include - -int main(void) { return 0; } - -#endif - - -#ifdef HDF_NO_NAMESPACE - -namespace HDF { -int fnord; -} - -int main(void) { - using namespace HDF; - fnord = 37; - return 0; -} - -#endif - -#ifdef HDF_NO_STD - -#include - -using namespace std; - -int main(void) { - string myString("testing namespace std"); - return 0; -} - -#endif - -#ifdef BOOL_NOTDEFINED -int main(void) { - bool flag; - return 0; -} - -#endif - -#ifdef NO_STATIC_CAST - -int main(void) { - float test_float; - int test_int; - test_float = 37.0; - test_int = static_cast (test_float); - return 0; -} - -#endif - #ifdef CXX_HAVE_OFFSETOF #include diff --git a/config/cmake_ext_mod/HDFUseCXX.cmake b/config/cmake_ext_mod/HDFUseCXX.cmake index 28e7f8a..580c409 100644 --- a/config/cmake_ext_mod/HDFUseCXX.cmake +++ b/config/cmake_ext_mod/HDFUseCXX.cmake @@ -103,11 +103,6 @@ endmacro () #----------------------------------------------------------------------------- if (CMAKE_CXX_COMPILER_LOADED) foreach (cxx_test - OLD_HEADER_FILENAME - HDF_NO_NAMESPACE - HDF_NO_STD - BOOL_NOTDEFINED - NO_STATIC_CAST CXX_HAVE_OFFSETOF ) HDF_CXX_FUNCTION_TEST (${cxx_test}) -- cgit v0.12