Skip to content

Commit e9d4140

Browse files
committed
Merge remote-tracking branch 'vim/master'
2 parents d235206 + 6e48b84 commit e9d4140

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+3057
-2374
lines changed

.github/workflows/coverity.yml

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
name: Coverity
2+
on:
3+
schedule:
4+
- cron: '42 0 * * *' # Run once per day, to avoid Coverity's submission limits
5+
workflow_dispatch:
6+
7+
jobs:
8+
scan:
9+
runs-on: ubuntu-18.04
10+
11+
env:
12+
CC: gcc
13+
DEBIAN_FRONTEND: noninteractive
14+
15+
steps:
16+
- uses: actions/checkout@v2
17+
18+
- name: Download Coverity
19+
run: |
20+
wget -q https://scan.coverity.com/download/cxx/linux64 --post-data "token=$TOKEN&project=vim" -O coverity_tool.tgz
21+
mkdir cov-scan
22+
tar ax -f coverity_tool.tgz --strip-components=1 -C cov-scan
23+
env:
24+
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
25+
26+
- name: Install packages
27+
run: |
28+
sudo apt update && sudo apt install -y \
29+
autoconf \
30+
gettext \
31+
libcanberra-dev \
32+
libperl-dev \
33+
python-dev \
34+
python3-dev \
35+
liblua5.3-dev \
36+
lua5.3 \
37+
ruby-dev \
38+
tcl-dev \
39+
libgtk2.0-dev \
40+
desktop-file-utils \
41+
libtool-bin \
42+
libsodium-dev
43+
44+
- name: Set up environment
45+
run: |
46+
echo "$(pwd)/cov-scan/bin" >> $GITHUB_PATH
47+
(
48+
echo "NPROC=$(getconf _NPROCESSORS_ONLN)"
49+
echo "CONFOPT=--enable-perlinterp --enable-pythoninterp --enable-python3interp --enable-rubyinterp --enable-luainterp --enable-tclinterp"
50+
) >> $GITHUB_ENV
51+
52+
- name: Set up system
53+
run: |
54+
# Setup lua5.3 manually since its package doesn't provide alternative.
55+
# https://bugs.launchpad.net/ubuntu/+source/lua5.3/+bug/1707212
56+
sudo update-alternatives --install /usr/bin/lua lua /usr/bin/lua5.3 10
57+
58+
- name: Configure
59+
run: |
60+
./configure --with-features=huge ${CONFOPT} --enable-fail-if-missing
61+
# Append various warning flags to CFLAGS.
62+
sed -i -f ci/config.mk.sed src/auto/config.mk
63+
sed -i -f ci/config.mk.${CC}.sed src/auto/config.mk
64+
65+
- name: Build/scan vim
66+
run: |
67+
cov-build --dir cov-int make -j${NPROC}
68+
69+
- name: Submit results
70+
run: |
71+
tar zcf cov-scan.tgz cov-int
72+
curl --form token=$TOKEN \
73+
--form email=$EMAIL \
74+
75+
--form version="$(git rev-parse HEAD)" \
76+
--form description="Automatic GHA scan" \
77+
'https://scan.coverity.com/builds?project=vim'
78+
env:
79+
TOKEN: ${{ secrets.COVERITY_SCAN_TOKEN }}
80+
EMAIL: ${{ secrets.COVERITY_SCAN_EMAIL }}

Filelist

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ SRC_ALL = \
99
.github/CODEOWNERS \
1010
.github/workflows/ci.yml \
1111
.github/workflows/codeql-analysis.yml \
12+
.github/workflows/coverity.yml \
1213
.gitignore \
1314
.hgignore \
1415
.lgtm.yml \
@@ -23,6 +24,7 @@ SRC_ALL = \
2324
ci/setup-xvfb.sh \
2425
src/Make_all.mak \
2526
src/README.md \
27+
src/alloc.c \
2628
src/alloc.h \
2729
src/arabic.c \
2830
src/arglist.c \
@@ -210,6 +212,7 @@ SRC_ALL = \
210212
src/testdir/popupbounce.vim \
211213
src/proto.h \
212214
src/protodef.h \
215+
src/proto/alloc.pro \
213216
src/proto/arabic.pro \
214217
src/proto/arglist.pro \
215218
src/proto/autocmd.pro \

