Commit Graph

5502 Commits

Author SHA1 Message Date
ZyX
b725f6b428 functests: Make sure that json functions are tested with C messages 2016-04-18 02:48:20 +03:00
ZyX
4eb5d05f01 eval/decode: Avoid overflow when parsing incomplete null/true/false
Note: second test does not crash or produce asan errors, even though it should.
2016-04-18 02:48:20 +03:00
ZyX
4a29995fe7 eval/decode: Rename brackets in error messages
U+007D is officially RIGHT CURLY BRACKET.
U+005D is officially RIGHT SQUARE BRACKET.
2016-04-18 02:48:20 +03:00
ZyX
1fc84ae2cd eval/decode: Record that obj may be freed 2016-04-18 02:48:20 +03:00
ZyX
4ff5d6e41c eval/decode: Also use VAR_UNLOCKED in old code 2016-04-18 02:48:20 +03:00
ZyX
54cc6d8025 eval: Remove assert expression
GCC on travis thinks that
1. It is not constant.
2. Left-hand operand of comma has no effect (-Werror=unused-variable).
2016-04-18 02:48:20 +03:00
ZyX
6a35f2ac8b eval: Do not break when VimVarIndex and vimvars order mismatches
Also makes sure that compiler will error out when new name is longer then 
vv_filler.
2016-04-18 02:48:20 +03:00
ZyX
942e0b338c encode: Handle incomplete surrogates like \uSURR\uOTHR properly 2016-04-18 02:48:20 +03:00
ZyX
406562ac6d encode: Fail to dump NaN and infinity
Thanks to vim/vim#654
2016-04-18 02:48:20 +03:00
ZyX
7cdd01983a api/documentation: Add a warning that nil may mean v:null 2016-04-18 02:48:20 +03:00
ZyX
2f67786796 eval: Rename json* functions to json_* 2016-04-18 02:48:20 +03:00
ZyX
f1ced96c28 api: Replace set_var(name, NIL) with del_var(name) 2016-04-18 02:47:13 +03:00
ZyX
af6603a6b4 eval/encode: Remove unneeded variable, add missing include 2016-04-18 02:47:13 +03:00
ZyX
4913a25dec eval/encode: Free memory just in case
After string_convert() with .vc_fail=true these blocks should never be entered 
because they indicate invalid unicode.
2016-04-18 02:47:13 +03:00
ZyX
209427e972 eval/encode: Reduce length of encode_list_write
Changes suggested by oni-link.
2016-04-18 02:47:13 +03:00
ZyX
f0bd4a1494 eval/encode: Fix invalid UTF-8 strings handling:
1. Do not allow reading past buffer end when creating error messages.
2. Fix surrogate pairs range, avoid magic constants.
2016-04-18 02:47:13 +03:00
ZyX
77776b09c6 eval/encode: Fix writing strings starting with NL to list
Error [found][1] by oni-link.

[1]: https://github.com/neovim/neovim/pull/4131/files#r52239384
2016-04-18 02:47:13 +03:00
ZyX
c27395ddc8 eval: Fix QuickBuild failures
Compiler used by one VM in QuickBuild has found a number of false positives.
Everything is fine on travis.

List of failures:

From [QuickBuild][1], build [7429][2]:

    14:38:19,945 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c: In function ‘assert_bool’:
    14:38:19,945 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c:7551:40: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
    14:38:20,058 WARN  - cc1: all warnings being treated as errors

. This is not making much sense (7551:40 is `!=` in `{SpecialVarValue} !=
({bool}?{SpecialVarValue}:{SpecialVarValue})`), but this error is present.

---

Also fail from [build][3] [4930][4]:

    15:47:00,853 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval/encode.c: In function ‘encode_read_from_list’:
    15:47:00,853 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval/encode.c:258:30: error: conversion to ‘char’ from ‘int’ may alter its value [-Werror=conversion]

, pointing to `:` in `{char} = ({char} == {const} ? {const} : {char})` where
`{const}` is character constant like `'\n'`. I have no idea where exactly it saw
conversion, so simply casted everything to (char).

---

[Build][5] error:

    08:32:03,472 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c: In function ‘tv_equal’:
    08:32:03,472 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c:5077:1: error: control reaches end of non-void function [-Werror=return-type]

---

Build [4949][7]:

    11:28:00,578 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c: In function ‘f_type’:
    11:28:00,578 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c:16085:24: error: ‘n’ may be used uninitialized in this function [-Werror=uninitialized]
    11:28:00,581 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c: In function ‘f_empty’:
    11:28:00,581 WARN  - /home/quickbuild/buildagent/workspace/root/neovim/pull-requests-automated/src/nvim/eval.c:8505:24: error: ‘n’ may be used uninitialized in this function [-Werror=uninitialized]

