On 31-Jan-2022 05:41, Bram Moolenaar wrote:
Patch 8.2.4264
Problem: Vim9: can use old style autoload function name.
Solution: Give an error for old style autoload function name.
Files: src/errors.h, src/userfunc.c, src/testdir/test_vim9_import.vim,
src/testdir/test_vim9_func.vim, src/testdir/test_vim9_script.vim
After this patch, mingw64 (gcc 11.2.0) throws this warning:
<snip>
gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603
-DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -D__USE_MINGW_ANSI_STDIO
-pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return
-fpie -fPIE -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD userfunc.c -o
gobjnative/userfunc.o
userfunc.c: In function 'define_function':
userfunc.c:4833:14: warning: 'saved_did_emsg' may be used uninitialized
in this function [-Wmaybe-uninitialized]
4833 | did_emsg |= saved_did_emsg;
| ^~
</snip>
The attached patch tries to fix it.
By the way, are we sure that line 4833 (did_emsg |= saved_did_emsg) is
correct? Shouldn't it be: did_emsg = save_did_emsg?
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/a8bc2db2-75a1-50eb-db9f-b672562b1770%40internode.on.net.
--- userfunc.c.orig 2022-01-31 05:45:05.539685500 +1100
+++ userfunc.c 2022-01-31 06:09:47.930548300 +1100
@@ -4173,6 +4173,11 @@
ga_init(&argtypes);
ga_init(&default_args);
+ // An error in a function call during evaluation of an expression in magic
+ // braces should not cause the function not to be defined.
+ saved_did_emsg = did_emsg;
+ did_emsg = FALSE;
+
/*
* Get the function name. There are these situations:
* func normal function name
@@ -4239,11 +4244,6 @@
}
}
- // An error in a function call during evaluation of an expression in magic
- // braces should not cause the function not to be defined.
- saved_did_emsg = did_emsg;
- did_emsg = FALSE;
-
/*
* ":function func" with only function name: list function.
*/