Tony Mechelynck wrote:

> On Sat, Apr 30, 2022 at 5:12 PM Bram Moolenaar <[email protected]> wrote:
> >
> >
> > Patch 8.2.4850
> > Problem:    Mksession mixes up "tabpages" and "curdir" arguments.
> > Solution:   Correct logic for storing tabpage in session. (closes #10312)
> > Files:      src/session.c, src/testdir/test_mksession.vim
> 
> At this patchlevel, I get one warning in Huge, two each (but related)
> in Big and Normal, none in Small and Tiny. The following comes from my
> Normal build:
> 
> 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/uuid -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/session.o session.c
> session.c: In function ‘ex_mkrc’:
> session.c:982:21: warning: ‘tab_firstwin’ may be used uninitialized in
> this function [-Wmaybe-uninitialized]
>   982 |     if (tab_firstwin->w_next != NULL)
>       |         ~~~~~~~~~~~~^~~~~~~~
> session.c:627:18: note: ‘tab_firstwin’ was declared here
>   627 |     win_T       *tab_firstwin;
>       |                  ^~~~~~~~~~~~
> 
> The message from my Huge build is (only slightly) different:
> 
> 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/uuid -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/session.o session.c
> session.c: In function ‘makeopens’:
> session.c:982:21: warning: ‘tab_firstwin’ may be used uninitialized in
> this function [-Wmaybe-uninitialized]
>   982 |     if (tab_firstwin->w_next != NULL)
>       |         ~~~~~~~~~~~~^~~~~~~~

The compiler doesn't know that first_tabpage is never NULL.
But the condition is strange anyway, because tab_firstwin changes every
loop and tab_firstwin->w_next may become NULL even though the options
were set.  Better set a flag that explicitly says that the option values
need to be restored.

-- 
>From "know your smileys":
 :q     vi user saying, "How do I get out of this damn emacs editor?"

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///                                                                      \\\
\\\        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ ///
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///

-- 
-- 
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].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220430234514.D7C2C1C191E%40moolenaar.net.

Raspunde prin e-mail lui