[1]: http://neovim-qb.szakmeister.net/wicket/page?5-1.ILinkListener-content-buildTab-panel-masterStep-body-children-0-step-body-children-2-body-children-3-step-body-children-0-step-body-children-0-step-head-logLink
[2]: http://neovim-qb.szakmeister.net/build/4929
[3]: http://neovim-qb.szakmeister.net/build/4930
[4]: http://neovim-qb.szakmeister.net/wicket/page?1-1.ILinkListener-content-buildTab-panel-masterStep-body-children-0-step-body-children-1-body-children-3-step-body-children-0-step-body-children-0-step-head-logLink
[5]: http://neovim-qb.szakmeister.net/build/4948/step_status
[7]: http://neovim-qb.szakmeister.net/build/4949
2016-04-18 02:47:13 +03:00
ZyX
fa26eee85b version: Record that vim-7.4.1271 is kinda of there 2016-04-18 02:46:55 +03:00
ZyX
569e404622 eval/encode: Fix non-utf-8 &encoding handling, add tests 2016-04-18 02:46:34 +03:00
ZyX
7124329bd9 *: Fix memory leaks found by clang sanitizer 2016-04-18 02:46:34 +03:00
ZyX
d4106f6df3 shada: Make sure that NIL and EXT values can also be parsed back
Note: currently they are both *dumped*, but parsing them produces an error. This
is inappropriate: variables should either be skipped with error message when
dumping or should be read back properly.

It also appears that I did not have test for “has wrong variable value type”
error, so nothing got removed from errors_spec.
2016-04-18 02:46:34 +03:00
ZyX
0aa3e7b7ce eval: Port parts of 7.4.1267 that are not already present 2016-04-18 02:46:34 +03:00
ZyX
b7cb8f0597 eval: Make assert_true and assert_false accept v:true and v:false 2016-04-18 02:45:49 +03:00
ZyX
c91c0171dd *: Fix gcc warnings 2016-04-18 02:45:49 +03:00
ZyX
6cdf45e298 eval: Change dv_lock type to VarLockStatus 2016-04-18 02:45:49 +03:00
ZyX
f4ea114c67 eval/decode: Fix vim_str2nr invocation 2016-04-18 02:45:49 +03:00
ZyX
33778c36cc *: Fix linter errors 2016-04-18 02:45:49 +03:00
ZyX
6167ce6df2 eval: Remove v:none
To get v:none back just rever this commit. This will not make json*() functions
compatible with Vim though.
2016-04-18 02:45:49 +03:00
ZyX
a3b87fc19b eval: Remove get_vim_var_tv function 2016-04-18 02:45:49 +03:00
ZyX
e303ea8a19 eval/decode: Add support for special maps
Special dictionaries representing map are created when encountering duplicate
key or when key is empty or contains NUL.

Also checks that values are separated by a comma/colon properly.
2016-04-18 02:45:49 +03:00
ZyX
2c378fdfaf eval/decode: Parse strings with NUL to special dictionaries 2016-04-18 02:45:49 +03:00
ZyX
634e51d12b eval/*: Fix some linter errors 2016-04-18 02:45:49 +03:00
ZyX
57700def79 doc: Update documentation regarding converting from/to &encoding 2016-04-18 02:45:49 +03:00
ZyX
5814e29cdb eval/decode: Fix surrogate pairs processing 2016-04-18 02:45:49 +03:00
ZyX
ea82270d30 eval/decode: Fail on control and invalid unicode characters 2016-04-18 02:45:49 +03:00
ZyX
cddd7d47c3 eval/decode: Make msgpackparse() function use new v: vars 2016-04-18 02:45:49 +03:00
ZyX
ed6756563c eval/decode: Replace INIT_SPECIAL_DICT macros with inline function 2016-04-18 02:45:49 +03:00
ZyX
700b32a2b3 eval: Move some decoding functions to eval/decode.c 2016-04-18 02:45:49 +03:00
ZyX
3c39219550 eval: Get rid of VV_LEN constant 2016-04-18 02:45:49 +03:00
ZyX
85244e68e3 vim: Move *MSG* macros to message.h
Note: OUT* macros were removed because they are no longer used anywhere.
2016-04-18 02:45:49 +03:00
ZyX
41b44d114c eval: Move encode.c to eval/encode.c 2016-04-18 02:45:49 +03:00
ZyX
704accfbfa cmake: Refactor code that creates directories and lists C files 2016-04-18 02:45:49 +03:00
ZyX
e213ba1506 eval: Add jsondecode() function 2016-04-18 02:45:49 +03:00
ZyX
0f0e2bdfd4 encode: Do not use default case for v_type 2016-04-18 02:44:03 +03:00
ZyX
f5c35ba109 functests/msgpack: Test dumping special nil and bool dicts 2016-04-18 02:44:03 +03:00
ZyX
6e5498c3e3 runtime/msgpack: Add support for special values 2016-04-18 02:44:03 +03:00
ZyX
d70a322c40 eval: Add special variables v:false, v:null, v:none 2016-04-18 02:44:03 +03:00
ZyX
18903bd9b8 eval: Add special variable type 2016-04-18 02:44:03 +03:00
ZyX
256a5d2522 encode: Add a hint for static analyzer that cur_tv is not NULL 2016-04-18 02:44:03 +03:00