From 01b451b97cb1dc0e8b8bbb57c77a88bb83a57637 Mon Sep 17 00:00:00 2001 From: Sean McBride Date: Mon, 8 Mar 2021 12:14:34 -0500 Subject: [PATCH] Removed checks/workarounds for pre-C++89 compatibility 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 04e34f187f2..98093398daf 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 365a7da507a..3717fcba62c 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 31a572af74f..89758454d87 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 ef2de36919e..e55230f205f 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 e69c1c0b473..24f5f3eac32 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 793ff8f2423..f9ec176f24c 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 7441420b1b7..e247a8eaab8 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 46fe5ebaf0d..44dc9e7d77f 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 ddd3460ff71..f2b715ac20e 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 81e656f74b5..d893fec660b 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 9027d79ca1f..5dc44b869d2 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 9c997d1ea5f..0485530d785 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 a943a552309..1689912ee05 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 566c818eaba..18974fcf12d 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 c8c2b24740e..8166d057423 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 cdc9b45cca2..bbdcd6bdc48 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 392f31add17..2fc6899adad 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 1f031508f19..e662d906f4c 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 3780220b15c..c4eda5e9324 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 03e49277613..93c266f109c 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 e38b34ad936..d42fc8cf953 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 ab66174df18..7525c5f97fa 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 047d360f09a..e659e8ec1cb 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 641002e5c0c..4c5e3e0735a 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 fc73a6aa197..257233e93e9 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 da5e2a4f391..71428ced87c 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 b082f0a560e..5e4e91b557f 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 2df88b2714b..e89838c2f01 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 e57ac04d33d..a0051702289 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 1fb2f571411..17620ca2181 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 231bff2e8ce..22e69da3bd7 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 87abd4354a5..5892f39e447 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 5ec04cd7632..939b0eef466 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 cf32b2b0d5b..5fc82a50994 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 5d671d1620c..780d1b9eeae 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 f05151ba1f9..08ccb34f672 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 28e7f8afb00..580c4092bc8 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})