summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2021-06-25 05:07:36 (GMT)
committerGitHub <noreply@github.com>2021-06-25 05:07:36 (GMT)
commit34f2df48b7e0ae2151462a9835fd7096ef8c2925 (patch)
tree9cacb20e6b0af5b25d55e9d6fa2088fd19700690 /src
parentb16b7316c4afb7f59a4628ec5976659b8db3c497 (diff)
downloadhdf5-34f2df48b7e0ae2151462a9835fd7096ef8c2925.zip
hdf5-34f2df48b7e0ae2151462a9835fd7096ef8c2925.tar.gz
hdf5-34f2df48b7e0ae2151462a9835fd7096ef8c2925.tar.bz2
Removes checks for signal and set/longjmp, which are C89 (#798)
Also removes checks for setjmp.h and stddef.h
Diffstat (limited to 'src')
-rw-r--r--src/H5detect.c48
-rw-r--r--src/H5private.h8
2 files changed, 4 insertions, 52 deletions
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 <fcntl.h>
#include <float.h>
#include <math.h>
+#include <setjmp.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
@@ -63,13 +64,6 @@
#endif
/*
- * Longjumps are used to detect alignment constrants
- */
-#ifdef H5_HAVE_SETJMP_H
-#include <setjmp.h>
-#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)