aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-04-26 22:47:12 -0400
committerJan Edmund Lazo <jan.lazo@mail.utoronto.ca>2021-04-27 09:21:35 -0400
commit25c0675fe343aa20e05c6cb26c2529d9dd9ac748 (patch)
treec9e976ec68dff373fe42847e7b747e89519fc3c0
parente257aff016edc1d240d66c86e84e1f10ad972fd1 (diff)
downloadrneovim-25c0675fe343aa20e05c6cb26c2529d9dd9ac748.tar.gz
rneovim-25c0675fe343aa20e05c6cb26c2529d9dd9ac748.tar.bz2
rneovim-25c0675fe343aa20e05c6cb26c2529d9dd9ac748.zip
vim-patch:8.2.0296: mixing up "long long" and __int64 may cause problems
Problem: Mixing up "long long" and __int64 may cause problems. (John Marriott) Solution: Pass varnumber_T to vim_snprintf(). Add v:numbersize. https://github.com/vim/vim/commit/f9706e9df0e37d214fb08eda30ba29627e97a607
-rw-r--r--runtime/doc/eval.txt5
-rw-r--r--src/nvim/eval.c2
-rw-r--r--src/nvim/eval.h1
-rw-r--r--src/nvim/testdir/test_eval_stuff.vim6
4 files changed, 14 insertions, 0 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index c907e23a62..459e3ed2d2 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -19,6 +19,7 @@ There are six types of variables:
*Number* *Integer*
Number A 32 or 64 bit signed number. |expr-number|
+ The number of bits is available in |v:numbersize|.
Examples: -123 0x10 0177 0b1011
Float A floating point number. |floating-point-format| *Float*
@@ -1793,6 +1794,10 @@ v:null Special value used to put "null" in JSON and NIL in msgpack.
operator) and to zero when used as a Number (e.g. in |expr5|
or |expr7| when used with numeric operators). Read-only.
+ *v:numbersize* *numbersize-variable*
+v:numbersize Number of bits in a Number. This is normally 64, but on some
+ systems it may be 32.
+
*v:oldfiles* *oldfiles-variable*
v:oldfiles List of file names that is loaded from the |shada| file on
startup. These are the files that Vim remembers marks for.
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 05d429c7d5..ce8850b903 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -213,6 +213,7 @@ static struct vimvar {
VV(VV_FALSE, "false", VAR_BOOL, VV_RO),
VV(VV_TRUE, "true", VAR_BOOL, VV_RO),
VV(VV_NULL, "null", VAR_SPECIAL, VV_RO),
+ VV(VV_NUMBERSIZE, "numbersize", VAR_NUMBER, VV_RO),
VV(VV_VIM_DID_ENTER, "vim_did_enter", VAR_NUMBER, VV_RO),
VV(VV_TESTING, "testing", VAR_NUMBER, 0),
VV(VV_TYPE_NUMBER, "t_number", VAR_NUMBER, VV_RO),
@@ -394,6 +395,7 @@ void eval_init(void)
set_vim_var_bool(VV_FALSE, kBoolVarFalse);
set_vim_var_bool(VV_TRUE, kBoolVarTrue);
set_vim_var_special(VV_NULL, kSpecialVarNull);
+ set_vim_var_nr(VV_NUMBERSIZE, sizeof(varnumber_T) * 8);
set_vim_var_special(VV_EXITING, kSpecialVarNull);
set_vim_var_nr(VV_ECHOSPACE, sc_col - 1);
diff --git a/src/nvim/eval.h b/src/nvim/eval.h
index 3da4bb8655..88c629f15d 100644
--- a/src/nvim/eval.h
+++ b/src/nvim/eval.h
@@ -142,6 +142,7 @@ typedef enum {
VV_FALSE,
VV_TRUE,
VV_NULL,
+ VV_NUMBERSIZE,
VV_VIM_DID_ENTER,
VV_TESTING,
VV_TYPE_NUMBER,
diff --git a/src/nvim/testdir/test_eval_stuff.vim b/src/nvim/testdir/test_eval_stuff.vim
index 73b57f302e..b667086482 100644
--- a/src/nvim/testdir/test_eval_stuff.vim
+++ b/src/nvim/testdir/test_eval_stuff.vim
@@ -120,6 +120,12 @@ func Test_skip_after_throw()
endtry
endfunc
+func Test_numbersize()
+ " This will fail on systems without 64 bit int support or when not configured
+ " correctly.
+ call assert_equal(64, v:numbersize)
+endfunc
+
func Test_curly_assignment()
let s:svar = 'svar'
let g:gvar = 'gvar'