runtime/doc/eval.txt

Lines changed: 30 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2485,14 +2485,14 @@ browse({save}, {title}, {initdir}, {default})
24852485
String put up a file requester
24862486
browsedir({title}, {initdir}) String put up a directory requester
24872487
bufadd({name}) Number add a buffer to the buffer list
2488-
bufexists({expr}) Number |TRUE| if buffer {expr} exists
2489-
buflisted({expr}) Number |TRUE| if buffer {expr} is listed
2490-
bufload({expr}) Number load buffer {expr} if not loaded yet
2491-
bufloaded({expr}) Number |TRUE| if buffer {expr} is loaded
2492-
bufname([{expr}]) String Name of the buffer {expr}
2493-
bufnr([{expr} [, {create}]]) Number Number of the buffer {expr}
2494-
bufwinid({expr}) Number window ID of buffer {expr}
2495-
bufwinnr({expr}) Number window number of buffer {expr}
2488+
bufexists({buf}) Number |TRUE| if buffer {buf} exists
2489+
buflisted({buf}) Number |TRUE| if buffer {buf} is listed
2490+
bufload({buf}) Number load buffer {buf} if not loaded yet
2491+
bufloaded({buf}) Number |TRUE| if buffer {buf} is loaded
2492+
bufname([{buf}]) String Name of the buffer {buf}
2493+
bufnr([{buf} [, {create}]]) Number Number of the buffer {buf}
2494+
bufwinid({buf}) Number window ID of buffer {buf}
2495+
bufwinnr({buf}) Number window number of buffer {buf}
24962496
byte2line({byte}) Number line number at byte count {byte}
24972497
byteidx({expr}, {nr}) Number byte index of {nr}'th char in {expr}
24982498
byteidxcomp({expr}, {nr}) Number byte index of {nr}'th char in {expr}
@@ -2574,6 +2574,7 @@ executable({expr}) Number 1 if executable {expr} exists
25742574
execute({command}) String execute {command} and get the output
25752575
exepath({expr}) String full path of the command {expr}
25762576
exists({expr}) Number |TRUE| if {expr} exists
2577+
exists_compiled({expr}) Number |TRUE| if {expr} exists at compile time
25772578
exp({expr}) Float exponential of {expr}
25782579
expand({expr} [, {nosuf} [, {list}]])
25792580
any expand special keywords in {expr}
@@ -4454,8 +4455,10 @@ exepath({expr}) *exepath()*
44544455
*exists()*
44554456
exists({expr}) The result is a Number, which is |TRUE| if {expr} is defined,
44564457
zero otherwise.
4457-
Note: In a compiled |:def| function local variables and
4458-
arguments are not visible to `exists()`.
4458+
4459+
Note: In a compiled |:def| function the evaluation is done at
4460+
runtime. Use `exists_compiled()` to evaluate the expression
4461+
at compile time.
44594462

44604463
For checking for a supported feature use |has()|.
44614464
For checking if a file exists use |filereadable()|.
@@ -4546,8 +4549,23 @@ exists({expr}) The result is a Number, which is |TRUE| if {expr} is defined,
45464549

45474550
Can also be used as a |method|: >
45484551
Varname()->exists()
4552+
<
4553+
4554+
exists_compiled({expr}) *exists_compiled()*
4555+
Like `exists()` but evaluated at compile time. This is useful
4556+
to skip a block where a function is used that would otherwise
4557+
give an error: >
4558+
if exists_compiled('*ThatFunction')
4559+
ThatFunction('works')
4560+
endif
4561+
< If `exists()` were used then a compilation error would be
4562+
given if ThatFunction() is not defined.
4563+
4564+
{expr} must be a literal string. *E1232*
4565+
Can only be used in a |:def| function. *E1233*
4566+
45494567

