summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-02-27 20:14:15 +0100
committerBram Moolenaar <Bram@vim.org>2016-02-27 20:14:15 +0100
commit136f29a91dbafce424e31a4af133155f997e8f78 (patch)
treec8f62de847e195719732366ec05df2f21f74f000
parente98991b8cfaf29016d14b8ec437d3dedfc0a5eb7 (diff)
downloadvim-git-136f29a91dbafce424e31a4af133155f997e8f78.tar.gz
patch 7.4.1437v7.4.1437
Problem: Old system doesn't have isinf() and NAN. (Ben Fritz) Solution: Adjust #ifdefs. Detect isnan() and isinf() functions with configure. Use a replacement when missing. (Kazunobu Kuriyama)
-rwxr-xr-xsrc/auto/configure44
-rw-r--r--src/config.h.in9
-rw-r--r--src/configure.in3
-rw-r--r--src/eval.c10
-rw-r--r--src/json.c18
-rw-r--r--src/macros.h29
-rw-r--r--src/message.c4
-rw-r--r--src/version.c2
8 files changed, 85 insertions, 34 deletions
diff --git a/src/auto/configure b/src/auto/configure
index 861fe4d94..08af402b8 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -10978,6 +10978,48 @@ $as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;;
esac
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
+$as_echo_n "checking for inline... " >&6; }
+if ${ac_cv_c_inline+:} false; then :
+ $as_echo_n "(cached) " >&6
+else
+ ac_cv_c_inline=no
+for ac_kw in inline __inline__ __inline; do
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+#ifndef __cplusplus
+typedef int foo_t;
+static $ac_kw foo_t static_foo () {return 0; }
+$ac_kw foo_t foo () {return 0; }
+#endif
+
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+ ac_cv_c_inline=$ac_kw
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ test "$ac_cv_c_inline" != no && break
+done
+
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
+$as_echo "$ac_cv_c_inline" >&6; }
+
+case $ac_cv_c_inline in
+ inline | yes) ;;
+ *)
+ case $ac_cv_c_inline in
+ no) ac_val=;;
+ *) ac_val=$ac_cv_c_inline;;
+ esac
+ cat >>confdefs.h <<_ACEOF
+#ifndef __cplusplus
+#define inline $ac_val
+#endif
+_ACEOF
+ ;;
+esac
+
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for rlim_t" >&5
$as_echo_n "checking for rlim_t... " >&6; }
@@ -11816,7 +11858,7 @@ for ac_func in bcmp fchdir fchown fsync getcwd getpseudotty \
setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
sigvec strcasecmp strerror strftime stricmp strncasecmp \
strnicmp strpbrk strtol tgetent towlower towupper iswupper \
- usleep utime utimes
+ usleep utime utimes isnan isinf
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"
diff --git a/src/config.h.in b/src/config.h.in
index dc0e9b2ad..f8475a14f 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -460,3 +460,12 @@
/* Define if GTK+ GUI is to be linked against GTK+ 3 */
#undef USE_GTK3
+
+/* Define if we have isinf() */
+#undef HAVE_ISINF
+
+/* Define if we have isnan() */
+#undef HAVE_ISNAN
+
+/* Define to inline symbol or empty */
+#undef inline
diff --git a/src/configure.in b/src/configure.in
index fbfa37fe6..c809427f9 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -3146,6 +3146,7 @@ AC_HEADER_TIME
AC_CHECK_TYPE(ino_t, long)
AC_CHECK_TYPE(dev_t, unsigned)
AC_C_BIGENDIAN(,,,)
+AC_C_INLINE
AC_MSG_CHECKING(for rlim_t)
if eval "test \"`echo '$''{'ac_cv_type_rlim_t'+set}'`\" = set"; then
@@ -3564,7 +3565,7 @@ AC_CHECK_FUNCS(bcmp fchdir fchown fsync getcwd getpseudotty \
setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
sigvec strcasecmp strerror strftime stricmp strncasecmp \
strnicmp strpbrk strtol tgetent towlower towupper iswupper \
- usleep utime utimes)
+ usleep utime utimes isnan isinf)
AC_FUNC_FSEEKO
dnl define _LARGE_FILES, _FILE_OFFSET_BITS and _LARGEFILE_SOURCE when
diff --git a/src/eval.c b/src/eval.c
index 323caf1e5..6e018c404 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -27,16 +27,6 @@
# include <time.h> /* for time_t */
#endif
-#if defined(FEAT_FLOAT)
-# include <float.h>
-# if defined(HAVE_MATH_H)
-# include <math.h>
-# endif
-# if defined(WIN32) && !defined(isnan)
-# define isnan(x) _isnan(x)
-# endif
-#endif
-
#define DICT_MAXNEST 100 /* maximum nesting of lists and dicts */
#define DO_NOT_FREE_CNT 99999 /* refcount for dict or list that should not
diff --git a/src/json.c b/src/json.c
index da585e306..a704fd5eb 100644
--- a/src/json.c
+++ b/src/json.c
@@ -17,24 +17,6 @@
#if defined(FEAT_EVAL) || defined(PROTO)
-#if defined(FEAT_FLOAT)
-# include <float.h>
-# if defined(HAVE_MATH_H)
- /* for isnan() and isinf() */
-# include <math.h>
-# endif
-# if defined(WIN32) && !defined(isnan)
-# define isnan(x) _isnan(x)
-# define isinf(x) (!_finite(x) && !_isnan(x))
-# endif
-# if !defined(INFINITY) && defined(DBL_MAX)
-# define INFINITY (DBL_MAX+DBL_MAX)
-# endif
-# if !defined(NAN) && defined(INFINITY)
-# define NAN (INFINITY-INFINITY)
-# endif
-#endif
-
static int json_encode_item(garray_T *gap, typval_T *val, int copyID, int options);
static int json_decode_item(js_read_T *reader, typval_T *res, int options);
diff --git a/src/macros.h b/src/macros.h
index 6e2c94ff1..464eb66a1 100644
--- a/src/macros.h
+++ b/src/macros.h
@@ -320,3 +320,32 @@
#if defined(FEAT_CHANNEL) || defined(FEAT_JOB) || defined(FEAT_CLIENTSERVER)
# define MESSAGE_QUEUE
#endif
+
+#if defined(FEAT_EVAL) && defined(FEAT_FLOAT)
+# include <float.h>
+# if defined(HAVE_MATH_H)
+ /* for isnan() and isinf() */
+# include <math.h>
+# endif
+# if defined(WIN32) && !defined(isnan)
+# define isnan(x) _isnan(x)
+# define isinf(x) (!_finite(x) && !_isnan(x))
+# else
+# ifndef HAVE_ISNAN
+ static inline int isnan(double x) { return x != x; }
+# endif
+# ifndef HAVE_ISINF
+ static inline int isinf(double x) { return !isnan(x) && isnan(x - x); }
+# endif
+# endif
+# if !defined(INFINITY)
+# if defined(DBL_MAX)
+# define INFINITY (DBL_MAX+DBL_MAX)
+# else
+# define INFINITY (1.0 / 0.0)
+# endif
+# endif
+# if !defined(NAN)
+# define NAN (INFINITY-INFINITY)
+# endif
+#endif
diff --git a/src/message.c b/src/message.c
index 6c9dd646c..689a79cd4 100644
--- a/src/message.c
+++ b/src/message.c
@@ -15,10 +15,6 @@
#include "vim.h"
-#if defined(FEAT_FLOAT) && defined(HAVE_MATH_H)
-# include <math.h>
-#endif
-
static int other_sourcing_name(void);
static char_u *get_emsg_source(void);
static char_u *get_emsg_lnum(void);
diff --git a/src/version.c b/src/version.c
index 60a6badd2..ab7cf743c 100644
--- a/src/version.c
+++ b/src/version.c
@@ -744,6 +744,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1437,
+/**/
1436,
/**/
1435,