Commit: patch 9.1.1724: Compiler warning about ununitialized variable in ex_docmd.

3 views
Skip to first unread message

Christian Brabandt

unread,
Sep 1, 2025, 1:30:16 PMSep 1
to vim...@googlegroups.com
patch 9.1.1724: Compiler warning about ununitialized variable in ex_docmd.

Commit: https://github.com/vim/vim/commit/5f5a1c58768ca67d98eaf1a4fc6a0744e2fb4656
Author: mityu <mityu...@gmail.com>
Date: Mon Sep 1 19:18:46 2025 +0200

patch 9.1.1724: Compiler warning about ununitialized variable in ex_docmd.

Problem: Compiler warning about ununitialized variable in ex_docmd.
Solution: Initialize result variable (mityu)

Silence uninitialized variable warning produced by clang 21.1.0

closes: #18182

Signed-off-by: mityu <mityu...@gmail.com>
Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 3e48aed79..9d7e58ed9 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -9773,7 +9773,7 @@ eval_vars(
{
int i;
char_u *s;
- char_u *result;
+ char_u *result = (char_u *)"";
char_u *resultbuf = NULL;
size_t resultlen;
buf_T *buf;
@@ -10064,10 +10064,6 @@ eval_vars(
#endif
break;
#endif
-
- default:
- result = (char_u *)""; // avoid gcc warning
- break;
}

resultlen = STRLEN(result); // length of new string
diff --git a/src/version.c b/src/version.c
index 903c459b9..5603415e6 100644
--- a/src/version.c
+++ b/src/version.c
@@ -724,6 +724,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 1724,
/**/
1723,
/**/
Reply all
Reply to author
Forward
0 new messages