4550-
exp({expr}) *exp()*
4568+
exp({expr}) *exp()*
45514569
Return the exponential of {expr} as a |Float| in the range
45524570
[0, inf].
45534571
{expr} must evaluate to a |Float| or a |Number|.
@@ -6446,7 +6464,7 @@ has({feature} [, {check}])
64466464
features that have been abandoned will not be known by the
64476465
current Vim version.
64486466

6449-
Also see |exists()|.
6467+
Also see |exists()| and |exists_compiled()|.
64506468

64516469
Note that to skip code that has a syntax error when the
64526470
feature is not available, Vim may skip the rest of the line

runtime/doc/if_lua.txt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,17 @@ Vim evaluation and command execution, and others.
175175
:lua print(type(l), vim.type(l))
176176
:" list
177177
<
178-
vim.command({cmd}) Executes the vim (ex-mode) command {cmd}.
178+
vim.command({cmds}) Executes one or more lines of Ex-mode commands
179+
in {cmds}.
179180
Examples: >
180181
:lua vim.command"set tw=60"
181182
:lua vim.command"normal ddp"
183+
lua << trim END
184+
vim.command([[
185+
new Myfile.js
186+
call search('start')
187+
]])
188+
END
182189
<
183190
vim.eval({expr}) Evaluates expression {expr} (see |expression|),
184191
converts the result to Lua, and returns it.
@@ -211,6 +218,12 @@ Vim evaluation and command execution, and others.
211218
vim.lua_version The Lua version Vim was compiled with, in the
212219
form {major}.{minor}.{patch}, e.g. "5.1.4".
213220

221+
vim.version() Returns a Lua table with the Vim version.
222+
The table will have the following keys:
223+
major - major Vim version.
224+
minor - minor Vim version.
225+
patch - latest patch included.
226+
214227
*lua-vim-variables*
215228
The Vim editor global dictionaries |g:| |w:| |b:| |t:| |v:| can be accessed
216229
from Lua conveniently and idiomatically by referencing the `vim.*` Lua tables

runtime/doc/usr_41.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1182,6 +1182,7 @@ Various: *various-functions*
11821182
state() get current busy state
11831183
visualmode() last visual mode used
11841184
exists() check if a variable, function, etc. exists
1185+
exists_compiled() like exists() but check at compile time
11851186
has() check if a feature is supported in Vim
11861187
changenr() return number of most recent change
11871188
cscope_connection() check if a cscope connection exists

src/Make_ami.mak

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ endif
8080

8181
# Common sources
8282
SRC += \
83+
alloc.c \
8384
arabic.c \
8485
arglist.c \
8586
autocmd.c \

src/Make_cyg_ming.mak

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,7 @@ LIB = -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lnetapi32 -l
723723
GUIOBJ = $(OUTDIR)/gui.o $(OUTDIR)/gui_w32.o $(OUTDIR)/gui_beval.o
724724
CUIOBJ = $(OUTDIR)/iscygpty.o
725725
OBJ = \
726+
$(OUTDIR)/alloc.o \
726727
$(OUTDIR)/arabic.o \
727728
$(OUTDIR)/arglist.o \
728729
$(OUTDIR)/autocmd.o \

src/Make_mvc.mak

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -733,6 +733,7 @@ INCL = vim.h alloc.h ascii.h ex_cmds.h feature.h errors.h globals.h \
733733
spell.h structs.h term.h beval.h $(NBDEBUG_INCL)
734734

735735
OBJ = \
736+
$(OUTDIR)\alloc.obj \
736737
$(OUTDIR)\arabic.obj \
737738
$(OUTDIR)\arglist.obj \
738739
$(OUTDIR)\autocmd.obj \
@@ -1542,6 +1543,8 @@ test_vim9:
15421543
.cpp{$(OUTDIR)/}.obj::
15431544
$(CC) $(CFLAGS_OUTDIR) $<
15441545

1546+
$(OUTDIR)/alloc.obj: $(OUTDIR) alloc.c $(INCL)
1547+
15451548
$(OUTDIR)/arabic.obj: $(OUTDIR) arabic.c $(INCL)
15461549

