On Mon, Feb 1, 2016 at 2:38 PM, Michael Paquier <michael.paqu...@gmail.com> wrote: > Actually, is there actually a reason to keep this file in the code > tree? Are there platforms that do not have isinf()? Even for Windows > environments using MSVC < 1800 this is emulated using _fpclass.
Looking at what is in the buildfarm, I noticed that isinf is provided everywhere. Attached is a patch. Thoughts? -- Michael
diff --git a/configure b/configure index 3dd1b15..c9dd5b8 100755 --- a/configure +++ b/configure @@ -12633,63 +12633,6 @@ cat >>confdefs.h <<_ACEOF _ACEOF - -{ $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" "crypt" "ac_cv_func_crypt" if test "x$ac_cv_func_crypt" = xyes; then : $as_echo "#define HAVE_CRYPT 1" >>confdefs.h diff --git a/configure.in b/configure.in index 9398482..5c75fea 100644 --- a/configure.in +++ b/configure.in @@ -1502,25 +1502,6 @@ fi AC_CHECK_DECLS([snprintf, vsnprintf]) - -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([crypt fls getopt getrusage inet_aton mkdtemp random rint srandom strerror strlcat strlcpy]) case $host_os in diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index 16a272e..deac60e 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -276,9 +276,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 you have the <langinfo.h> header file. */ #undef HAVE_LANGINFO_H diff --git a/src/include/pg_config.h.win32 b/src/include/pg_config.h.win32 index 8566065..52cfbce 100644 --- a/src/include/pg_config.h.win32 +++ b/src/include/pg_config.h.win32 @@ -187,9 +187,6 @@ /* Define to 1 if you have support for IPv6. */ #define HAVE_IPV6 1 -/* Define to 1 if you have isinf(). */ -#define HAVE_ISINF 1 - /* Define to 1 if you have the <langinfo.h> header file. */ /* #undef HAVE_LANGINFO_H */ diff --git a/src/include/port.h b/src/include/port.h index 9fc79f4..e908340 100644 --- a/src/include/port.h +++ b/src/include/port.h @@ -374,10 +374,6 @@ extern int fls(int mask); extern int getpeereid(int sock, uid_t *uid, gid_t *gid); #endif -#ifndef HAVE_ISINF -extern int isinf(double x); -#endif - #ifndef HAVE_MKDTEMP extern char *mkdtemp(char *path); #endif diff --git a/src/interfaces/ecpg/ecpglib/.gitignore b/src/interfaces/ecpg/ecpglib/.gitignore index 8ef6401..e23e8f0 100644 --- a/src/interfaces/ecpg/ecpglib/.gitignore +++ b/src/interfaces/ecpg/ecpglib/.gitignore @@ -7,4 +7,3 @@ /strlcpy.c /thread.c /win32setlocale.c -/isinf.c diff --git a/src/interfaces/ecpg/ecpglib/Makefile b/src/interfaces/ecpg/ecpglib/Makefile index 39c4232..a27db67 100644 --- a/src/interfaces/ecpg/ecpglib/Makefile +++ b/src/interfaces/ecpg/ecpglib/Makefile @@ -27,7 +27,7 @@ LIBS := $(filter-out -lpgport, $(LIBS)) OBJS= execute.o typename.o descriptor.o sqlda.o data.o error.o prepare.o memory.o \ connect.o misc.o path.o pgstrcasecmp.o \ - $(filter snprintf.o strlcpy.o win32setlocale.o isinf.o, $(LIBOBJS)) $(WIN32RES) + $(filter snprintf.o strlcpy.o win32setlocale.o, $(LIBOBJS)) $(WIN32RES) # thread.c is needed only for non-WIN32 implementation of path.c ifneq ($(PORTNAME), win32) @@ -55,7 +55,7 @@ include $(top_srcdir)/src/Makefile.shlib # necessarily use the same object files as the backend uses. Instead, # symlink the source files in here and build our own object file. -path.c pgstrcasecmp.c snprintf.c strlcpy.c thread.c win32setlocale.c isinf.c: % : $(top_srcdir)/src/port/% +path.c pgstrcasecmp.c snprintf.c strlcpy.c thread.c win32setlocale.c: % : $(top_srcdir)/src/port/% rm -f $@ && $(LN_S) $< . misc.o: misc.c $(top_builddir)/src/port/pg_config_paths.h diff --git a/src/port/isinf.c b/src/port/isinf.c deleted file mode 100644 index 7e8aabc..0000000 --- a/src/port/isinf.c +++ /dev/null @@ -1,77 +0,0 @@ -/*------------------------------------------------------------------------- - * - * isinf.c - * - * Portions Copyright (c) 1996-2016, 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(x) -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
-- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers