From 34f2df48b7e0ae2151462a9835fd7096ef8c2925 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Thu, 24 Jun 2021 22:07:36 -0700 Subject: Removes checks for signal and set/longjmp, which are C89 (#798) Also removes checks for setjmp.h and stddef.h --- config/cmake/H5pubconf.h.in | 15 ---------- config/cmake_ext_mod/ConfigureChecks.cmake | 14 ++------- configure.ac | 4 +-- src/H5detect.c | 48 ++---------------------------- src/H5private.h | 8 +---- 5 files changed, 9 insertions(+), 80 deletions(-) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index 107fe57..8a4db30 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -235,9 +235,6 @@ /* Define to 1 if you have the `z' library (-lz). */ #cmakedefine H5_HAVE_LIBZ @H5_HAVE_LIBZ@ -/* Define to 1 if you have the `longjmp' function. */ -#cmakedefine H5_HAVE_LONGJMP @H5_HAVE_LONGJMP@ - /* Define to 1 if you have the `lseek64' function. */ #cmakedefine H5_HAVE_LSEEK64 @H5_HAVE_LSEEK64@ @@ -302,21 +299,12 @@ compiled */ #cmakedefine H5_HAVE_ROS3_VFD @H5_HAVE_ROS3_VFD@ -/* Define to 1 if you have the `setjmp' function. */ -#cmakedefine H5_HAVE_SETJMP @H5_HAVE_SETJMP@ - -/* Define to 1 if you have the header file. */ -#cmakedefine H5_HAVE_SETJMP_H @H5_HAVE_SETJMP_H@ - /* Define to 1 if you have the `setsysinfo' function. */ #cmakedefine H5_HAVE_SETSYSINFO @H5_HAVE_SETSYSINFO@ /* Define to 1 if you have the `siglongjmp' function. */ #cmakedefine H5_HAVE_SIGLONGJMP @H5_HAVE_SIGLONGJMP@ -/* Define to 1 if you have the `signal' function. */ -#cmakedefine H5_HAVE_SIGNAL @H5_HAVE_SIGNAL@ - /* Define to 1 if you have the `sigprocmask' function. */ #cmakedefine H5_HAVE_SIGPROCMASK @H5_HAVE_SIGPROCMASK@ @@ -332,9 +320,6 @@ /* 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 header file. */ -#cmakedefine H5_HAVE_STDDEF_H @H5_HAVE_STDDEF_H@ - /* Define to 1 if you have the header file. */ #cmakedefine H5_HAVE_STDLIB_H @H5_HAVE_STDLIB_H@ diff --git a/config/cmake_ext_mod/ConfigureChecks.cmake b/config/cmake_ext_mod/ConfigureChecks.cmake index 7e1385a..f762a1f 100644 --- a/config/cmake_ext_mod/ConfigureChecks.cmake +++ b/config/cmake_ext_mod/ConfigureChecks.cmake @@ -72,7 +72,6 @@ if (WINDOWS) set (${HDF_PREFIX}_HAVE_WIN32_API 1) set (${HDF_PREFIX}_HAVE_LIBM 1) set (${HDF_PREFIX}_HAVE_STRDUP 1) - set (${HDF_PREFIX}_HAVE_LONGJMP 1) if (NOT MINGW) set (${HDF_PREFIX}_HAVE_GETHOSTNAME 1) set (${HDF_PREFIX}_HAVE_FUNCTION 1) @@ -117,8 +116,6 @@ CHECK_INCLUDE_FILE_CONCAT ("sys/time.h" ${HDF_PREFIX}_HAVE_SYS_TIME_H) CHECK_INCLUDE_FILE_CONCAT ("sys/types.h" ${HDF_PREFIX}_HAVE_SYS_TYPES_H) 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 ("unistd.h" ${HDF_PREFIX}_HAVE_UNISTD_H) # Windows @@ -483,9 +480,6 @@ CHECK_FUNCTION_EXISTS (rand_r ${HDF_PREFIX}_HAVE_RAND_R) CHECK_FUNCTION_EXISTS (random ${HDF_PREFIX}_HAVE_RANDOM) CHECK_FUNCTION_EXISTS (setsysinfo ${HDF_PREFIX}_HAVE_SETSYSINFO) -CHECK_FUNCTION_EXISTS (signal ${HDF_PREFIX}_HAVE_SIGNAL) -CHECK_FUNCTION_EXISTS (longjmp ${HDF_PREFIX}_HAVE_LONGJMP) -CHECK_FUNCTION_EXISTS (setjmp ${HDF_PREFIX}_HAVE_SETJMP) CHECK_FUNCTION_EXISTS (siglongjmp ${HDF_PREFIX}_HAVE_SIGLONGJMP) CHECK_FUNCTION_EXISTS (sigsetjmp ${HDF_PREFIX}_HAVE_SIGSETJMP) CHECK_FUNCTION_EXISTS (sigprocmask ${HDF_PREFIX}_HAVE_SIGPROCMASK) @@ -503,11 +497,9 @@ CHECK_FUNCTION_EXISTS (waitpid ${HDF_PREFIX}_HAVE_WAITPID) # sigsetjmp is special; may actually be a macro #----------------------------------------------------------------------------- if (NOT ${HDF_PREFIX}_HAVE_SIGSETJMP) - if (${HDF_PREFIX}_HAVE_SETJMP_H) - CHECK_SYMBOL_EXISTS (sigsetjmp "setjmp.h" ${HDF_PREFIX}_HAVE_MACRO_SIGSETJMP) - if (${HDF_PREFIX}_HAVE_MACRO_SIGSETJMP) - set (${HDF_PREFIX}_HAVE_SIGSETJMP 1) - endif () + CHECK_SYMBOL_EXISTS (sigsetjmp "setjmp.h" ${HDF_PREFIX}_HAVE_MACRO_SIGSETJMP) + if (${HDF_PREFIX}_HAVE_MACRO_SIGSETJMP) + set (${HDF_PREFIX}_HAVE_SIGSETJMP 1) endif () endif () diff --git a/configure.ac b/configure.ac index cf1223b..75016ae 100644 --- a/configure.ac +++ b/configure.ac @@ -1227,7 +1227,7 @@ AC_CHECK_LIB([dl], [dlopen]) ## Unix 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([features.h]) AC_CHECK_HEADERS([dirent.h]) AC_CHECK_HEADERS([netdb.h netinet/in.h arpa/inet.h]) @@ -2010,7 +2010,7 @@ AC_SEARCH_LIBS([clock_gettime], [rt posix4]) AC_CHECK_FUNCS([alarm clock_gettime difftime fcntl flock fork frexpf]) AC_CHECK_FUNCS([frexpl gethostname getrusage gettimeofday]) AC_CHECK_FUNCS([lstat rand_r random setsysinfo]) -AC_CHECK_FUNCS([signal longjmp setjmp siglongjmp sigsetjmp sigprocmask]) +AC_CHECK_FUNCS([siglongjmp sigsetjmp sigprocmask]) AC_CHECK_FUNCS([srandom strdup symlink]) AC_CHECK_FUNCS([tmpfile asprintf vasprintf waitpid]) diff --git a/src/H5detect.c b/src/H5detect.c index d148301..b2c0924 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -80,7 +80,7 @@ H5_GCC_DIAG_OFF("cast-align") #define H5SETJMP(buf) HDsigsetjmp(buf, 1) #define H5LONGJMP(buf, val) HDsiglongjmp(buf, val) #define H5HAVE_SIGJMP /* sigsetjmp/siglongjmp are supported. */ -#elif defined(H5_HAVE_LONGJMP) +#else #define H5JMP_BUF jmp_buf #define H5SETJMP(buf) HDsetjmp(buf) #define H5LONGJMP(buf, val) HDlongjmp(buf, val) @@ -149,12 +149,8 @@ static int sigbus_handler_called_g = 0; /* how many times called */ static int sigsegv_handler_called_g = 0; /* how many times called */ static int sigill_handler_called_g = 0; /* how many times called */ static int signal_handler_tested_g = 0; /* how many times tested */ -#if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) -static int verify_signal_handlers(int signum, void (*handler)(int)); -#endif -#ifdef H5JMP_BUF -static H5JMP_BUF jbuf_g; -#endif +static int verify_signal_handlers(int signum, void (*handler)(int)); +static H5JMP_BUF jbuf_g; /*------------------------------------------------------------------------- * Function: precision @@ -388,7 +384,6 @@ precision(detected_t *d) COMP_ALIGN = (unsigned int)((char *)(&(s.x)) - (char *)(&s)); \ } -#if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) #define ALIGNMENT(TYPE, INFO) \ { \ char *volatile _buf = NULL; \ @@ -435,15 +430,6 @@ precision(detected_t *d) HDsignal(SIGSEGV, _handler2); /*restore original handler*/ \ HDsignal(SIGILL, _handler3); /*restore original handler*/ \ } -#else -#define ALIGNMENT(TYPE, INFO) \ - { \ - align_status_g |= STA_NoALIGNMENT; \ - (INFO.align) = 0; \ - } -#endif - -#if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) /*------------------------------------------------------------------------- * Function: sigsegv_handler @@ -473,9 +459,6 @@ sigsegv_handler(int H5_ATTR_UNUSED signo) HDsignal(SIGSEGV, sigsegv_handler); H5LONGJMP(jbuf_g, SIGSEGV); } -#endif - -#if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) /*------------------------------------------------------------------------- * Function: sigbus_handler @@ -505,9 +488,6 @@ sigbus_handler(int H5_ATTR_UNUSED signo) HDsignal(SIGBUS, sigbus_handler); H5LONGJMP(jbuf_g, SIGBUS); } -#endif - -#if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) /*------------------------------------------------------------------------- * Function: sigill_handler @@ -537,7 +517,6 @@ sigill_handler(int H5_ATTR_UNUSED signo) HDsignal(SIGILL, sigill_handler); H5LONGJMP(jbuf_g, SIGILL); } -#endif /*------------------------------------------------------------------------- * Function: print_results @@ -777,21 +756,6 @@ done:\n\ fprintf(rawoutstream, "/* Signal handlers verify test is not available */\n"); /* The following is available in H5pubconf.h. Printing them here for */ /* convenience. */ -#ifdef H5_HAVE_SIGNAL - fprintf(rawoutstream, "/* Signal() support: yes */\n"); -#else - fprintf(rawoutstream, "/* Signal() support: no */\n"); -#endif -#ifdef H5_HAVE_SETJMP - fprintf(rawoutstream, "/* setjmp() support: yes */\n"); -#else - fprintf(rawoutstream, "/* setjmp() support: no */\n"); -#endif -#ifdef H5_HAVE_LONGJMP - fprintf(rawoutstream, "/* longjmp() support: yes */\n"); -#else - fprintf(rawoutstream, "/* longjmp() support: no */\n"); -#endif #ifdef H5_HAVE_SIGSETJMP fprintf(rawoutstream, "/* sigsetjmp() support: yes */\n"); #else @@ -1568,7 +1532,6 @@ detect_alignments(void) na_g++; } -#if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) /* Verify the signal handler for signal signum works correctly multiple times. * One possible cause of failure is that the signal handling is blocked or * changed to SIG_DFL after H5LONGJMP. @@ -1625,7 +1588,6 @@ verify_signal_handlers(int signum, void (*handler)(int)) return 0; } } -#endif /*------------------------------------------------------------------------- * Function: main @@ -1655,7 +1617,6 @@ main(int argc, char *argv[]) if (!rawoutstream) rawoutstream = stdout; -#if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) /* verify the SIGBUS and SIGSEGV handlers work properly */ if (verify_signal_handlers(SIGBUS, sigbus_handler) != 0) { fprintf(stderr, "Signal handler %s for signal %d failed\n", "sigbus_handler", SIGBUS); @@ -1666,9 +1627,6 @@ main(int argc, char *argv[]) if (verify_signal_handlers(SIGILL, sigill_handler) != 0) { fprintf(stderr, "Signal handler %s for signal %d failed\n", "sigill_handler", SIGILL); } -#else - align_status_g |= STA_NoHandlerVerify; -#endif print_header(); diff --git a/src/H5private.h b/src/H5private.h index f90aa94..2478c2e 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -32,6 +32,7 @@ #include #include #include +#include #include #include #include @@ -63,13 +64,6 @@ #endif /* - * Longjumps are used to detect alignment constrants - */ -#ifdef H5_HAVE_SETJMP_H -#include -#endif - -/* * flock() in sys/file.h is used for the implementation of file locking. */ #if defined(H5_HAVE_FLOCK) && defined(H5_HAVE_SYS_FILE_H) -- cgit v0.12