Patch 8.1.1670

25 views
Skip to first unread message

Bram Moolenaar

unread,
Jul 12, 2019, 1:22:46 PM7/12/19
to vim...@googlegroups.com

Patch 8.1.1670
Problem: Sign column not always properly aligned.
Solution: Use "col" only after it was calculated. (Yee Cheng Chin,
closes #4649)
Files: src/gui.c


*** ../vim-8.1.1669/src/gui.c 2019-07-08 21:57:26.291708275 +0200
--- src/gui.c 2019-07-12 19:19:43.747868038 +0200
***************
*** 2253,2259 ****
int col = gui.col;
#ifdef FEAT_SIGN_ICONS
int draw_sign = FALSE;
! int signcol = col;
char_u extra[18];
# ifdef FEAT_NETBEANS_INTG
int multi_sign = FALSE;
--- 2253,2259 ----
int col = gui.col;
#ifdef FEAT_SIGN_ICONS
int draw_sign = FALSE;
! int signcol;
char_u extra[18];
# ifdef FEAT_NETBEANS_INTG
int multi_sign = FALSE;
***************
*** 2270,2276 ****
# ifdef FEAT_NETBEANS_INTG
|| *s == MULTISIGN_BYTE
# endif
! )
{
# ifdef FEAT_NETBEANS_INTG
if (*s == MULTISIGN_BYTE)
--- 2270,2276 ----
# ifdef FEAT_NETBEANS_INTG
|| *s == MULTISIGN_BYTE
# endif
! )
{
# ifdef FEAT_NETBEANS_INTG
if (*s == MULTISIGN_BYTE)
***************
*** 2289,2295 ****
--col;
len = (int)STRLEN(s);
if (len > 2)
! signcol = col + len - 3; // Right align sign icon in the number column
draw_sign = TRUE;
highlight_mask = 0;
}
--- 2289,2298 ----
--col;
len = (int)STRLEN(s);
if (len > 2)
! // right align sign icon in the number column
! signcol = col + len - 3;
! else
! signcol = col;
draw_sign = TRUE;
highlight_mask = 0;
}
*** ../vim-8.1.1669/src/version.c 2019-07-12 18:45:36.862862540 +0200
--- src/version.c 2019-07-12 19:21:17.259419415 +0200
***************
*** 779,780 ****
--- 779,782 ----
{ /* Add new patch number below this line */
+ /**/
+ 1670,
/**/

--
CRONE: Who sent you?
ARTHUR: The Knights Who Say Ni!
CRONE: Aaaagh! (she looks around in rear) No! We have no shrubberies here.
"Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

Christian Brabandt

unread,
Jul 16, 2019, 11:14:50 AM7/16/19
to vim...@googlegroups.com

On Fr, 12 Jul 2019, Bram Moolenaar wrote:

>
> Patch 8.1.1670
> Problem: Sign column not always properly aligned.
> Solution: Use "col" only after it was calculated. (Yee Cheng Chin,
> closes #4649)
> Files: src/gui.c

After this patch I see a warning when compiling with
-Wmaybe-uninitialized:

gui.c: In function ‘gui_outstr_nowrap’:
gui.c:2621:2: warning: ‘signcol’ may be used uninitialized in this function [-Wmaybe-uninitialized]
gui_mch_drawsign(gui.row, signcol, gui.highlight_mask);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


I don't really see, how signcol can be used uninitialized, but to shut
up the compiler, I suggest this patch:

diff --git a/src/gui.c b/src/gui.c
index e66581f52..2d5f80fd2 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -2253,7 +2253,7 @@ gui_outstr_nowrap(
int col = gui.col;
#ifdef FEAT_SIGN_ICONS
int draw_sign = FALSE;
- int signcol;
+ int signcol = 0; // shut up unitialized warning
char_u extra[18];
# ifdef FEAT_NETBEANS_INTG
int multi_sign = FALSE;


Best,
Christian
--
Niemand urteilt schärfer als der Ungebildete, er kennt weder Gründe
noch Gegengründe.
-- Anselm Feuerbach

Bram Moolenaar

unread,
Jul 16, 2019, 2:13:08 PM7/16/19
to vim...@googlegroups.com, Christian Brabandt

Christian wrote:

> On Fr, 12 Jul 2019, Bram Moolenaar wrote:
>
> >
> > Patch 8.1.1670
> > Problem: Sign column not always properly aligned.
> > Solution: Use "col" only after it was calculated. (Yee Cheng Chin,
> > closes #4649)
> > Files: src/gui.c
>
> After this patch I see a warning when compiling with
> -Wmaybe-uninitialized:
>
> gui.c: In function ‘gui_outstr_nowrap’:
> gui.c:2621:2: warning: ‘signcol’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> gui_mch_drawsign(gui.row, signcol, gui.highlight_mask);
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
> I don't really see, how signcol can be used uninitialized, but to shut
> up the compiler, I suggest this patch:

Thanks, I'll include it.

--
Sorry, no fortune today.
Reply all
Reply to author
Forward
0 new messages