mirror of
https://github.com/dovecot/core.git
synced 2026-10-23 22:08:58 +03:00
m4: Require signed time_t
An unsigned time_t is not forbidden by POSIX, but it is essentially nonexistent on POSIX systems. Requiring a signed time_t simplifies overflow checks in time arithmetic.
This commit is contained in:
21
m4/time_t.m4
21
m4/time_t.m4
@@ -13,28 +13,15 @@ AC_DEFUN([DOVECOT_TIME_T], [
|
||||
timet_len="ll"
|
||||
i_cv_signed_time_t=yes
|
||||
;;
|
||||
"unsigned int")
|
||||
timet_len=""
|
||||
i_cv_signed_time_t=no
|
||||
;;
|
||||
"unsigned long")
|
||||
timet_len="l"
|
||||
i_cv_signed_time_t=no
|
||||
;;
|
||||
"unsigned long long")
|
||||
timet_len="ll"
|
||||
i_cv_signed_time_t=no
|
||||
"unsigned int"|"unsigned long"|"unsigned long long")
|
||||
AC_MSG_ERROR([Dovecot requires a signed time_t])
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([Unsupported time_t type])
|
||||
;;
|
||||
esac
|
||||
if test $i_cv_signed_time_t = yes; then
|
||||
AC_DEFINE(TIME_T_SIGNED,, [Define if your time_t is signed])
|
||||
timet_d_fmt="$timet_len"d
|
||||
else
|
||||
timet_d_fmt="$timet_len"u
|
||||
fi
|
||||
AC_DEFINE(TIME_T_SIGNED,, [Define if your time_t is signed])
|
||||
timet_d_fmt="$timet_len"d
|
||||
timet_x_fmt="$timet_len"x
|
||||
|
||||
AC_DEFINE_UNQUOTED(PRIdTIME_T, "$timet_d_fmt", [printf() fmt for dec time_t])
|
||||
|
||||
Reference in New Issue
Block a user