Commit: patch 9.1.0066: gcc complains about use of uninitialized var

13 views
Skip to first unread message

Christian Brabandt

unread,
Jan 31, 2024, 2:45:09 PM1/31/24
to vim...@googlegroups.com
patch 9.1.0066: gcc complains about use of uninitialized var

Commit: https://github.com/vim/vim/commit/f2fb7dd3d3bb94fc51347c25d2829bb0a80c8719
Author: Christian Brabandt <c...@256bit.org>
Date: Wed Jan 31 20:29:07 2024 +0100

patch 9.1.0066: gcc complains about use of uninitialized var

Problem: gcc complains about use of uninitialized var
(Tony Mechelynck, after 9.1.0064)
Solution: initialize button to silence gcc

Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/gui_gtk_x11.c b/src/gui_gtk_x11.c
index 187123739..a62b39c09 100644
--- a/src/gui_gtk_x11.c
+++ b/src/gui_gtk_x11.c
@@ -1985,7 +1985,7 @@ button_press_event(GtkWidget *widget,
GdkEventButton *event,
gpointer data UNUSED)
{
- int button;
+ int button = 0; // silence gcc
int repeated_click = FALSE;
int x, y;
int_u vim_modifiers;
diff --git a/src/version.c b/src/version.c
index b361a9caa..d12d4e108 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
+/**/
+ 66,
/**/
65,
/**/

Tony Mechelynck

unread,
Jan 31, 2024, 3:50:17 PM1/31/24
to Christian Brabandt, vim...@googlegroups.com
On Wed, Jan 31, 2024 at 8:45 PM Christian Brabandt <cbl...@256bit.org> wrote:
>
> patch 9.1.0066: gcc complains about use of uninitialized var
>
> Commit: https://github.com/vim/vim/commit/f2fb7dd3d3bb94fc51347c25d2829bb0a80c8719
> Author: Christian Brabandt <c...@256bit.org>
> Date: Wed Jan 31 20:29:07 2024 +0100
>
> patch 9.1.0066: gcc complains about use of uninitialized var
>
> Problem: gcc complains about use of uninitialized var
> (Tony Mechelynck, after 9.1.0064)
> Solution: initialize button to silence gcc
>
> Signed-off-by: Christian Brabandt <c...@256bit.org>
>
After applying this patch (and all before, and changes to Filelist and
runtime/indent/racket.vim after it) I still see the following :

gui_gtk_x11.c: In function ‘scroll_event’:
gui_gtk_x11.c:2135:9: warning: ‘button’ may be used uninitialized
[-Wmaybe-uninitialized]
2135 | gui_send_mouse_event(button, (int)event->x, (int)event->y,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
2136 | FALSE, vim_modifiers);
| ~~~~~~~~~~~~~~~~~~~~~
gui_gtk_x11.c:2059:13: note: ‘button’ was declared here
2059 | int button;
| ^~~~~~

(The problematic line is line 2059, not line 1988. I checked my
previous email, and there too it was line 2059. GTK2 vs GTK3 ? Or
something else ?)

Best regards,
Tony.

Christian Brabandt

unread,
Jan 31, 2024, 4:19:01 PM1/31/24
to vim...@googlegroups.com

On Mi, 31 Jan 2024, Tony Mechelynck wrote:

> gui_gtk_x11.c: In function ‘scroll_event’:
> gui_gtk_x11.c:2135:9: warning: ‘button’ may be used uninitialized
> [-Wmaybe-uninitialized]
> 2135 | gui_send_mouse_event(button, (int)event->x, (int)event->y,
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 2136 | FALSE, vim_modifiers);
> | ~~~~~~~~~~~~~~~~~~~~~
> gui_gtk_x11.c:2059:13: note: ‘button’ was declared here
> 2059 | int button;
> | ^~~~~~
>
> (The problematic line is line 2059, not line 1988. I checked my
> previous email, and there too it was line 2059. GTK2 vs GTK3 ? Or
> something else ?)

:facepalm I wanted to change line 2059, not 1988.

That's what happens after a long working day, starring at too many
computer displays :/

Should be fixed in a second.

Thanks,
Christian
--
"Only the hypocrite is really rotten to the core."
-- Hannah Arendt.
Reply all
Reply to author
Forward
0 new messages