From b4ae878407223965cdee6c88e7a55caf08b2a130 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eliseo=20Marti=CC=81nez?= Date: Fri, 14 Nov 2014 22:12:41 +0100 Subject: [PATCH] Fix warnings: tag.c: get_tags(): Uninitialized arg: RI. Problem : Uninitialized argument value @ 2798. Diagnostic : Real issue. Rationale : Tags doesn't have to have a kind. When they have one, both `tp.tagkind` and `tp.tagkind_end` are nonnull. But when they don't, `tp.tagkind` will we null (but defined), while `tp.tagkind_end` will be undefined. Therefore, reported invocation is indeed using a garbage value for a tag with no kind. Problem doesn't have consequences because `add_tag_field()` doesn't use `end` param if `start` param is null. Resolution : Don't use `tp.tagkind_end` if `tp.tagkind` is null. --- src/nvim/tag.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/nvim/tag.c b/src/nvim/tag.c index 724261f08e..6ac6dc5cd2 100644 --- a/src/nvim/tag.c +++ b/src/nvim/tag.c @@ -2799,7 +2799,7 @@ int get_tags(list_T *list, char_u *pat) || add_tag_field(dict, "cmd", tp.command, tp.command_end) == FAIL || add_tag_field(dict, "kind", tp.tagkind, - tp.tagkind_end) == FAIL + tp.tagkind ? tp.tagkind_end : NULL) == FAIL || dict_add_nr_str(dict, "static", is_static, NULL) == FAIL) ret = FAIL;