Assume that we have isinf().

Windows has this, and so do all other live platforms according to the
buildfarm, so remove the configure probe and src/port/ substitution.

This also lets us get rid of some configure probes that existed only
to support src/port/isinf.c.  I kept the port.h hack to force using
__builtin_isinf() on clang, though.

This is part of a series of commits to get rid of no-longer-relevant
configure checks and dead src/port/ code.  I'm committing them separately
to make it easier to back out individual changes if they prove less
portable than I expect.

Discussion: https://postgr.es/m/15379.1582221614@sss.pgh.pa.us
This commit is contained in:
Tom Lane 2020-02-21 13:18:27 -05:00
parent 799d22461a
commit 7fde892bc1
6 changed files with 1 additions and 192 deletions

59
configure vendored
View File

@ -12762,7 +12762,7 @@ $as_echo "#define HAVE_STDBOOL_H 1" >>confdefs.h
fi
for ac_header in atomic.h copyfile.h execinfo.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h mbarrier.h poll.h sys/epoll.h sys/event.h sys/ipc.h sys/prctl.h sys/procctl.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/sockio.h sys/tas.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h
for ac_header in atomic.h copyfile.h execinfo.h getopt.h ifaddrs.h langinfo.h mbarrier.h poll.h sys/epoll.h sys/event.h sys/ipc.h sys/prctl.h sys/procctl.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/sockio.h sys/tas.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h
do :
as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
@ -15485,63 +15485,6 @@ $as_echo "#define HAVE_PS_STRINGS 1" >>confdefs.h
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for isinf" >&5
$as_echo_n "checking for isinf... " >&6; }
if ${ac_cv_func_isinf+:} false; then :
$as_echo_n "(cached) " >&6
else
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
#include <math.h>
double glob_double;
int
main ()
{
return isinf(glob_double) ? 0 : 1;
;
return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
ac_cv_func_isinf=yes
else
ac_cv_func_isinf=no
fi
rm -f core conftest.err conftest.$ac_objext \
conftest$ac_exeext conftest.$ac_ext
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_isinf" >&5
$as_echo "$ac_cv_func_isinf" >&6; }
if test $ac_cv_func_isinf = yes ; then
$as_echo "#define HAVE_ISINF 1" >>confdefs.h
else
case " $LIBOBJS " in
*" isinf.$ac_objext "* ) ;;
*) LIBOBJS="$LIBOBJS isinf.$ac_objext"
;;
esac
# Look for a way to implement a substitute for isinf()
for ac_func in fpclass fp_class fp_class_d class
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
cat >>confdefs.h <<_ACEOF
#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
_ACEOF
break
fi
done
fi
ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
if test "x$ac_cv_func_dlopen" = xyes; then :
$as_echo "#define HAVE_DLOPEN 1" >>confdefs.h

View File

