On 21-Dec-2022 07:02, Bram Moolenaar wrote:
Patch 9.0.1084
Problem: Code handling low level MS-Windows events cannot be tested.
Solution: Add test_mswin_event() and tests using it. (Christopher Plewright,
closes #11622)
Files: runtime/doc/builtin.txt, runtime/doc/testing.txt,
runtime/doc/usr_41.txt, src/evalfunc.c, src/gui_w32.c,
src/os_win32.c, src/proto/gui_w32.pro, src/proto/os_win32.pro,
src/proto/testing.pro, src/term.c, src/testing.c,
src/testdir/Make_all.mak, src/testdir/mouse.vim,
src/testdir/test_gui.vim, src/testdir/test_mswin_event.vim,
src/testdir/test_termcodes.vim
After this patch, msys64 (clang 15.0.5) reports these warnings:
<snip>
clang -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603
-DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO
-pipe -Wall -O3 -fomit-frame-pointer -fpie -fPIE os_win32.c -o
objx86-64/os_win32.o
os_win32.c:1760:9: warning: variable 'mods' is used uninitialized
whenever 'if' condition is true [-Wsometimes-uninitialized]
if (move)
^~~~
os_win32.c:1826:9: note: uninitialized use occurs here
if (mods != 0)
^~~~
os_win32.c:1760:5: note: remove the 'if' if its condition is always false
if (move)
^~~~~~~~~
os_win32.c:1738:15: note: initialize the variable 'mods' to silence this
warning
int_u mods;
^
= 0
os_win32.c:1883:1: warning: unused function 'peek_input_record_buffer'
[-Wunused-function]
peek_input_record_buffer(INPUT_RECORD* irEvents, int nMaxLength)
^
2 warnings generated.
</snip>
The attached patch tries to fix both warnings.
It seems that the function peek_input_record_buffer() is not used
anywhere. So the patch removes it.
Cheers
John
--
--
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/87deea88-7ebb-0ef0-f3b6-c98fa228253a%40internode.on.net.
--- os_win32.c.orig 2022-12-21 07:22:07.211294800 +1100
+++ os_win32.c 2022-12-21 07:28:29.770357500 +1100
@@ -193,7 +193,6 @@
int length;
} input_record_buffer_T;
static input_record_buffer_T input_record_buffer;
-static int peek_input_record_buffer(INPUT_RECORD* irEvents, int nMaxLength);
static int read_input_record_buffer(INPUT_RECORD* irEvents, int nMaxLength);
static int write_input_record_buffer(INPUT_RECORD* irEvents, int nLength);
#endif
@@ -1735,7 +1734,7 @@
int row;
int col;
int repeated_click;
- int_u mods;
+ int_u mods = 0;
int move;
if (!dict_has_key(args, "row") || !dict_has_key(args, "col"))
@@ -1879,18 +1878,6 @@
}
return nCount;
}
- static int
-peek_input_record_buffer(INPUT_RECORD* irEvents, int nMaxLength)
-{
- int nCount = 0;
- input_record_buffer_node_T *temp = input_record_buffer.head;
- while (nCount < nMaxLength && temp != NULL)
- {
- irEvents[nCount++] = temp->ir;
- temp = temp->next;
- }
- return nCount;
-}
#endif // !FEAT_GUI_MSWIN || VIMDLL
#ifdef FEAT_EVAL