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
This commit is contained in:
Sean McBride 2021-03-10 12:51:45 -05:00 committed by GitHub
parent c41a1cb209
commit 20c452fe5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
37 changed files with 6 additions and 235 deletions

View File

@ -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++")

View File

@ -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;

View File

@ -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;

View File

@ -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"

View File

@ -18,11 +18,7 @@
*
*/
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>
using std::cout;

View File

@ -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;

View File

@ -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;

View File

@ -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"
@ -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;
@ -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;
@ -142,11 +122,7 @@ EOF
cat > $hdf5main <<EOF
#include <string>
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include "H5Cpp.h"

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -11,11 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>
#include "H5Include.h"

View File

@ -11,11 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>
#include "H5Include.h"

View File

@ -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.

View File

@ -11,11 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>
using std::cerr;

View File

@ -11,11 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>
#include "H5Include.h"

View File

@ -11,11 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>
#include "H5Include.h"

View File

@ -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.

View File

@ -11,11 +11,7 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>

View File

@ -23,11 +23,7 @@
***************************************************************************/
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
using std::cerr;
using std::endl;

View File

@ -19,11 +19,7 @@
***************************************************************************/
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
using std::cerr;
using std::endl;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -17,11 +17,7 @@
list functionality
***************************************************************************/
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
using std::cerr;
using std::endl;

View File

@ -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;

View File

@ -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;

View File

@ -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;

View File

@ -19,11 +19,7 @@
EXTERNAL ROUTINES/VARIABLES:
***************************************************************************/
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
using std::cerr;
using std::endl;

View File

@ -16,11 +16,7 @@
titerate.cpp - HDF5 C++ testing iterate related functionality
***************************************************************************/
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
using std::cerr;
using std::endl;

View File

@ -16,11 +16,7 @@
C link interface (H5L)
***************************************************************************/
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
using std::cerr;
using std::endl;

View File

@ -16,11 +16,7 @@
tobject.cpp - HDF5 C++ testing object related functionality
***************************************************************************/
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
#include <string>
#include "H5Cpp.h" // C++ API header file

View File

@ -17,11 +17,7 @@
Reference interface (H5R)
***************************************************************************/
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
using std::cerr;
using std::endl;

View File

@ -16,11 +16,7 @@
ttypes.cpp - HDF5 C++ testing the general datatype functionality
***************************************************************************/
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
using std::cerr;
using std::endl;

View File

@ -18,11 +18,7 @@
EXTERNAL ROUTINES/VARIABLES:
***************************************************************************/
#ifdef OLD_HEADER_FILENAME
#include <iostream.h>
#else
#include <iostream>
#endif
using std::cerr;
using std::endl;

View File

@ -10,62 +10,6 @@
* help@hdfgroup.org. *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
#ifdef OLD_HEADER_FILENAME
#include <iostream>
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 <string>
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 <int> (test_float);
return 0;
}
#endif
#ifdef CXX_HAVE_OFFSETOF
#include <stdio.h>

View File

@ -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})