@ -1280,9 +1280,7 @@ AC_CHECK_HEADERS(m4_normalize([
atomic.h
copyfile.h
execinfo.h
fp_class.h
getopt.h
ieeefp.h
ifaddrs.h
langinfo.h
mbarrier.h
@ -1699,25 +1697,6 @@ if test "$pgac_cv_var_PS_STRINGS" = yes ; then
AC_DEFINE([HAVE_PS_STRINGS], 1, [Define to 1 if the PS_STRINGS thing exists.])
fi
dnl Cannot use AC_CHECK_FUNC because isinf may be a macro
AC_CACHE_CHECK([for isinf], ac_cv_func_isinf,
[AC_LINK_IFELSE([AC_LANG_PROGRAM([
#include <math.h>
double glob_double;
],
[return isinf(glob_double) ? 0 : 1;])],
[ac_cv_func_isinf=yes],
[ac_cv_func_isinf=no])])
if test $ac_cv_func_isinf = yes ; then
AC_DEFINE(HAVE_ISINF, 1, [Define to 1 if you have isinf().])
else
AC_LIBOBJ(isinf)
# Look for a way to implement a substitute for isinf()
AC_CHECK_FUNCS([fpclass fp_class fp_class_d class], [break])
fi
AC_REPLACE_FUNCS(m4_normalize([
dlopen
explicit_bzero

View File

@ -104,9 +104,6 @@
/* Define to 1 if you have the `cbrt' function. */
#undef HAVE_CBRT
/* Define to 1 if you have the `class' function. */
#undef HAVE_CLASS
/* Define to 1 if you have the `clock_gettime' function. */
#undef HAVE_CLOCK_GETTIME
@ -206,18 +203,6 @@
/* Define to 1 if you have the `fls' function. */
#undef HAVE_FLS
/* Define to 1 if you have the `fpclass' function. */
#undef HAVE_FPCLASS
/* Define to 1 if you have the `fp_class' function. */
#undef HAVE_FP_CLASS
/* Define to 1 if you have the `fp_class_d' function. */
#undef HAVE_FP_CLASS_D
/* Define to 1 if you have the <fp_class.h> header file. */
#undef HAVE_FP_CLASS_H
/* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
#undef HAVE_FSEEKO
@ -295,9 +280,6 @@
/* Define to 1 if you have the `history_truncate_file' function. */
#undef HAVE_HISTORY_TRUNCATE_FILE
/* Define to 1 if you have the <ieeefp.h> header file. */
#undef HAVE_IEEEFP_H
/* Define to 1 if you have the <ifaddrs.h> header file. */
#undef HAVE_IFADDRS_H
@ -325,9 +307,6 @@
/* Define to 1 if you have support for IPv6. */
#undef HAVE_IPV6
/* Define to 1 if you have isinf(). */
#undef HAVE_ISINF
/* Define to 1 if __builtin_constant_p(x) implies "i"(x) acceptance. */
#undef HAVE_I_CONSTRAINT__BUILTIN_CONSTANT_P

View File

@ -352,9 +352,6 @@ extern int getpeereid(int sock, uid_t *uid, gid_t *gid);
#endif
#endif
#ifndef HAVE_ISINF
extern int isinf(double x);
#else
/*
* Glibc doesn't use the builtin for clang due to a *gcc* bug in a version
* newer than the gcc compatibility clang claims to have. This would cause a
@ -370,7 +367,6 @@ extern int isinf(double x);
#define isinf __builtin_isinf
#endif /* __has_builtin(isinf) */
#endif /* __clang__ && !__cplusplus */
#endif /* !HAVE_ISINF */
#ifndef HAVE_EXPLICIT_BZERO
extern void explicit_bzero(void *buf, size_t len);

View File

@ -1,81 +0,0 @@
/*-------------------------------------------------------------------------
*
* isinf.c
*
* Portions Copyright (c) 1996-2020, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
*
* IDENTIFICATION
* src/port/isinf.c
*
*-------------------------------------------------------------------------
*/
#include "c.h"
#include <float.h>
#include <math.h>
#if HAVE_FPCLASS /* this is _not_ HAVE_FP_CLASS, and not typo */
#if HAVE_IEEEFP_H
#include <ieeefp.h>
#endif
int
isinf(double d)
{
fpclass_t type = fpclass(d);
switch (type)
{
case FP_NINF:
case FP_PINF:
return 1;
default:
break;
}
return 0;
}
#else
#if defined(HAVE_FP_CLASS) || defined(HAVE_FP_CLASS_D)
#if HAVE_FP_CLASS_H
#include <fp_class.h>
#endif
int
isinf(double x)
{
#if HAVE_FP_CLASS
int fpclass = fp_class(x);
#else
int fpclass = fp_class_d(x);
#endif
if (fpclass == FP_POS_INF)
return 1;
if (fpclass == FP_NEG_INF)
return -1;
return 0;
}
#elif defined(HAVE_CLASS)
int
isinf(double x)
{
int fpclass = class(x);
if (fpclass == FP_PLUS_INF)
return 1;
if (fpclass == FP_MINUS_INF)
return -1;
return 0;
}
#endif
#endif

View File

@ -211,7 +211,6 @@ sub GenerateFiles
HAVE_BIO_GET_DATA => undef,
HAVE_BIO_METH_NEW => undef,
HAVE_CBRT => undef,
HAVE_CLASS => undef,
HAVE_CLOCK_GETTIME => undef,
HAVE_COMPUTED_GOTO => undef,
HAVE_COPYFILE => undef,
@ -240,10 +239,6 @@ sub GenerateFiles
HAVE_EXPLICIT_BZERO => undef,
HAVE_FDATASYNC => undef,
HAVE_FLS => undef,
HAVE_FPCLASS => undef,
HAVE_FP_CLASS => undef,
HAVE_FP_CLASS_D => undef,
HAVE_FP_CLASS_H => undef,
HAVE_FSEEKO => 1,
HAVE_FUNCNAME__FUNC => undef,
HAVE_FUNCNAME__FUNCTION => 1,
@ -269,7 +264,6 @@ sub GenerateFiles
HAVE_GSSAPI_H => undef,
HAVE_HISTORY_H => undef,
HAVE_HISTORY_TRUNCATE_FILE => undef,
HAVE_IEEEFP_H => undef,
HAVE_IFADDRS_H => undef,
HAVE_INET_ATON => undef,
HAVE_INT_TIMEZONE => 1,
@ -279,7 +273,6 @@ sub GenerateFiles
HAVE_INT_OPTERR => undef,
HAVE_INT_OPTRESET => undef,
HAVE_IPV6 => 1,
HAVE_ISINF => 1,
HAVE_I_CONSTRAINT__BUILTIN_CONSTANT_P => undef,
HAVE_KQUEUE => undef,
HAVE_LANGINFO_H => undef,