From 38ee6b041e73ad31c3b6b99d56d20833b59b2b57 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 12 Jul 2016 21:11:33 +0200 Subject: [PATCH 1/3] patch 7.4.2029 Problem: printf() does not work with 64 bit numbers. Solution: use the "L" length modifier. (Ken Takata) --- src/message.c | 9 +++++++++ src/testdir/test_expr.vim | 6 ++++++ src/version.c | 2 ++ 3 files changed, 17 insertions(+) diff --git a/src/message.c b/src/message.c index 7bb154d2e9..954152850c 100644 --- a/src/message.c +++ b/src/message.c @@ -4198,6 +4198,15 @@ vim_vsnprintf( default: break; } +# if defined(FEAT_EVAL) && defined(FEAT_NUM64) + switch (fmt_spec) + { + case 'd': case 'u': case 'o': case 'x': case 'X': + if (tvs != NULL && length_modifier == '\0') + length_modifier = 'L'; + } +# endif + /* get parameter value, do initial processing */ switch (fmt_spec) { diff --git a/src/testdir/test_expr.vim b/src/testdir/test_expr.vim index 067dbf24f6..86c86c58d5 100644 --- a/src/testdir/test_expr.vim +++ b/src/testdir/test_expr.vim @@ -129,3 +129,9 @@ func Test_option_value() call assert_equal("abcdefgi", &cpo) set cpo&vim endfunc + +function Test_printf_64bit() + if has('num64') + call assert_equal("123456789012345", printf('%d', 123456789012345)) + endif +endfunc diff --git a/src/version.c b/src/version.c index 6d75f76f1d..301b406d27 100644 --- 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 */ +/**/ + 2029, /**/ 2028, /**/ From e048539195e1c0a060cf41b39fca118130bdc151 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 12 Jul 2016 21:17:03 +0200 Subject: [PATCH 2/3] patch 7.4.2030 Problem: ARCH must be set properly when using MinGW. Solution: Detect the default value of ARCH from the current compiler. (Ken Takata) --- src/Make_cyg_ming.mak | 74 ++++++++++++++++++++++++------------------- src/version.c | 2 ++ 2 files changed, 44 insertions(+), 32 deletions(-) diff --git a/src/Make_cyg_ming.mak b/src/Make_cyg_ming.mak index e0638abb9b..9bc24195fe 100644 --- a/src/Make_cyg_ming.mak +++ b/src/Make_cyg_ming.mak @@ -42,7 +42,8 @@ DIRECTX=no FEATURES=HUGE # Set to one of i386, i486, i586, i686 as the minimum target processor. # For amd64/x64 architecture set ARCH=x86-64 . -ARCH=i686 +# If not set, it will be automatically detected. (Normally i686 or x86-64.) +#ARCH=i686 # Set to yes to cross-compile from unix; no=native Windows (and Cygwin). CROSS=no # Set to path to iconv.h and libiconv.a to enable using 'iconv.dll'. @@ -112,6 +113,46 @@ INTLLIB=gnu_gettext #INTLPATH=$(GETTEXT)/lib #INTLLIB=intl + +# Command definitions (depends on cross-compiling and shell) +ifeq ($(CROSS),yes) +# cross-compiler prefix: +ifndef CROSS_COMPILE +CROSS_COMPILE = i586-pc-mingw32msvc- +endif +DEL = rm +MKDIR = mkdir -p +DIRSLASH = / +else +# normal (Windows) compilation: +ifndef CROSS_COMPILE +CROSS_COMPILE = +endif +ifneq (sh.exe, $(SHELL)) +DEL = rm +MKDIR = mkdir -p +DIRSLASH = / +else +DEL = del +MKDIR = mkdir +DIRSLASH = \\ +endif +endif +CC := $(CROSS_COMPILE)gcc +CXX := $(CROSS_COMPILE)g++ +ifeq ($(UNDER_CYGWIN),yes) +WINDRES := $(CROSS_COMPILE)windres +else +WINDRES := windres +endif +WINDRES_CC = $(CC) + +# Get the default ARCH. +ifndef ARCH +ARCH := $(shell $(CC) -dumpmachine | sed -e 's/-.*//') +endif + + # Perl interface: # PERL=[Path to Perl directory] (Set inside Make_cyg.mak or Make_ming.mak) # DYNAMIC_PERL=yes (to load the Perl DLL dynamically) @@ -383,37 +424,6 @@ DEFINES=-DWIN32 -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \ ifeq ($(ARCH),x86-64) DEFINES+=-DMS_WIN64 endif -ifeq ($(CROSS),yes) -# cross-compiler prefix: -ifndef CROSS_COMPILE -CROSS_COMPILE = i586-pc-mingw32msvc- -endif -DEL = rm -MKDIR = mkdir -p -DIRSLASH = / -else -# normal (Windows) compilation: -ifndef CROSS_COMPILE -CROSS_COMPILE = -endif -ifneq (sh.exe, $(SHELL)) -DEL = rm -MKDIR = mkdir -p -DIRSLASH = / -else -DEL = del -MKDIR = mkdir -DIRSLASH = \\ -endif -endif -CC := $(CROSS_COMPILE)gcc -CXX := $(CROSS_COMPILE)g++ -ifeq ($(UNDER_CYGWIN),yes) -WINDRES := $(CROSS_COMPILE)windres -else -WINDRES := windres -endif -WINDRES_CC = $(CC) #>>>>> end of choices ########################################################################### diff --git a/src/version.c b/src/version.c index 301b406d27..1765e93aa3 100644 --- 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 */ +/**/ + 2030, /**/ 2029, /**/ From 89b10421ca1aea55acbafac1df93be4e20210ceb Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Tue, 12 Jul 2016 22:51:22 +0200 Subject: [PATCH 3/3] patch 7.4.2031 Problem: The list_lbr_utf8 test fails if ~/.vim/syntax/c.vim sets 'textwidth' to a non-zero value. (Oyvind A. Holm) Solution: Add a setup.vim file that sets 'runtimepath' and $HOME to a safe value. (partly by Christian Brabandt, closes #912) --- src/testdir/amiga.vim | 2 ++ src/testdir/dos.vim | 2 ++ src/testdir/runtest.vim | 6 +++--- src/testdir/setup.vim | 11 +++++++++++ src/testdir/unix.vim | 2 ++ src/testdir/vms.vim | 4 +++- src/version.c | 2 ++ 7 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 src/testdir/setup.vim diff --git a/src/testdir/amiga.vim b/src/testdir/amiga.vim index e0ca47a8ed..79956d7d94 100644 --- a/src/testdir/amiga.vim +++ b/src/testdir/amiga.vim @@ -2,3 +2,5 @@ set shell=csh map! /tmp t: cmap !rm !Delete all + +source setup.vim diff --git a/src/testdir/dos.vim b/src/testdir/dos.vim index 27764db9d9..3ea6ab2a6d 100644 --- a/src/testdir/dos.vim +++ b/src/testdir/dos.vim @@ -5,3 +5,5 @@ set shell=c:\COMMAND.COM shellquote= shellxquote= shellcmdflag=/c shellredir=> if executable("cmd.exe") set shell=cmd.exe endif + +source setup.vim diff --git a/src/testdir/runtest.vim b/src/testdir/runtest.vim index c094da0317..559d5f875a 100644 --- a/src/testdir/runtest.vim +++ b/src/testdir/runtest.vim @@ -42,6 +42,9 @@ if &lines < 24 || &columns < 80 cquit endif +" Common with all tests on all systems. +source setup.vim + " For consistency run all tests with 'nocompatible' set. " This also enables use of line continuation. set nocp viminfo+=nviminfo @@ -55,9 +58,6 @@ lang mess C " Always use forward slashes. set shellslash -" Make sure $HOME does not get read or written. -let $HOME = '/does/not/exist' - let s:srcdir = expand('%:p:h:h') " Prepare for calling test_garbagecollect_now(). diff --git a/src/testdir/setup.vim b/src/testdir/setup.vim new file mode 100644 index 0000000000..f7e475a81a --- /dev/null +++ b/src/testdir/setup.vim @@ -0,0 +1,11 @@ +" Common preparations for running tests. + +" Make sure 'runtimepath' does not include $HOME. +set rtp=$VIM/vimfiles,$VIMRUNTIME,$VIM/vimfiles/after + +" Only when the +eval feature is present. +if 1 + " Make sure $HOME does not get read or written. + let $HOME = '/does/not/exist' +endif + diff --git a/src/testdir/unix.vim b/src/testdir/unix.vim index f766e74c30..36dd4e1e3b 100644 --- a/src/testdir/unix.vim +++ b/src/testdir/unix.vim @@ -1,3 +1,5 @@ " Settings for test script execution " Always use "sh", don't use the value of "$SHELL". set shell=sh + +source setup.vim diff --git a/src/testdir/vms.vim b/src/testdir/vms.vim index 3305a77c23..64b390e285 100644 --- a/src/testdir/vms.vim +++ b/src/testdir/vms.vim @@ -1,4 +1,6 @@ " Settings for test script execution under OpenVMS -" Do not make any swap files +" Do not use any swap files set noswapfile + +source setup.vim diff --git a/src/version.c b/src/version.c index 1765e93aa3..002c1f804e 100644 --- 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 */ +/**/ + 2031, /**/ 2030, /**/