15471550
$(OUTDIR)/arglist.obj: $(OUTDIR) arglist.c $(INCL)
@@ -1932,6 +1935,7 @@ $(PATHDEF_SRC): Make_mvc.mak
19321935

19331936
# End Custom Build
19341937
proto.h: \
1938+
proto/alloc.pro \
19351939
proto/arabic.pro \
19361940
proto/arglist.pro \
19371941
proto/autocmd.pro \

src/Make_vms.mms

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ ALL_LIBS = $(LIBS) $(GUI_LIB_DIR) $(GUI_LIB) $(XPM_LIB)\
306306
$(PERL_LIB) $(PYTHON_LIB) $(TCL_LIB) $(RUBY_LIB) $(LUA_LIB)
307307

308308
SRC = \
309+
alloc.c \
309310
arabic.c \
310311
arglist.c \
311312
autocmd.c \
@@ -425,6 +426,7 @@ SRC = \
425426
$(XDIFF_SRC)
426427

427428
OBJ = \
429+
alloc.obj \
428430
arabic.obj \
429431
arglist.obj \
430432
autocmd.obj \
@@ -738,6 +740,9 @@ lua_env :
738740
-@ !
739741
.ENDIF
740742

743+
alloc.obj : alloc.c vim.h [.auto]config.h feature.h os_unix.h \
744+
ascii.h keymap.h term.h macros.h structs.h regexp.h gui.h beval.h \
745+
[.proto]gui_beval.pro option.h ex_cmds.h proto.h errors.h globals.h
741746
arabic.obj : arabic.c vim.h
742747
arglist.obj : arglist.c vim.h [.auto]config.h feature.h os_unix.h
743748
autocmd.obj : autocmd.c vim.h [.auto]config.h feature.h os_unix.h

src/Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,6 +1607,7 @@ include testdir/Make_all.mak
16071607
# ALL_SRC: source files used for make depend and make lint
16081608

16091609
BASIC_SRC = \
1610+
alloc.c \
16101611
arabic.c \
16111612
arglist.c \
16121613
autocmd.c \
@@ -1764,6 +1765,7 @@ LINT_SRC = $(BASIC_SRC) $(GUI_SRC) \
17641765
#LINT_SRC = $(BASIC_SRC)
17651766

17661767
OBJ_COMMON = \
1768+
objects/alloc.o \
17671769
objects/arabic.o \
17681770
objects/arglist.o \
17691771
objects/autocmd.o \
@@ -1934,6 +1936,7 @@ ALL_OBJ = $(OBJ_COMMON) \
19341936

19351937

19361938
PRO_AUTO = \
1939+
alloc.pro \
19371940
arabic.pro \
19381941
arglist.pro \
19391942
autocmd.pro \
@@ -3173,6 +3176,9 @@ objects/MMBackend.o: MacVim/MMBackend.m
31733176
objects/MacVim.o: MacVim/MacVim.m
31743177
$(CCC) -o $@ MacVim/MacVim.m
31753178

3179+
objects/alloc.o: alloc.c
3180+
$(CCC) -o $@ alloc.c
3181+
31763182
objects/arabic.o: arabic.c
31773183
$(CCC) -o $@ arabic.c
31783184

@@ -3786,6 +3792,10 @@ installglinks_haiku: $(HAIKU_GLINKS) install_haiku_extra
37863792
###############################################################################
37873793
### (automatically generated by 'make depend')
37883794
### Dependencies:
3795+
objects/alloc.o: alloc.c vim.h protodef.h auto/config.h feature.h os_unix.h \
3796+
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
3797+
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \
3798+
proto.h errors.h globals.h
37893799
objects/arabic.o: arabic.c vim.h protodef.h auto/config.h feature.h os_unix.h \
37903800
auto/osdef.h ascii.h keymap.h term.h macros.h option.h beval.h \
37913801
proto/gui_beval.pro structs.h regexp.h gui.h alloc.h ex_cmds.h spell.h \

0 commit comments

Comments
 (0)