summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2022-09-17 21:08:33 +0100
committerBram Moolenaar <Bram@vim.org>2022-09-17 21:08:33 +0100
commit73e28dcc6125f616cf1f2d56443d22428a79e434 (patch)
treebc26b3d1bb2e1675b7dae14b6c9cda1cd42c90d6 /src
parent1c3dd8ddcba63c1af5112e567215b3cec2de11d0 (diff)
patch 9.0.0491: no good reason to build without the float featurev9.0.0491
Problem: No good reason to build without the float feature. Solution: Remove configure check for float and "#ifdef FEAT_FLOAT".
Diffstat (limited to 'src')
-rwxr-xr-xsrc/auto/configure42
-rw-r--r--src/config.h.in1
-rw-r--r--src/configure.ac26
-rw-r--r--src/dict.c2
-rw-r--r--src/errors.h19
-rw-r--r--src/eval.c65
-rw-r--r--src/evalfunc.c65
-rw-r--r--src/ex_cmds.c22
-rw-r--r--src/feature.h5
-rw-r--r--src/float.c2
-rw-r--r--src/gui_gtk_x11.c2
-rw-r--r--src/gui_x11.c2
-rw-r--r--src/if_lua.c7
-rw-r--r--src/if_mzsch.c4
-rw-r--r--src/if_py_both.h6
-rw-r--r--src/if_ruby.c4
-rw-r--r--src/json.c25
-rw-r--r--src/list.c8
-rw-r--r--src/locale.c4
-rw-r--r--src/macros.h2
-rw-r--r--src/message_test.c2
-rw-r--r--src/os_mac_conv.c2
-rw-r--r--src/os_vms_conf.h1
-rw-r--r--src/profiler.c10
-rw-r--r--src/session.c2
-rw-r--r--src/strings.c22
-rw-r--r--src/structs.h2
-rw-r--r--src/syntax.c6
-rw-r--r--src/testdir/runtest.vim4
-rw-r--r--src/testdir/test_assert.vim28
-rw-r--r--src/testdir/test_blob.vim4
-rw-r--r--src/testdir/test_cscope.vim36
-rw-r--r--src/testdir/test_eval_stuff.vim18
-rw-r--r--src/testdir/test_execute_func.vim8
-rw-r--r--src/testdir/test_expr.vim244
-rw-r--r--src/testdir/test_float_func.vim1
-rw-r--r--src/testdir/test_functions.vim36
-rw-r--r--src/testdir/test_glob2regpat.vim6
-rw-r--r--src/testdir/test_json.vim56
-rw-r--r--src/testdir/test_listdict.vim34
-rw-r--r--src/testdir/test_lua.vim1
-rw-r--r--src/testdir/test_messages.vim8
-rw-r--r--src/testdir/test_method.vim1
-rw-r--r--src/testdir/test_perl.vim6
-rw-r--r--src/testdir/test_python2.vim5
-rw-r--r--src/testdir/test_python3.vim23
-rw-r--r--src/testdir/test_random.vim4
-rw-r--r--src/testdir/test_reltime.vim1
-rw-r--r--src/testdir/test_ruby.vim6
-rw-r--r--src/testdir/test_sort.vim57
-rw-r--r--src/testdir/test_substitute.vim2
-rw-r--r--src/testdir/test_terminal.vim4
-rw-r--r--src/testdir/test_true_false.vim5
-rw-r--r--src/testdir/test_user_func.vim8
-rw-r--r--src/testdir/test_vim9_assign.vim58
-rw-r--r--src/testdir/test_vim9_builtin.vim26
-rw-r--r--src/testdir/test_vim9_disassemble.vim74
-rw-r--r--src/testdir/test_vim9_expr.vim342
-rw-r--r--src/testdir/test_vimscript.vim152
-rw-r--r--src/testing.c2
-rw-r--r--src/time.c10
-rw-r--r--src/typval.c18
-rw-r--r--src/version.c6
-rw-r--r--src/vim9.h2
-rw-r--r--src/vim9compile.c4
-rw-r--r--src/vim9execute.c24
-rw-r--r--src/vim9expr.c2
-rw-r--r--src/vim9instr.c14
-rw-r--r--src/vim9type.c6
-rw-r--r--src/viminfo.c4
70 files changed, 600 insertions, 1110 deletions
diff --git a/src/auto/configure b/src/auto/configure
index 18836113be..8c770c8012 100755
--- a/src/auto/configure
+++ b/src/auto/configure
@@ -13379,48 +13379,6 @@ _ACEOF
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for strtod() and other floating point functions" >&5
-$as_echo_n "checking for strtod() and other floating point functions... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-#ifdef HAVE_MATH_H
-# include <math.h>
-#endif
-#if STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#endif
-
-int
-main ()
-{
-char *s; double d;
- d = strtod("1.1", &s);
- d = fabs(1.11);
- d = ceil(1.11);
- d = floor(1.11);
- d = log10(1.11);
- d = pow(1.11, 2.22);
- d = sqrt(1.11);
- d = sin(1.11);
- d = cos(1.11);
- d = atan(1.11);
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }; $as_echo "#define HAVE_FLOAT_FUNCS 1" >>confdefs.h
-
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for isinf()" >&5
$as_echo_n "checking for isinf()... " >&6; }
diff --git a/src/config.h.in b/src/config.h.in
index 5f0d6aef2a..875d9afd54 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -157,7 +157,6 @@
#undef HAVE_FCHDIR
#undef HAVE_FCHOWN
#undef HAVE_FCHMOD
-#undef HAVE_FLOAT_FUNCS
#undef HAVE_FSEEKO
#undef HAVE_FSYNC
#undef HAVE_FTRUNCATE
diff --git a/src/configure.ac b/src/configure.ac
index 76eb56327c..b688032d00 100644
--- a/src/configure.ac
+++ b/src/configure.ac
@@ -3952,32 +3952,8 @@ AC_LINK_IFELSE([AC_LANG_PROGRAM([
AC_MSG_RESULT(yes); AC_DEFINE(HAVE_NL_LANGINFO_CODESET),
AC_MSG_RESULT(no))
-dnl Need various functions for floating point support. Only enable
-dnl floating point when they are all present.
+dnl Floating point support may require the "m" library
AC_CHECK_LIB(m, strtod)
-AC_MSG_CHECKING([for strtod() and other floating point functions])
-AC_LINK_IFELSE([AC_LANG_PROGRAM([
-#ifdef HAVE_MATH_H
-# include <math.h>
-#endif
-#if STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#endif
-], [char *s; double d;
- d = strtod("1.1", &s);
- d = fabs(1.11);
- d = ceil(1.11);
- d = floor(1.11);
- d = log10(1.11);
- d = pow(1.11, 2.22);
- d = sqrt(1.11);
- d = sin(1.11);
- d = cos(1.11);
- d = atan(1.11);
- ])],
- AC_MSG_RESULT(yes); AC_DEFINE(HAVE_FLOAT_FUNCS),
- AC_MSG_RESULT(no))
dnl isinf() and isnan() need to include header files and may need -lm.
AC_MSG_CHECKING([for isinf()])
diff --git a/src/dict.c b/src/dict.c
index fa54c60c41..1cb3e89a8d 100644
--- a/src/dict.c
+++ b/src/dict.c
@@ -984,13 +984,11 @@ eval_dict(char_u **arg, typval_T *rettv, evalarg_T *evalarg, int literal)
}
if (evaluate)
{
-#ifdef FEAT_FLOAT
if (tvkey.v_type == VAR_FLOAT)
{
tvkey.vval.v_string = typval_tostring(&tvkey, TRUE);
tvkey.v_type = VAR_STRING;
}
-#endif
key = tv_get_string_buf_chk(&tvkey, buf);
if (key == NULL)
{
diff --git a/src/errors.h b/src/errors.h
index 944dc43c5d..e293876528 100644
--- a/src/errors.h
+++ b/src/errors.h
@@ -895,7 +895,7 @@ EXTERN char e_cannot_execute_shell_with_f_option[]
INIT(= N_("E360: Cannot execute shell with -f option"));
#endif
// E361 unused
-#if defined(FEAT_EVAL) && defined(FEAT_FLOAT)
+#if defined(FEAT_EVAL)
EXTERN char e_using_boolean_value_as_float[]
INIT(= N_("E362: Using a boolean value as a Float"));
#endif
@@ -2044,17 +2044,13 @@ EXTERN char e_cannot_use_percent_with_float[]
// xgettext:no-c-format
INIT(= N_("E804: Cannot use '%' with Float"));
#endif
-#ifdef FEAT_FLOAT
EXTERN char e_using_float_as_number[]
INIT(= N_("E805: Using a Float as a Number"));
EXTERN char e_using_float_as_string[]
INIT(= N_("E806: Using a Float as a String"));
-#endif
-#ifdef FEAT_FLOAT
EXTERN char e_expected_float_argument_for_printf[]
INIT(= N_("E807: Expected Float argument for printf()"));
-#endif
-#if defined(FEAT_EVAL) && defined(FEAT_FLOAT)
+#if defined(FEAT_EVAL)
EXTERN char e_number_or_float_required[]
INIT(= N_("E808: Number or Float required"));
#endif
@@ -2290,7 +2286,6 @@ EXTERN char e_number_required[]
EXTERN char e_trailing_char_after_rsb_str_str[]
INIT(= N_("E890: Trailing char after ']': %s]%s"));
#endif
-#ifdef FEAT_FLOAT
EXTERN char e_using_funcref_as_float[]
INIT(= N_("E891: Using a Funcref as a Float"));
EXTERN char e_using_string_as_float[]
@@ -2299,7 +2294,6 @@ EXTERN char e_using_list_as_float[]
INIT(= N_("E893: Using a List as a Float"));
EXTERN char e_using_dictionary_as_float[]
INIT(= N_("E894: Using a Dictionary as a Float"));
-#endif
#ifdef FEAT_MZSCHEME
EXTERN char e_sorry_this_command_is_disabled_the_mzscheme_racket_base_module_could_not_be_loaded[]
INIT(= N_("E895: Sorry, this command is disabled, the MzScheme's racket/base module could not be loaded."));
@@ -2340,10 +2334,8 @@ EXTERN char e_received_unknown_command_str[]
EXTERN char e_not_an_open_channel[]
INIT(= N_("E906: Not an open channel"));
#endif
-#ifdef FEAT_FLOAT
EXTERN char e_using_special_value_as_float[]
INIT(= N_("E907: Using a special value as a Float"));
-#endif
#ifdef FEAT_EVAL
EXTERN char e_using_invalid_value_as_string_str[]
INIT(= N_("E908: Using an invalid value as a String: %s"));
@@ -2537,10 +2529,8 @@ EXTERN char e_blob_literal_should_have_an_even_number_of_hex_characters[]
INIT(= N_("E973: Blob literal should have an even number of hex characters"));
EXTERN char e_using_blob_as_number[]
INIT(= N_("E974: Using a Blob as a Number"));
-# ifdef FEAT_FLOAT
EXTERN char e_using_blob_as_float[]
INIT(= N_("E975: Using a Blob as a Float"));
-# endif
EXTERN char e_using_blob_as_string[]
INIT(= N_("E976: Using a Blob as a String"));
EXTERN char e_can_only_compare_blob_with_blob[]
@@ -2775,10 +2765,7 @@ EXTERN char e_no_white_space_allowed_after_dot[]
INIT(= N_("E1074: No white space allowed after dot"));
EXTERN char e_namespace_not_supported_str[]
INIT(= N_("E1075: Namespace not supported: %s"));
-# ifndef FEAT_FLOAT
-EXTERN char e_this_vim_is_not_compiled_with_float_support[]
- INIT(= N_("E1076: This Vim is not compiled with float support"));
-# endif
+// E1076 was deleted
EXTERN char e_missing_argument_type_for_str[]
INIT(= N_("E1077: Missing argument type for %s"));
#endif
diff --git a/src/eval.c b/src/eval.c
index 3209d08dcc..948faa2ee5 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -525,9 +525,7 @@ typval2string(typval_T *tv, int convert)
{
garray_T ga;
char_u *retval;
-#ifdef FEAT_FLOAT
char_u numbuf[NUMBUFLEN];
-#endif
if (convert && tv->v_type == VAR_LIST)
{
@@ -541,13 +539,11 @@ typval2string(typval_T *tv, int convert)
ga_append(&ga, NUL);
retval = (char_u *)ga.ga_data;
}
-#ifdef FEAT_FLOAT
else if (convert && tv->v_type == VAR_FLOAT)
{
vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", tv->vval.v_float);
retval = vim_strsave(numbuf);
}
-#endif
else
retval = vim_strsave(tv_get_string(tv));
return retval;
@@ -1683,7 +1679,6 @@ tv_op(typval_T *tv1, typval_T *tv2, char_u *op)
{
// nr += nr , nr -= nr , nr *=nr , nr /= nr , nr %= nr
n = tv_get_number(tv1);
-#ifdef FEAT_FLOAT
if (tv2->v_type == VAR_FLOAT)
{
float_T f = n;
@@ -1702,7 +1697,6 @@ tv_op(typval_T *tv1, typval_T *tv2, char_u *op)
tv1->vval.v_float = f;
}
else
-#endif
{
switch (*op)
{
@@ -1734,7 +1728,6 @@ tv_op(typval_T *tv1, typval_T *tv2, char_u *op)
return failed ? FAIL : OK;
case VAR_FLOAT:
-#ifdef FEAT_FLOAT
{
float_T f;
@@ -1755,7 +1748,6 @@ tv_op(typval_T *tv1, typval_T *tv2, char_u *op)
case '/': tv1->vval.v_float /= f; break;
}
}
-#endif
return OK;
}
}
@@ -3238,9 +3230,7 @@ eval6(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
}
if ((op != '+' || (rettv->v_type != VAR_LIST
&& rettv->v_type != VAR_BLOB))
-#ifdef FEAT_FLOAT
&& (op == '.' || rettv->v_type != VAR_FLOAT)
-#endif
&& evaluate)
{
int error = FALSE;
@@ -3293,14 +3283,12 @@ eval6(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
|| var2.v_type == VAR_JOB))
semsg(_(e_using_invalid_value_as_string_str),
vartype_name(var2.v_type));
-#ifdef FEAT_FLOAT
else if (vim9script && var2.v_type == VAR_FLOAT)
{
vim_snprintf((char *)buf2, NUMBUFLEN, "%g",
var2.vval.v_float);
s2 = buf2;
}
-#endif
else
s2 = tv_get_string_buf_chk(&var2, buf2);
if (s2 == NULL) // type error ?
@@ -3327,8 +3315,7 @@ eval6(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
{
int error = FALSE;
varnumber_T n1, n2;
-#ifdef FEAT_FLOAT
- float_T f1 = 0, f2 = 0;
+ float_T f1 = 0, f2 = 0;
if (rettv->v_type == VAR_FLOAT)
{
@@ -3336,7 +3323,6 @@ eval6(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
n1 = 0;
}
else
-#endif
{
n1 = tv_get_number_chk(rettv, &error);
if (error)
@@ -3349,19 +3335,15 @@ eval6(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
clear_tv(&var2);
return FAIL;
}
-#ifdef FEAT_FLOAT
if (var2.v_type == VAR_FLOAT)
f1 = n1;
-#endif
}
-#ifdef FEAT_FLOAT
if (var2.v_type == VAR_FLOAT)
{
f2 = var2.vval.v_float;
n2 = 0;
}
else
-#endif
{
n2 = tv_get_number_chk(&var2, &error);
if (error)
@@ -3370,14 +3352,11 @@ eval6(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
clear_tv(&var2);
return FAIL;
}
-#ifdef FEAT_FLOAT
if (rettv->v_type == VAR_FLOAT)
f2 = n2;
-#endif
}
clear_tv(rettv);
-#ifdef FEAT_FLOAT
// If there is a float on either side the result is a float.
if (rettv->v_type == VAR_FLOAT || var2.v_type == VAR_FLOAT)
{
@@ -3389,7 +3368,6 @@ eval6(char_u **arg, typval_T *rettv, evalarg_T *evalarg)
rettv->vval.v_float = f1;
}
else
-#endif
{
if (op == '+')
n1 = n1 + n2;
@@ -3423,9 +3401,7 @@ eval7(
evalarg_T *evalarg,
int want_string) // after "." operator
{
-#ifdef FEAT_FLOAT
int use_float = FALSE;
-#endif
/*
* Get the first expression.
@@ -3444,9 +3420,7 @@ eval7(
char_u *p;
int op;
varnumber_T n1, n2;
-#ifdef FEAT_FLOAT
float_T f1, f2;
-#endif
int error;
// "*=", "/=" and "%=" are assignments
@@ -3469,14 +3443,11 @@ eval7(
*arg = p;
}
-#ifdef FEAT_FLOAT
f1 = 0;
f2 = 0;
-#endif
error = FALSE;
if (evaluate)
{
-#ifdef FEAT_FLOAT
if (rettv->v_type == VAR_FLOAT)
{
f1 = rettv->vval.v_float;
@@ -3484,7 +3455,6 @@ eval7(
n1 = 0;
}
else
-#endif
n1 = tv_get_number_chk(rettv, &error);
clear_tv(rettv);
if (error)
@@ -3508,7 +3478,6 @@ eval7(
if (evaluate)
{
-#ifdef FEAT_FLOAT
if (var2.v_type == VAR_FLOAT)
{
if (!use_float)
@@ -3520,30 +3489,26 @@ eval7(
n2 = 0;
}
else
-#endif
{
n2 = tv_get_number_chk(&var2, &error);
clear_tv(&var2);
if (error)
return FAIL;
-#ifdef FEAT_FLOAT
if (use_float)
f2 = n2;
-#endif
}
/*
* Compute the result.
* When either side is a float the result is a float.
*/
-#ifdef FEAT_FLOAT
if (use_float)
{
if (op == '*')
f1 = f1 * f2;
else if (op == '/')
{
-# ifdef VMS
+#ifdef VMS
// VMS crashes on divide by zero, work around it
if (f2 == 0.0)
{
@@ -3556,11 +3521,11 @@ eval7(
}
else
f1 = f1 / f2;
-# else
+#else
// We rely on the floating point library to handle divide
// by zero to result in "inf" and not a crash.
f1 = f1 / f2;
-# endif
+#endif
}
else
{
@@ -3571,7 +3536,6 @@ eval7(
rettv->vval.v_float = f1;
}
else
-#endif
{
int failed = FALSE;
@@ -3858,11 +3822,7 @@ eval9(
return FAIL;
end_leader = *arg;
- if (**arg == '.' && (!isdigit(*(*arg + 1))
-#ifdef FEAT_FLOAT
- || in_old_script(2)
-#endif
- ))
+ if (**arg == '.' && (!isdigit(*(*arg + 1)) || in_old_script(2)))
{
semsg(_(e_invalid_expression_str), *arg);
++*arg;
@@ -4129,13 +4089,11 @@ eval9_leader(
varnumber_T val = 0;
vartype_T type = rettv->v_type;
int vim9script = in_vim9script();
-#ifdef FEAT_FLOAT
float_T f = 0.0;
if (rettv->v_type == VAR_FLOAT)
f = rettv->vval.v_float;
else
-#endif
{
while (VIM_ISWHITE(end_leader[-1]))
--end_leader;
@@ -4161,7 +4119,6 @@ eval9_leader(
++end_leader;
break;
}
-#ifdef FEAT_FLOAT
if (rettv->v_type == VAR_FLOAT)
{
if (vim9script)
@@ -4173,7 +4130,6 @@ eval9_leader(
f = !f;
}
else
-#endif
{
val = !val;
type = VAR_BOOL;
@@ -4181,25 +4137,21 @@ eval9_leader(
}
else if (*end_leader == '-')
{
-#ifdef FEAT_FLOAT
if (rettv->v_type == VAR_FLOAT)
f = -f;
else
-#endif
{
val = -val;
type = VAR_NUMBER;
}
}
}
-#ifdef FEAT_FLOAT
if (rettv->v_type == VAR_FLOAT)
{
clear_tv(rettv);
rettv->vval.v_float = f;
}
else
-#endif
{
clear_tv(rettv);
if (vim9script)
@@ -4500,7 +4452,6 @@ eval_index(
{
int error = FALSE;
-#ifdef FEAT_FLOAT
// allow for indexing with float
if (vim9script && rettv->v_type == VAR_DICT
&& var1.v_type == VAR_FLOAT)
@@ -4508,7 +4459,7 @@ eval_index(
var1.vval.v_string = typval_tostring(&var1, TRUE);
var1.v_type = VAR_STRING;
}
-#endif
+
if (vim9script && rettv->v_type == VAR_LIST)
tv_get_number_chk(&var1, &error);
else
@@ -4599,11 +4550,9 @@ check_can_index(typval_T *rettv, int evaluate, int verbose)
emsg(_(e_cannot_index_a_funcref));
return FAIL;
case VAR_FLOAT:
-#ifdef FEAT_FLOAT
if (verbose)
emsg(_(e_using_float_as_string));
return FAIL;
-#endif
case VAR_BOOL:
case VAR_SPECIAL:
case VAR_JOB:
@@ -5696,12 +5645,10 @@ echo_string_core(
break;
case VAR_FLOAT:
-#ifdef FEAT_FLOAT
*tofree = NULL;
vim_snprintf((char *)numbuf, NUMBUFLEN, "%g", tv->vval.v_float);
r = numbuf;
break;
-#endif
case VAR_BOOL:
case VAR_SPECIAL:
diff --git a/src/evalfunc.c b/src/evalfunc.c
index cab3213469..f808d19706 100644
--- a/src/evalfunc.c
+++ b/src/evalfunc.c
@@ -1512,12 +1512,7 @@ typedef struct
#define FEARG_3 3 // base is the third argument
#define FEARG_4 4 // base is the fourth argument
-#ifdef FEAT_FLOAT
-# define FLOAT_FUNC(name) name
-#else
-# define FLOAT_FUNC(name) NULL
-#endif
-#if defined(FEAT_FLOAT) && defined(HAVE_MATH_H)
+#if defined(HAVE_MATH_H)
# define MATH_FUNC(name) name
#else
# define MATH_FUNC(name) NULL
@@ -1556,9 +1551,9 @@ typedef struct
static funcentry_T global_functions[] =
{
{"abs", 1, 1, FEARG_1, arg1_float_or_nr,
- ret_any, FLOAT_FUNC(f_abs)},
+ ret_any, f_abs},
{"acos", 1, 1, FEARG_1, arg1_float_or_nr,
- ret_float, FLOAT_FUNC(f_acos)},
+ ret_float, f_acos},
{"add", 2, 2, FEARG_1, arg2_listblob_item,
ret_first_arg, f_add},
{"and", 2, 2, FEARG_1, arg2_number,
@@ -1576,7 +1571,7 @@ static funcentry_T global_functions[] =
{"argv", 0, 2, 0, arg2_number,
ret_argv, f_argv},
{"asin", 1, 1, FEARG_1, arg1_float_or_nr,
- ret_float, FLOAT_FUNC(f_asin)},
+ ret_float, f_asin},
{"assert_beeps", 1, 1, FEARG_1, arg1_string,
ret_number_bool, f_assert_beeps},
{"assert_equal", 2, 3, FEARG_2, NULL,
@@ -1604,9 +1599,9 @@ static funcentry_T g