On Sat, Apr 29, 2023 at 3:26 PM Bram Moolenaar <[email protected]> wrote:
>
>
> Tony wrote:
>
> > I'm including the full log because "make -j4" might display the
> > warnings otherwise than where they belong.
> >
> > linux-tuxedo:~/.build/vim/vim-hg/src/shadow-normal # (make -j4 || echo
> > 'exit status' $? ; date) 2>&1 |tee -a make.log
>
> [...]
>
> > 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/libpng16 -I/usr/include/pixman-1
> > -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/at-spi-2.0 -I/usr/include/dbus-1.0
> > -I/usr/lib64/dbus-1.0/include -pthread    -O2 -fno-strength-reduce
> > -Wall -Wno-deprecated-declarations -D_REENTRANT -U_FORTIFY_SOURCE
> > -D_FORTIFY_SOURCE=1        -o objects/memline.o memline.c
>
> [...]
>
> > memline.c: In function ‘adjust_text_props_for_delete’:
> > memline.c:3667:43: warning: ‘this_props_len’ may be used uninitialized
> > [-Wmaybe-uninitialized]
> >  3667 |             for (done_this = 0; done_this < this_props_len;
> >       |                                 ~~~~~~~~~~^~~~~~~~~~~~~~~~
> > memline.c:3626:17: note: ‘this_props_len’ was declared here
> >  3626 |     int         this_props_len;
> >       |                 ^~~~~~~~~~~~~~
> > In file included from vim.h:244,
> >                  from memline.c:45:
> > memline.c:3674:56: warning: ‘text’ may be used uninitialized
> > [-Wmaybe-uninitialized]
> >  3674 |                 mch_memmove(&prop_this, text + textlen + done_this,
> > os_unix.h:430:68: note: in definition of macro ‘mch_memmove’
> >   430 | # define mch_memmove(to, from, len) memmove((char *)(to),
> > (char *)(from), len)
> >       |                                                                    
> > ^~~~
> > memline.c:3627:18: note: ‘text’ was declared here
> >  3627 |     char_u      *text;
> >       |                  ^~~~
> > memline.c:3674:56: warning: ‘textlen’ may be used uninitialized
> > [-Wmaybe-uninitialized]
> >  3674 |                 mch_memmove(&prop_this, text + textlen + done_this,
> >       |                                                        ^
> > os_unix.h:430:68: note: in definition of macro ‘mch_memmove’
> >   430 | # define mch_memmove(to, from, len) memmove((char *)(to),
> > (char *)(from), len)
> >       |                                                                    
> > ^~~~
> > memline.c:3628:17: note: ‘textlen’ was declared here
> >  3628 |     size_t      textlen;
> >       |                 ^~~~~~~
>
> These warnings are all because the compiler doesn't recognize that the
> block after "if (!did_get_line)" is always executed, since did_get_line
> is initialized to FALSE.  These are bogus warnings.
>
> The warnings can be avoided by initializing the variables.  But this
> should not be needed.  It may also be confusion and even mistakes when
> later changing this code.
>
> I cannot reproduce these warnings.  I assume it depends on the version
> of the compiler.  For me "gcc --version" results in:
>
> gcc (Ubuntu 12.2.0-3ubuntu1) 12.2.0
> 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.

For me "gcc --version" results in the following (I'm including the
shell prompts before and after to display the empty line):

linux-tuxedo:~/.build/vim/vim-hg # gcc --version
gcc (SUSE Linux) 13.0.1 20230421 (prerelease) [revision
f980561c60b0446cc427595198d7f3f4f90e0924]
Copyright (C) 2023 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.

linux-tuxedo:~/.build/vim/vim-hg #

The 40-nybble string after "revision" should of course be on the same
line; my mailer puts it on the next line for the sake of width.

I have reconfigured my "normal" build to use Motif GUI (now and in the
future) rather than GTK3 so I'll have a build with +eval and a non-GTK
GUI. As I suppose you would expect, these warnings are still present
in its "make reconfig" listing.

I can live with bogus warnings, but of course they make "true"
warnings harder to notice, especially if they happen in the same
module.

Best regards,
Tony.

-- 
-- 
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/CAJkCKXvt6n8LMHcZ%3DYLTrqVdRX%2B6mQs9g3FtvcbE4coBf-S1mw%40mail.gmail.com.

Raspunde prin e-mail lui