Mercurial > vim
changeset 26079:a60952e58e5d v8.2.3573
patch 8.2.3573: cannot decide whether to skip test that fails with 64 bit
Commit: https://github.com/vim/vim/commit/69b3072d984480935ec412b32b97fea974d2b689
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Nov 2 21:39:49 2021 +0000
patch 8.2.3573: cannot decide whether to skip test that fails with 64 bit
Problem: Cannot decide whether to skip test that fails with 64 bit ints.
(closes https://github.com/vim/vim/issues/9072)
Solution: Add v:sizeofint, v:sizeoflong and v:sizeofpointer. Improve the
check for multiply overflow.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 02 Nov 2021 22:45:04 +0100 |
parents | 42fae7319298 |
children | e335df170d4d |
files | src/evalvars.c src/register.c src/testdir/test_put.vim src/version.c src/vim.h |
diffstat | 5 files changed, 14 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/src/evalvars.c +++ b/src/evalvars.c @@ -150,6 +150,9 @@ static struct vimvar {VV_NAME("collate", VAR_STRING), VV_RO}, {VV_NAME("exiting", VAR_SPECIAL), VV_RO}, {VV_NAME("colornames", VAR_DICT), VV_RO}, + {VV_NAME("sizeofint", VAR_NUMBER), VV_RO}, + {VV_NAME("sizeoflong", VAR_NUMBER), VV_RO}, + {VV_NAME("sizeofpointer", VAR_NUMBER), VV_RO}, }; // shorthand @@ -234,6 +237,9 @@ evalvars_init(void) set_vim_var_nr(VV_NUMBERMAX, VARNUM_MAX); set_vim_var_nr(VV_NUMBERMIN, VARNUM_MIN); set_vim_var_nr(VV_NUMBERSIZE, sizeof(varnumber_T) * 8); + set_vim_var_nr(VV_SIZEOFINT, sizeof(int)); + set_vim_var_nr(VV_SIZEOFLONG, sizeof(long)); + set_vim_var_nr(VV_SIZEOFPOINTER, sizeof(char *)); set_vim_var_nr(VV_TYPE_NUMBER, VAR_TYPE_NUMBER); set_vim_var_nr(VV_TYPE_STRING, VAR_TYPE_STRING);
--- a/src/register.c +++ b/src/register.c @@ -2014,7 +2014,8 @@ do_put( long multlen = count * yanklen; totlen = multlen; - if (totlen != multlen) + if (totlen != multlen || totlen / count != yanklen + || totlen / yanklen != count) { emsg(_(e_resulting_text_too_long)); break;
--- a/src/testdir/test_put.vim +++ b/src/testdir/test_put.vim @@ -149,13 +149,6 @@ func Test_p_with_count_leaves_mark_at_en endfunc func Test_very_large_count() - " FIXME: should actually check if sizeof(int) == sizeof(long) - CheckNotMSWindows - - if v:numbersize != 64 - throw 'Skipped: only works with 64 bit numbers' - endif - new let @" = 'x' call assert_fails('norm 44444444444444p', 'E1240:')
--- a/src/version.c +++ b/src/version.c @@ -758,6 +758,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 3573, +/**/ 3572, /**/ 3571,
--- a/src/vim.h +++ b/src/vim.h @@ -2060,7 +2060,10 @@ typedef int sock_T; #define VV_COLLATE 97 #define VV_EXITING 98 #define VV_COLORNAMES 99 -#define VV_LEN 100 // number of v: vars +#define VV_SIZEOFINT 100 +#define VV_SIZEOFLONG 101 +#define VV_SIZEOFPOINTER 102 +#define VV_LEN 103 // number of v: vars // used for v_number in VAR_BOOL and VAR_SPECIAL #define VVAL_FALSE 0L // VAR_BOOL