summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Trangez <ikke@nicolast.be>2022-09-21 13:52:14 +0200
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-10-21 02:58:39 -0400
commit25cdc63044be34e5eb3ef478910bd5eeb2b5093f (patch)
tree58bf8a9e52def87de3e0aec39c5400fdf82ff9b1
parenta2af7c4c59ef24a71cc6cab7bd6b07d12f02aad1 (diff)
downloadhaskell-25cdc63044be34e5eb3ef478910bd5eeb2b5093f.tar.gz
rts: remove use of `TIME_WITH_SYS_TIME`
`autoreconf` will insert an `m4_warning` when the obsolescent `AC_HEADER_TIME` macro is used: > Update your code to rely only on HAVE_SYS_TIME_H, > then remove this warning and the obsolete code below it. > All current systems provide time.h; it need not be checked for. > Not all systems provide sys/time.h, but those that do, all allow > you to include it and time.h simultaneously. Presence of `sys/time.h` was already checked in an earlier `AC_CHECK_HEADERS` invocation, so `AC_HEADER_TIME` can be dropped and guards relying on `TIME_WITH_SYS_TIME` can be reworked to (unconditionally) include `time.h` and include `sys/time.h` based on `HAVE_SYS_TIME_H`. Note the documentation of `AC_HEADER_TIME` in (at least) Autoconf 2.67 says > This macro is obsolescent, as current systems can include both files > when they exist. New programs need not use this macro.
-rw-r--r--configure.ac3
-rw-r--r--rts/posix/ticker/Pthread.c15
-rw-r--r--rts/posix/ticker/Setitimer.c15
3 files changed, 8 insertions, 25 deletions
diff --git a/configure.ac b/configure.ac
index 0f8e0ba4b4..4a69f5e833 100644
--- a/configure.ac
+++ b/configure.ac
@@ -857,9 +857,6 @@ AC_CHECK_HEADERS([sys/cpuset.h], [], [],
dnl ** check whether a declaration for `environ` is provided by libc.
FP_CHECK_ENVIRON
-dnl ** check if it is safe to include both <time.h> and <sys/time.h>
-AC_HEADER_TIME
-
dnl ** do we have long longs?
AC_CHECK_TYPES([long long])
diff --git a/rts/posix/ticker/Pthread.c b/rts/posix/ticker/Pthread.c
index 7d39fd1b10..01b3a5f901 100644
--- a/rts/posix/ticker/Pthread.c
+++ b/rts/posix/ticker/Pthread.c
@@ -44,17 +44,10 @@
#include "Schedule.h"
#include "posix/Clock.h"
-/* As recommended in the autoconf manual */
-# if defined(TIME_WITH_SYS_TIME)
-# include <sys/time.h>
-# include <time.h>
-# else
-# if defined(HAVE_SYS_TIME_H)
-# include <sys/time.h>
-# else
-# include <time.h>
-# endif
-# endif
+#include <time.h>
+#if HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
#if defined(HAVE_SIGNAL_H)
# include <signal.h>
diff --git a/rts/posix/ticker/Setitimer.c b/rts/posix/ticker/Setitimer.c
index 816d603db3..de98b4f777 100644
--- a/rts/posix/ticker/Setitimer.c
+++ b/rts/posix/ticker/Setitimer.c
@@ -15,17 +15,10 @@
#include "posix/Clock.h"
#include "posix/Signals.h"
-/* As recommended in the autoconf manual */
-# if defined(TIME_WITH_SYS_TIME)
-# include <sys/time.h>
-# include <time.h>
-# else
-# if defined(HAVE_SYS_TIME_H)
-# include <sys/time.h>
-# else
-# include <time.h>
-# endif
-# endif
+#include <time.h>
+#if HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
#if defined(HAVE_SIGNAL_H)
# include <signal.h>