Patch 9.0.0072

11 views
Skip to first unread message

Bram Moolenaar

unread,
Jul 25, 2022, 4:16:23 PM7/25/22
to vim...@googlegroups.com

Patch 9.0.0072 (after 9.0.0067)
Problem: Compiler warning for uninitialized variable.
Solution: Initialize it. (John Marriott)
Files: src/drawline.c


*** ../vim-9.0.0071/src/drawline.c 2022-07-25 18:13:33.046580756 +0100
--- src/drawline.c 2022-07-25 21:11:49.462293072 +0100
***************
*** 819,825 ****
{
char_u *prev_ptr = ptr;
chartabsize_T cts;
! int charsize;

init_chartabsize_arg(&cts, wp, lnum, vcol, line, ptr);
while (cts.cts_vcol < v && *cts.cts_ptr != NUL)
--- 819,825 ----
{
char_u *prev_ptr = ptr;
chartabsize_T cts;
! int charsize = 0;

init_chartabsize_arg(&cts, wp, lnum, vcol, line, ptr);
while (cts.cts_vcol < v && *cts.cts_ptr != NUL)
*** ../vim-9.0.0071/src/version.c 2022-07-25 19:50:53.954361274 +0100
--- src/version.c 2022-07-25 21:12:53.046258579 +0100
***************
*** 737,738 ****
--- 737,740 ----
{ /* Add new patch number below this line */
+ /**/
+ 72,
/**/

--
hundred-and-one symptoms of being an internet addict:
124. You begin conversations with, "Who is your internet service provider?"

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

Tony Mechelynck

unread,
Jul 25, 2022, 6:38:34 PM7/25/22
to Bram Moolenaar, vim_dev
On Mon, Jul 25, 2022 at 10:16 PM Bram Moolenaar <Br...@moolenaar.net> wrote:
>
>
> Patch 9.0.0072 (after 9.0.0067)
> Problem: Compiler warning for uninitialized variable.
> Solution: Initialize it. (John Marriott)
> Files: src/drawline.c

After this patch, I get a new warning in Big and Huge only, as follows:

gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK
-I/usr/include/gtk-3.0 -I/usr/include/pango-1.0
-I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include
-I/usr/include/harfbuzz -I/usr/include/freetype2
-I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi
-I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng16
-I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0
-I/usr/include/wayland -I/usr/include/libxkbcommon
-I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0
-I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include
-I/usr/include/at-spi-2.0 -pthread -O2 -fno-strength-reduce -Wall
-Wno-deprecated-declarations -D_REENTRANT -U_FORTIFY_SOURCE
-D_FORTIFY_SOURCE=1 -o objects/drawline.o drawline.c
drawline.c: In function ‘win_line’:
drawline.c:1541:35: warning: ‘used_tpi’ may be used uninitialized
[-Wmaybe-uninitialized]
1541 | text_props[used_tpi].tp_id = -MAXCOL;
| ^
drawline.c:1489:25: note: ‘used_tpi’ was declared here
1489 | int used_tpi;
| ^~~~~~~~


Best regards,
Tony.

Bram Moolenaar

unread,
Jul 26, 2022, 6:43:13 AM7/26/22
to vim...@googlegroups.com, Tony Mechelynck

Tony wrote:

> On Mon, Jul 25, 2022 at 10:16 PM Bram Moolenaar <Br...@moolenaar.net> wrote:
> >
> >
> > Patch 9.0.0072 (after 9.0.0067)
> > Problem: Compiler warning for uninitialized variable.
> > Solution: Initialize it. (John Marriott)
> > Files: src/drawline.c
>
> After this patch, I get a new warning in Big and Huge only, as follows:
>
> gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK
> -I/usr/include/gtk-3.0 -I/usr/include/pango-1.0
> -I/usr/include/glib-2.0 -I/usr/lib64/glib-2.0/include
> -I/usr/include/harfbuzz -I/usr/include/freetype2
> -I/usr/include/libmount -I/usr/include/blkid -I/usr/include/fribidi
> -I/usr/include/cairo -I/usr/include/pixman-1 -I/usr/include/libpng16
> -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/gio-unix-2.0
> -I/usr/include/wayland -I/usr/include/libxkbcommon
> -I/usr/include/atk-1.0 -I/usr/include/at-spi2-atk/2.0
> -I/usr/include/dbus-1.0 -I/usr/lib64/dbus-1.0/include
> -I/usr/include/at-spi-2.0 -pthread -O2 -fno-strength-reduce -Wall
> -Wno-deprecated-declarations -D_REENTRANT -U_FORTIFY_SOURCE
> -D_FORTIFY_SOURCE=3D1 -o objects/drawline.o drawline.c
> drawline.c: In function =E2=80=98win_line=E2=80=99:
> drawline.c:1541:35: warning: =E2=80=98used_tpi=E2=80=99 may be used uniniti=
> alized
> [-Wmaybe-uninitialized]
> 1541 | text_props[used_tpi].tp_id =3D -MAXCOL;
> | ^
> drawline.c:1489:25: note: =E2=80=98used_tpi=E2=80=99 was declared here
> 1489 | int used_tpi;
> | ^~~~~~~~

My compiler didn't complain about it. Anyway, we can init used_tpi to
avoid the warning.

--
hundred-and-one symptoms of being an internet addict:
126. You brag to all of your friends about your date Saturday night...but
you don't tell them it was only in a chat room.

Tony Mechelynck

unread,
Jul 26, 2022, 9:10:35 AM7/26/22
to Bram Moolenaar, vim_dev
On Tue, Jul 26, 2022 at 12:43 PM Bram Moolenaar <Br...@moolenaar.net> wrote:
>
>
> Tony wrote:
>
> > On Mon, Jul 25, 2022 at 10:16 PM Bram Moolenaar <Br...@moolenaar.net> wrote:
> > >
> > >
> > > Patch 9.0.0072 (after 9.0.0067)
> > > Problem: Compiler warning for uninitialized variable.
> > > Solution: Initialize it. (John Marriott)
> > > Files: src/drawline.c
> >
> > After this patch, I get a new warning in Big and Huge only, as follows:
[...]
>
> My compiler didn't complain about it. Anyway, we can init used_tpi to
> avoid the warning.

Thanks for patch 9.0.75. My compiler describes itself as follows:

linux-tuxedo:~ # gcc --version
gcc (SUSE Linux) 12.1.1 20220629 [revision
7811663964aa7e31c3939b859bbfa2e16919639f]
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Best regards,
Tony.
Reply all
Reply to author
Forward
0 new messages