Warning or error (depending on featureset) trying to build Vim 9.0.156 (after applying patches 151 to 156)

9 views
Skip to first unread message

Tony Mechelynck

unread,
Aug 6, 2022, 4:08:44 PM8/6/22
to Bram Moolenaar, vim_dev
In the Huge, Big and Normal builds I get -Wmaybe-uninitialized
warnings for line_attr in drawline.c but they are different in each
case; I don't understand getting a -Wmaybe-uninitialized for a
variable which was given an initial value on the line declaring it.
This is gcc 12.1.1 20220721:

* In the Huge 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/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:2767:47: warning: ‘line_attr’ may be used uninitialized
[-Wmaybe-uninitialized]
2762 | else if ((
| ~
2763 | # ifdef FEAT_DIFF
| ~~~~~~~~~~~~~~~~~
2764 | wlv.diff_hlf != (hlf_T)0 ||
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~
2765 | # endif
| ~~~~~~~
2766 | # ifdef FEAT_TERMINAL
| ~~~~~~~~~~~~~~~~~~~~~
2767 | wlv.win_attr != 0 ||
| ~~~~~~~~~~~~~~~~~~^~
2768 | # endif
| ~~~~~~~
2769 | line_attr != 0
| ~~~~~~~~~~~~~~
2770 | ) && (
| ~
drawline.c:590:17: note: ‘line_attr’ was declared here
590 | int line_attr = 0; // attribute for the whole line
| ^~~~~~~~~

* In the Big 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/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:590:17: warning: ‘line_attr’ may be used uninitialized
[-Wmaybe-uninitialized]
590 | int line_attr = 0; // attribute for the whole line
| ^~~~~~~~~

* In the 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/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:2792:39: warning: ‘line_attr’ may be used uninitialized
[-Wmaybe-uninitialized]
2792 | wlv.char_attr = line_attr;
| ~~~~~~~~~~~~~~^~~~~~~~~~~
drawline.c:590:17: note: ‘line_attr’ was declared here
590 | int line_attr = 0; // attribute for the whole line
| ^~~~~~~~~

In the Small and Timy builds, this warning does not appear, but
compilation stops after finding an undefined identifier in ex_docmd.c:

gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -fno-strength-reduce -Wall
-Wno-deprecated-declarations -D_REENTRANT -U_FORTIFY_SOURCE
-D_FORTIFY_SOURCE=1 -o objects/ex_docmd.o ex_docmd.c
In file included from ex_docmd.c:14:
ex_docmd.c: In function ‘parse_command_modifiers’:
ex_docmd.c:2851:35: error: ‘e_cannot_use_hash_curly_to_start_comment’
undeclared (first use in this function)
2851 | *errormsg =
_(e_cannot_use_hash_curly_to_start_comment);
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim.h:564:25: note: in definition of macro ‘_’
564 | # define _(x) ((char *)(x))
| ^
ex_docmd.c:2851:35: note: each undeclared identifier is reported only
once for each function it appears in
2851 | *errormsg =
_(e_cannot_use_hash_curly_to_start_comment);
|
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
vim.h:564:25: note: in definition of macro ‘_’
564 | # define _(x) ((char *)(x))
| ^
make: *** [Makefile:3222: objects/ex_docmd.o] Error 1
exit status 2
Sat 6 Aug 21:32:55 CEST 2022
linux-tuxedo:~/.build/vim/vim-hg/src/shadow-tiny #


Best regards,
Tony.

Bram Moolenaar

unread,
Aug 6, 2022, 5:37:41 PM8/6/22
to vim...@googlegroups.com, Tony Mechelynck

Tony wrote:

> In the Huge, Big and Normal builds I get -Wmaybe-uninitialized
> warnings for line_attr in drawline.c but they are different in each
> case; I don't understand getting a -Wmaybe-uninitialized for a
> variable which was given an initial value on the line declaring it.
> This is gcc 12.1.1 20220721:

line_attr itself is initialized, but it gets assigned from
line_attr_save, which the compiler thinks might be uninitialized.

The compiler could be clearer about why it came to this warning.
Otherwise it requires quite a bit of guessing.

--
hundred-and-one symptoms of being an internet addict:
264. You turn to the teletext page "surfing report" and are surprised that it
is about sizes of waves and a weather forecast for seaside resorts.

/// 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,
Aug 6, 2022, 6:00:19 PM8/6/22
to Bram Moolenaar, vim...@googlegroups.com
On Sat, Aug 6, 2022 at 11:37 PM Bram Moolenaar <Br...@moolenaar.net> wrote:
>
>
> Tony wrote:
>
> > In the Huge, Big and Normal builds I get -Wmaybe-uninitialized
> > warnings for line_attr in drawline.c but they are different in each
> > case; I don't understand getting a -Wmaybe-uninitialized for a
> > variable which was given an initial value on the line declaring it.
> > This is gcc 12.1.1 20220721:
>
> line_attr itself is initialized, but it gets assigned from
> line_attr_save, which the compiler thinks might be uninitialized.
>
> The compiler could be clearer about why it came to this warning.

...especially in the Big build where it tells me nothing more than
«line_attr might be used uninitialized; it is defined as "int
line_attr = 0"».

> Otherwise it requires quite a bit of guessing.

Patch 159 clears the -eval error and patch 161 clears the +eval
warning which had me baffled. Thanks for finding out and explaining.

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