Hi
Compiling Vim-7.4.335 (gui=motif) with clang-3.5.0 (trunk 211156),
I see these compilation warnings:
clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MOTIF -g -O3
-D_FORTIFY_SOURCE=1 -Wall -Wshadow -Wmissing-prototypes -DEXITFREE
-o objects/gui_beval.o gui_beval.c
gui_beval.c:1196:10: warning: variable 'h' is used uninitialized
whenever 'if' condition is false [-Wsometimes-uninitialized]
if (fl != NULL)
^~~~~~~~~~
gui_beval.c:1203:2: note: uninitialized use occurs here
h += gui.border_offset << 1;
^
gui_beval.c:1196:6: note: remove the 'if' if its condition is always true
if (fl != NULL)
^~~~~~~~~~~~~~~
gui_beval.c:1173:16: note: initialize the variable 'h' to silence this warning
Dimension h;
^
= 0
gui_beval.c:1196:10: warning: variable 'w' is used uninitialized
whenever 'if' condition is false [-Wsometimes-uninitialized]
if (fl != NULL)
^~~~~~~~~~
gui_beval.c:1202:2: note: uninitialized use occurs here
w += gui.border_offset << 1;
^
gui_beval.c:1196:6: note: remove the 'if' if its condition is always true
if (fl != NULL)
^~~~~~~~~~~~~~~
gui_beval.c:1172:16: note: initialize the variable 'w' to silence this warning
Dimension w;
^
= 0
src/gui_beval.c:
1168 static void
1169 drawBalloon(beval)
1170 BalloonEval *beval;
1171 {
1172 Dimension w;
1173 Dimension h;
1174 Position tx;
1175 Position ty;
1176
1177 if (beval->msg != NULL)
1178 {
1179 /* Show the Balloon */
1180
1181 /* Calculate the label's width and height */
1182 #ifdef FEAT_GUI_MOTIF
1183 XmString s;
1184
1185 /* For the callback function we parse NL characters to create a
1186 * multi-line label. This doesn't work for all languages, but
1187 * XmStringCreateLocalized() doesn't do multi-line labels... */
1188 if (beval->msgCB != NULL)
1189 s = XmStringCreateLtoR((char *)beval->msg,
XmFONTLIST_DEFAULT_TAG);
1190 else
1191 s = XmStringCreateLocalized((char *)beval->msg);
1192 {
1193 XmFontList fl;
1194
1195 fl = gui_motif_fontset2fontlist(&gui.tooltip_fontset);
1196 if (fl != NULL)
1197 {
1198 XmStringExtent(fl, s, &w, &h);
1199 XmFontListFree(fl);
1200 }
1201 }
1202 w += gui.border_offset << 1;
1203 h += gui.border_offset << 1;
It's fixed in attached patch.
Regards
Dominique
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
diff -r 4aa63564dd3f src/gui_beval.c
--- a/src/gui_beval.c Wed Jun 18 21:38:18 2014 +0200
+++ b/src/gui_beval.c Thu Jun 19 23:33:51 2014 +0200
@@ -1198,6 +1198,11 @@
XmStringExtent(fl, s, &w, &h);
XmFontListFree(fl);
}
+ else
+ {
+ XmStringFree(s);
+ return;
+ }
}
w += gui.border_offset << 1;
h += gui.border_offset << 1;