Browse Source

Make significant floating point errors fatal to avoid subtle bugs being missed

master
ckolivas 11 years ago
parent
commit
34d77bd3b9
  1. 2
      configure.ac
  2. 4
      src/ckpool.c

2
configure.ac

@ -32,7 +32,7 @@ AC_FUNC_ALLOCA
PKG_PROG_PKG_CONFIG() PKG_PROG_PKG_CONFIG()
AC_CHECK_HEADERS(stdio.h stdlib.h fcntl.h sys/time.h unistd.h dirent.h) AC_CHECK_HEADERS(stdio.h stdlib.h fcntl.h sys/time.h unistd.h dirent.h)
AC_CHECK_HEADERS(ctype.h errno.h byteswap.h string.h time.h) AC_CHECK_HEADERS(ctype.h errno.h byteswap.h string.h time.h fenv.h)
AC_CHECK_HEADERS(endian.h sys/endian.h arpa/inet.h sys/poll.h syslog.h) AC_CHECK_HEADERS(endian.h sys/endian.h arpa/inet.h sys/poll.h syslog.h)
AC_CHECK_HEADERS(alloca.h pthread.h stdio.h math.h signal.h sys/prctl.h) AC_CHECK_HEADERS(alloca.h pthread.h stdio.h math.h signal.h sys/prctl.h)
AC_CHECK_HEADERS(sys/types.h sys/socket.h sys/stat.h linux/un.h netdb.h) AC_CHECK_HEADERS(sys/types.h sys/socket.h sys/stat.h linux/un.h netdb.h)

4
src/ckpool.c

@ -15,6 +15,7 @@
#include <sys/stat.h> #include <sys/stat.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
#include <fenv.h>
#include <grp.h> #include <grp.h>
#include <jansson.h> #include <jansson.h>
#include <signal.h> #include <signal.h>
@ -877,6 +878,9 @@ int main(int argc, char **argv)
int c, ret, i; int c, ret, i;
ckpool_t ckp; ckpool_t ckp;
/* Make significant floating point errors fatal to avoid subtle bugs being missed */
feenableexcept(FE_DIVBYZERO | FE_INVALID | FE_OVERFLOW );
global_ckp = &ckp; global_ckp = &ckp;
memset(&ckp, 0, sizeof(ckp)); memset(&ckp, 0, sizeof(ckp));
ckp.loglevel = LOG_NOTICE; ckp.loglevel = LOG_NOTICE;

Loading…
Cancel
Save