summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2021-05-28 12:48:29 (GMT)
committerGitHub <noreply@github.com>2021-05-28 12:48:29 (GMT)
commite60ac6ec2d82fc1bcffcfecd353ff074f9011275 (patch)
tree6ca93dbbb1ced5690bdd1f7ba4328fc8af0016a6
parent4454fca02a57663ea0dbcca01016788bd11703b9 (diff)
downloadhdf5-e60ac6ec2d82fc1bcffcfecd353ff074f9011275.zip
hdf5-e60ac6ec2d82fc1bcffcfecd353ff074f9011275.tar.gz
hdf5-e60ac6ec2d82fc1bcffcfecd353ff074f9011275.tar.bz2
Removes pre-C99 build and header cruft (#700)
* Committing clang-format changes * Removes pre-C99 build and header cruft * Assumes ANSI C headers exist * Assumes stdbool.h, stdint.h, and inttypes.h are present * Assumes the C++ compiler can handle stdint.h * Removes all work-arounds for missing functionality, especially stdbool.h * Formats source Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
-rw-r--r--config/cmake/H5pubconf.h.in15
-rw-r--r--config/cmake_ext_mod/ConfigureChecks.cmake20
-rw-r--r--config/cmake_ext_mod/HDFTests.c8
-rw-r--r--config/cmake_ext_mod/HDFUseCXX.cmake11
-rw-r--r--configure.ac10
-rw-r--r--src/H5private.h12
-rw-r--r--src/H5public.h31
-rw-r--r--test/cache.c13
-rw-r--r--test/cache_common.c12
-rw-r--r--tools/test/perform/chunk.c2
-rw-r--r--tools/test/perform/direct_write_perf.c5
-rw-r--r--tools/test/perform/overhead.c2
-rw-r--r--tools/test/perform/perf.c2
-rw-r--r--tools/test/perform/pio_engine.c2
-rw-r--r--tools/test/perform/pio_standalone.h5
-rw-r--r--tools/test/perform/sio_engine.c2
-rw-r--r--tools/test/perform/sio_standalone.h5
17 files changed, 11 insertions, 146 deletions
diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in
index c57d85a..0176c7a 100644
--- a/config/cmake/H5pubconf.h.in
+++ b/config/cmake/H5pubconf.h.in
@@ -198,9 +198,6 @@
optimization operation */
#cmakedefine H5_HAVE_INSTRUMENTED_LIBRARY @H5_HAVE_INSTRUMENTED_LIBRARY@
-/* Define to 1 if you have the <inttypes.h> header file. */
-#cmakedefine H5_HAVE_INTTYPES_H @H5_HAVE_INTTYPES_H@
-
/* Define to 1 if you have the `ioctl' function. */
#cmakedefine H5_HAVE_IOCTL @H5_HAVE_IOCTL@
@@ -343,18 +340,9 @@
/* Define if `struct stat' has the `st_blocks' field */
#cmakedefine H5_HAVE_STAT_ST_BLOCKS @H5_HAVE_STAT_ST_BLOCKS@
-/* Define to 1 if you have the <stdbool.h> header file. */
-#cmakedefine H5_HAVE_STDBOOL_H @H5_HAVE_STDBOOL_H@
-
/* Define to 1 if you have the <stddef.h> header file. */
#cmakedefine H5_HAVE_STDDEF_H @H5_HAVE_STDDEF_H@
-/* Define to 1 if you have the <stdint.h> header file. */
-#cmakedefine H5_HAVE_STDINT_H @H5_HAVE_STDINT_H@
-
-/* Define to 1 if you have the <stdint.h> header file for Cplusplus. */
-#cmakedefine H5_HAVE_STDINT_H_CXX @H5_HAVE_STDINT_H_CXX@
-
/* Define to 1 if you have the <stdlib.h> header file. */
#cmakedefine H5_HAVE_STDLIB_H @H5_HAVE_STDLIB_H@
@@ -698,9 +686,6 @@
/* The size of `__int64', as computed by sizeof. */
#define H5_SIZEOF___INT64 @H5_SIZEOF___INT64@
-/* Define to 1 if you have the ANSI C header files. */
-#cmakedefine H5_STDC_HEADERS @H5_STDC_HEADERS@
-
/* Define if strict file format checks are enabled */
#cmakedefine H5_STRICT_FORMAT_CHECKS @H5_STRICT_FORMAT_CHECKS@
diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake
index 38b5ab3..12510eb 100644
--- a/config/cmake_ext_mod/ConfigureChecks.cmake
+++ b/config/cmake_ext_mod/ConfigureChecks.cmake
@@ -120,7 +120,6 @@ CHECK_INCLUDE_FILE_CONCAT ("features.h" ${HDF_PREFIX}_HAVE_FEATURES_H)
CHECK_INCLUDE_FILE_CONCAT ("dirent.h" ${HDF_PREFIX}_HAVE_DIRENT_H)
CHECK_INCLUDE_FILE_CONCAT ("setjmp.h" ${HDF_PREFIX}_HAVE_SETJMP_H)
CHECK_INCLUDE_FILE_CONCAT ("stddef.h" ${HDF_PREFIX}_HAVE_STDDEF_H)
-CHECK_INCLUDE_FILE_CONCAT ("stdint.h" ${HDF_PREFIX}_HAVE_STDINT_H)
CHECK_INCLUDE_FILE_CONCAT ("unistd.h" ${HDF_PREFIX}_HAVE_UNISTD_H)
# Windows
@@ -146,12 +145,9 @@ CHECK_INCLUDE_FILE_CONCAT ("strings.h" ${HDF_PREFIX}_HAVE_STRINGS_H)
CHECK_INCLUDE_FILE_CONCAT ("stdlib.h" ${HDF_PREFIX}_HAVE_STDLIB_H)
CHECK_INCLUDE_FILE_CONCAT ("memory.h" ${HDF_PREFIX}_HAVE_MEMORY_H)
CHECK_INCLUDE_FILE_CONCAT ("dlfcn.h" ${HDF_PREFIX}_HAVE_DLFCN_H)
-CHECK_INCLUDE_FILE_CONCAT ("inttypes.h" ${HDF_PREFIX}_HAVE_INTTYPES_H)
CHECK_INCLUDE_FILE_CONCAT ("netinet/in.h" ${HDF_PREFIX}_HAVE_NETINET_IN_H)
CHECK_INCLUDE_FILE_CONCAT ("netdb.h" ${HDF_PREFIX}_HAVE_NETDB_H)
CHECK_INCLUDE_FILE_CONCAT ("arpa/inet.h" ${HDF_PREFIX}_HAVE_ARPA_INET_H)
-# _Bool type support
-CHECK_INCLUDE_FILE_CONCAT (stdbool.h ${HDF_PREFIX}_HAVE_STDBOOL_H)
## Check for non-standard extenstion quadmath.h
@@ -238,11 +234,6 @@ macro (HDF_FUNCTION_TEST OTHER_TEST)
endmacro ()
#-----------------------------------------------------------------------------
-# Check for these functions before the time headers are checked
-#-----------------------------------------------------------------------------
-HDF_FUNCTION_TEST (STDC_HEADERS)
-
-#-----------------------------------------------------------------------------
# Check for large file support
#-----------------------------------------------------------------------------
@@ -416,13 +407,9 @@ HDF_CHECK_TYPE_SIZE (time_t ${HDF_PREFIX}_SIZEOF_TIME_T)
# Extra C99 types
#-----------------------------------------------------------------------------
-# _Bool type support
-if (HAVE_STDBOOL_H)
- set (CMAKE_EXTRA_INCLUDE_FILES stdbool.h)
- HDF_CHECK_TYPE_SIZE (bool ${HDF_PREFIX}_SIZEOF_BOOL)
-else ()
- HDF_CHECK_TYPE_SIZE (_Bool ${HDF_PREFIX}_SIZEOF_BOOL)
-endif ()
+# Size of bool
+set (CMAKE_EXTRA_INCLUDE_FILES stdbool.h)
+HDF_CHECK_TYPE_SIZE (_Bool ${HDF_PREFIX}_SIZEOF_BOOL)
if (MINGW OR NOT WINDOWS)
#-----------------------------------------------------------------------------
@@ -554,7 +541,6 @@ if (MINGW OR NOT WINDOWS)
foreach (other_test
HAVE_ATTRIBUTE
HAVE_C99_FUNC
-# STDC_HEADERS
HAVE_FUNCTION
HAVE_C99_DESIGNATED_INITIALIZER
SYSTEM_SCOPE_THREADS
diff --git a/config/cmake_ext_mod/HDFTests.c b/config/cmake_ext_mod/HDFTests.c
index 2d7e1b4..0c3b7b7 100644
--- a/config/cmake_ext_mod/HDFTests.c
+++ b/config/cmake_ext_mod/HDFTests.c
@@ -88,14 +88,6 @@ int main(void)
}
#endif
-#ifdef STDC_HEADERS
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-int main() { return 0; }
-#endif /* STDC_HEADERS */
-
#ifdef HAVE_ATTRIBUTE
diff --git a/config/cmake_ext_mod/HDFUseCXX.cmake b/config/cmake_ext_mod/HDFUseCXX.cmake
index 580c409..423f74a 100644
--- a/config/cmake_ext_mod/HDFUseCXX.cmake
+++ b/config/cmake_ext_mod/HDFUseCXX.cmake
@@ -32,17 +32,6 @@ endif ()
include (CheckIncludeFileCXX)
include (TestForSTDNamespace)
-# IF the c compiler found stdint, check the C++ as well. On some systems this
-# file will be found by C but not C++, only do this test IF the C++ compiler
-# has been initialized (e.g. the project also includes some c++)
-if (${HDF_PREFIX}_HAVE_STDINT_H AND CMAKE_CXX_COMPILER_LOADED)
- CHECK_INCLUDE_FILE_CXX ("stdint.h" ${HDF_PREFIX}_HAVE_STDINT_H_CXX)
- if (NOT ${HDF_PREFIX}_HAVE_STDINT_H_CXX)
- set (${HDF_PREFIX}_HAVE_STDINT_H "" CACHE INTERNAL "Have includes HAVE_STDINT_H")
- set (USE_INCLUDES ${USE_INCLUDES} "stdint.h")
- endif ()
-endif ()
-
# For other CXX specific tests, use this MACRO.
macro (HDF_CXX_FUNCTION_TEST OTHER_TEST)
if (NOT DEFINED ${OTHER_TEST})
diff --git a/configure.ac b/configure.ac
index 2df2b90..921e8c6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1251,8 +1251,6 @@ AC_CHECK_HEADERS([sys/resource.h sys/time.h unistd.h sys/ioctl.h sys/stat.h])
AC_CHECK_HEADERS([sys/socket.h sys/types.h sys/file.h])
AC_CHECK_HEADERS([stddef.h setjmp.h features.h])
AC_CHECK_HEADERS([dirent.h])
-AC_CHECK_HEADERS([stdint.h], [C9x=yes])
-AC_CHECK_HEADERS([stdbool.h])
AC_CHECK_HEADERS([netdb.h netinet/in.h arpa/inet.h])
## Darwin
@@ -1417,11 +1415,7 @@ AC_CHECK_SIZEOF([off_t])
if test "X$C9x" = "Xyes"; then
cat >>confdefs.h <<\EOF
-#ifdef HAVE_STDBOOL_H
-#include <stdbool.h> /* for bool definition */
-#else
-#define bool _Bool
-#endif
+#include <stdbool.h>
EOF
AC_CHECK_SIZEOF([bool])
fi
@@ -1938,10 +1932,8 @@ if test "X$THREADSAFE" = "Xyes"; then
AC_CACHE_VAL([hdf5_cv_system_scope_threads],
[AC_RUN_IFELSE(
[AC_LANG_PROGRAM([
- #if STDC_HEADERS
#include <stdlib.h>
#include <pthread.h>
- #endif
],[
pthread_attr_t attribute;
int ret;
diff --git a/src/H5private.h b/src/H5private.h
index a0b4e8e..7888772 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -41,10 +41,6 @@
#endif /* H5_HAVE_WIN32_API */
#endif /* H5_HAVE_THREADSAFE */
-/*
- * Include ANSI-C header files.
- */
-#ifdef H5_STDC_HEADERS
#include <assert.h>
#include <ctype.h>
#include <errno.h>
@@ -56,7 +52,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#endif
/*
* If _POSIX_VERSION is defined in unistd.h then this system is Posix.1
@@ -71,14 +66,7 @@
#include <pwd.h>
#endif
-/*
- * C9x integer types
- */
-#ifndef __cplusplus
-#ifdef H5_HAVE_STDINT_H
#include <stdint.h>
-#endif
-#endif
/*
* The `struct stat' data type for stat() and fstat(). This is a Posix file
diff --git a/src/H5public.h b/src/H5public.h
index ada15a7..33f8b37 100644
--- a/src/H5public.h
+++ b/src/H5public.h
@@ -34,28 +34,21 @@
#ifdef H5_HAVE_FEATURES_H
#include <features.h> /* For setting POSIX, BSD, etc. compatibility */
#endif
+
#ifdef H5_HAVE_SYS_TYPES_H
#include <sys/types.h>
#endif
-#ifdef H5_STDC_HEADERS
+
#include <limits.h> /* For H5T_NATIVE_CHAR defn in H5Tpublic.h */
#include <stdarg.h> /* For variadic functions in H5VLpublic.h */
-#endif
-#ifndef __cplusplus
-#ifdef H5_HAVE_STDINT_H
-#include <stdint.h> /* For C9x types */
-#endif
-#else
-#ifdef H5_HAVE_STDINT_H_CXX
-#include <stdint.h> /* For C9x types (when included from C++) */
-#endif
-#endif
-#ifdef H5_HAVE_INTTYPES_H
+
+#include <stdint.h> /* For C9x types */
#include <inttypes.h> /* C99/POSIX.1 header for uint64_t, PRIu64 */
-#endif
+
#ifdef H5_HAVE_STDDEF_H
#include <stddef.h>
#endif
+
#ifdef H5_HAVE_PARALLEL
/* Don't link against MPI C++ bindings */
#define MPICH_SKIP_MPICXX 1
@@ -220,19 +213,7 @@ typedef int herr_t;
* }
* \endcode
*/
-#ifdef H5_HAVE_STDBOOL_H
#include <stdbool.h>
-#else /* H5_HAVE_STDBOOL_H */
-#ifndef __cplusplus
-#if defined(H5_SIZEOF_BOOL) && (H5_SIZEOF_BOOL != 0)
-#define bool _Bool
-#else
-#define bool unsigned int
-#endif
-#define true 1
-#define false 0
-#endif /* __cplusplus */
-#endif /* H5_HAVE_STDBOOL_H */
typedef bool hbool_t;
typedef int htri_t;
diff --git a/test/cache.c b/test/cache.c
index 0081830..78e902c 100644
--- a/test/cache.c
+++ b/test/cache.c
@@ -8068,19 +8068,6 @@ check_flush_cache__flush_op_test(H5F_t *file_ptr, int test_num, unsigned int flu
if ((check[i].entry_num != i) || (check[i].entry_type < 0) ||
(check[i].entry_type >= NUMBER_OF_ENTRY_TYPES) || (check[i].entry_index < 0) ||
(check[i].entry_index > max_indices[check[i].entry_type]) ||
-#ifndef H5_HAVE_STDBOOL_H
- /* Check for nonsense values if hbool_t is an integral
- * type instead of a real Boolean.
- */
- ((check[i].in_cache != TRUE) && (check[i].in_cache != FALSE)) ||
- ((check[i].at_main_addr != TRUE) && (check[i].at_main_addr != FALSE)) ||
- ((check[i].is_dirty != TRUE) && (check[i].is_dirty != FALSE)) ||
- ((check[i].is_protected != TRUE) && (check[i].is_protected != FALSE)) ||
- ((check[i].is_pinned != TRUE) && (check[i].is_pinned != FALSE)) ||
- ((check[i].expected_deserialized != TRUE) && (check[i].expected_deserialized != FALSE)) ||
- ((check[i].expected_serialized != TRUE) && (check[i].expected_serialized != FALSE)) ||
- ((check[i].expected_destroyed != TRUE) && (check[i].expected_destroyed != FALSE)) ||
-#endif /* H5_HAVE_STDBOOL_H */
(check[i].expected_size <= (size_t)0)) {
pass = FALSE;
diff --git a/test/cache_common.c b/test/cache_common.c
index 7269c49..e86724f 100644
--- a/test/cache_common.c
+++ b/test/cache_common.c
@@ -1487,12 +1487,6 @@ add_flush_op(int target_type, int target_idx, int op_code, int type, int idx, hb
HDassert((0 <= type) && (type < NUMBER_OF_ENTRY_TYPES));
HDassert((0 <= idx) && (idx <= max_indices[type]));
HDassert(new_size <= VARIABLE_ENTRY_SIZE);
-#ifndef H5_HAVE_STDBOOL_H
- /* Check for TRUE or FALSE if we're using an integer type instead
- * of a real Boolean type.
- */
- HDassert((flag == TRUE) || (flag == FALSE));
-#endif /* H5_HAVE_STDBOOL_H */
if (pass) {
@@ -1692,12 +1686,6 @@ execute_flush_op(H5F_t *file_ptr, struct test_entry_t *entry_ptr, struct flush_o
HDassert((0 <= op_ptr->type) && (op_ptr->type < NUMBER_OF_ENTRY_TYPES));
HDassert((0 <= op_ptr->idx) && (op_ptr->idx <= max_indices[op_ptr->type]));
HDassert(flags_ptr != NULL);
-#ifndef H5_HAVE_STDBOOL_H
- /* Check for TRUE or FALSE if we're using an integer type instead
- * of a real Boolean type.
- */
- HDassert((op_ptr->flag == FALSE) || (op_ptr->flag == TRUE));
-#endif /* H5_HAVE_STDBOOL_H */
if (pass) {
diff --git a/tools/test/perform/chunk.c b/tools/test/perform/chunk.c
index 1b6793a..1b08e95 100644
--- a/tools/test/perform/chunk.c
+++ b/tools/test/perform/chunk.c
@@ -24,12 +24,10 @@
#undef NDEBUG
#include "hdf5.h"
-#ifdef H5_STDC_HEADERS
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#endif
/* Solaris Studio defines attribute, but for the attributes we need */
#if !defined(H5_HAVE_ATTRIBUTE) || defined __cplusplus || defined(__SUNPRO_C)
diff --git a/tools/test/perform/direct_write_perf.c b/tools/test/perform/direct_write_perf.c
index b3ae54d..6537215 100644
--- a/tools/test/perform/direct_write_perf.c
+++ b/tools/test/perform/direct_write_perf.c
@@ -23,14 +23,11 @@
#if !defined(WIN32) && !defined(__MINGW32__)
-#include <math.h>
-
-#ifdef H5_STDC_HEADERS
#include <errno.h>
#include <fcntl.h>
+#include <math.h>
#include <stdio.h>
#include <stdlib.h>
-#endif
#ifdef H5_HAVE_UNISTD_H
#include <sys/types.h>
diff --git a/tools/test/perform/overhead.c b/tools/test/perform/overhead.c
index dba8220..345c5c8 100644
--- a/tools/test/perform/overhead.c
+++ b/tools/test/perform/overhead.c
@@ -23,13 +23,11 @@
#include "hdf5.h"
#include "H5private.h"
-#ifdef H5_STDC_HEADERS
#include <ctype.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <string.h>
-#endif
#ifdef H5_HAVE_IO_H
#include <io.h>
diff --git a/tools/test/perform/perf.c b/tools/test/perform/perf.c
index bf4b2a9..a06fb77 100644
--- a/tools/test/perform/perf.c
+++ b/tools/test/perform/perf.c
@@ -26,13 +26,11 @@
#ifdef H5_HAVE_PARALLEL
-#ifdef H5_STDC_HEADERS
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#endif
#ifdef H5_HAVE_UNISTD_H
#include <sys/types.h>
diff --git a/tools/test/perform/pio_engine.c b/tools/test/perform/pio_engine.c
index 65194b0..cac36d7 100644
--- a/tools/test/perform/pio_engine.c
+++ b/tools/test/perform/pio_engine.c
@@ -16,12 +16,10 @@
#include "hdf5.h"
-#ifdef H5_STDC_HEADERS
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
-#endif
#ifdef H5_HAVE_UNISTD_H
#include <sys/types.h>
diff --git a/tools/test/perform/pio_standalone.h b/tools/test/perform/pio_standalone.h
index 35a5217..82fabdc 100644
--- a/tools/test/perform/pio_standalone.h
+++ b/tools/test/perform/pio_standalone.h
@@ -21,10 +21,6 @@
#include "H5public.h" /* Include Public Definitions */
-/*
- * Include ANSI-C header files.
- */
-#ifdef H5_STDC_HEADERS
#include <assert.h>
#include <ctype.h>
#include <errno.h>
@@ -37,7 +33,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#endif
/*
* Redefine all the POSIX functions. We should never see a POSIX
diff --git a/tools/test/perform/sio_engine.c b/tools/test/perform/sio_engine.c
index e5a0ec8..f67a7a6 100644
--- a/tools/test/perform/sio_engine.c
+++ b/tools/test/perform/sio_engine.c
@@ -16,12 +16,10 @@
#include "hdf5.h"
-#ifdef H5_STDC_HEADERS
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
-#endif
#ifdef H5_HAVE_UNISTD_H
#include <sys/types.h>
diff --git a/tools/test/perform/sio_standalone.h b/tools/test/perform/sio_standalone.h
index d8b6412..54e82fa 100644
--- a/tools/test/perform/sio_standalone.h
+++ b/tools/test/perform/sio_standalone.h
@@ -21,10 +21,6 @@
#include "H5public.h" /* Include Public Definitions */
-/*
- * Include ANSI-C header files.
- */
-#ifdef H5_STDC_HEADERS
#include <assert.h>
#include <ctype.h>
#include <errno.h>
@@ -37,7 +33,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#endif
/* maximum of two, three, or four values */
#undef MAX