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.


-- 
BLACK KNIGHT: None shall pass.
ARTHUR:       I have no quarrel with you, brave Sir knight, but I must cross
              this bridge.
BLACK KNIGHT: Then you shall die.
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// 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/20230429132628.E10C71C03D0%40moolenaar.net.

Raspunde prin e-mail lui