diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2021-06-02 22:40:09 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-02 22:40:09 -0400 |
commit | 7d4f890aa92a1d961c5a048486adf9195427e940 (patch) | |
tree | 7bf54e6836f18958375cd09794b19b334da53d27 | |
parent | 68d40388f356587726ea7db83f87846dfaecf9d9 (diff) | |
parent | 6a2f1b1740e01f9cd35ec174a41bda6f49f44f2b (diff) | |
download | rneovim-7d4f890aa92a1d961c5a048486adf9195427e940.tar.gz rneovim-7d4f890aa92a1d961c5a048486adf9195427e940.tar.bz2 rneovim-7d4f890aa92a1d961c5a048486adf9195427e940.zip |
Merge pull request #14710 from janlazo/clang-warnings
Reduce clang warnings
-rw-r--r-- | src/nvim/api/vim.c | 1 | ||||
-rw-r--r-- | src/nvim/eval.c | 10 | ||||
-rw-r--r-- | src/nvim/ex_cmds2.c | 2 | ||||
-rw-r--r-- | src/nvim/ex_session.c | 2 | ||||
-rw-r--r-- | src/nvim/marktree.c | 2 | ||||
-rw-r--r-- | test/functional/eval/null_spec.lua | 2 |
6 files changed, 12 insertions, 7 deletions
diff --git a/src/nvim/api/vim.c b/src/nvim/api/vim.c index 99a41f4f6f..60535b13b3 100644 --- a/src/nvim/api/vim.c +++ b/src/nvim/api/vim.c @@ -2954,6 +2954,7 @@ void nvim_set_decoration_provider(Integer ns_id, DictionaryOf(LuaRef) opts, FUNC_API_SINCE(7) FUNC_API_LUA_ONLY { DecorProvider *p = get_decor_provider((NS)ns_id, true); + assert(p != NULL); decor_provider_clear(p); // regardless of what happens, it seems good idea to redraw diff --git a/src/nvim/eval.c b/src/nvim/eval.c index a75cc78b7e..a3fa9c986f 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -7200,9 +7200,13 @@ bool callback_from_typval(Callback *const callback, typval_T *const arg) r = FAIL; } else if (arg->v_type == VAR_FUNC || arg->v_type == VAR_STRING) { char_u *name = arg->vval.v_string; - func_ref(name); - callback->data.funcref = vim_strsave(name); - callback->type = kCallbackFuncref; + if (name != NULL) { + func_ref(name); + callback->data.funcref = vim_strsave(name); + callback->type = kCallbackFuncref; + } else { + r = FAIL; + } } else if (nlua_is_table_from_lua(arg)) { char_u *name = nlua_register_table_as_callable(arg); diff --git a/src/nvim/ex_cmds2.c b/src/nvim/ex_cmds2.c index 0a2802397d..56a14887df 100644 --- a/src/nvim/ex_cmds2.c +++ b/src/nvim/ex_cmds2.c @@ -2958,7 +2958,7 @@ int do_source(char_u *fname, int check_other, int is_vimrc) } if (l_do_profiling == PROF_YES) { - bool forceit; + bool forceit = false; // Check if we do profiling for this script. if (!si->sn_prof_on && has_profiling(true, si->sn_name, &forceit)) { diff --git a/src/nvim/ex_session.c b/src/nvim/ex_session.c index c1e52d6994..481febd16b 100644 --- a/src/nvim/ex_session.c +++ b/src/nvim/ex_session.c @@ -725,7 +725,7 @@ static int makeopens(FILE *fd, char_u *dirnow) } } - if (tab_firstwin->w_next != NULL) { + if (tab_firstwin != NULL && tab_firstwin->w_next != NULL) { // Go to the first window. PUTLINE_FAIL("wincmd t"); diff --git a/src/nvim/marktree.c b/src/nvim/marktree.c index b3afdefac1..34acf64d83 100644 --- a/src/nvim/marktree.c +++ b/src/nvim/marktree.c @@ -849,7 +849,7 @@ bool marktree_splice(MarkTree *b, MarkTreeIter itr[1] = { 0 }; MarkTreeIter enditr[1] = { 0 }; - mtpos_t oldbase[MT_MAX_DEPTH]; + mtpos_t oldbase[MT_MAX_DEPTH] = { 0 }; marktree_itr_get_ext(b, start, itr, false, true, oldbase); if (!itr->node) { diff --git a/test/functional/eval/null_spec.lua b/test/functional/eval/null_spec.lua index 8f0041ff27..b1ceff9115 100644 --- a/test/functional/eval/null_spec.lua +++ b/test/functional/eval/null_spec.lua @@ -150,6 +150,7 @@ describe('NULL', function() null_test('does not crash :execute', 'execute S', 0) null_expr_test('does not crash execute()', 'execute(S)', 0, '') null_expr_test('makes executable() error out', 'executable(S)', 'E928: String required', 0) + null_expr_test('makes timer_start() error out', 'timer_start(0, S)', 'E921: Invalid callback argument', -1) null_expr_test('does not crash filereadable()', 'filereadable(S)', 0, 0) null_expr_test('does not crash filewritable()', 'filewritable(S)', 0, 0) null_expr_test('does not crash fnamemodify()', 'fnamemodify(S, S)', 0, '') @@ -162,7 +163,6 @@ describe('NULL', function() null_expr_test('does not crash mkdir()', 'mkdir(S)', 0, 0) null_expr_test('does not crash sort()', 'sort(["b", S, "a"])', 0, {'', 'a', 'b'}) null_expr_test('does not crash split()', 'split(S)', 0, {}) - null_test('can be used to set an option', 'let &grepprg = S', 0) null_expr_test('is equal to non-existent variable', 'S == V', 0, 1) |