Re: Patch 8.2.4264

2022-01-30 Fir de Conversatie John Marriott




On 31-Jan-2022 07:01, Bram Moolenaar wrote:


I saw your patch only after sending out patch 8.2.4266.  The effect
should be the same.


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?

We don't want to reset did_emsg here.  It's a corner case anyway, the
comment mentions "magic braces":

 // An error in a function call during evaluation of an expression in magic
 // braces should not cause the function not to be defined.

I'm not sure this is true, we usually abort when an error is detected.
But I don't like to change old behavior unless we know why it was done
that way.



No worries.

--
--
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/04efd22b-5f10-b702-68bd-66515797d3ef%40internode.on.net.


Re: Patch 8.2.4264

2022-01-30 Fir de Conversatie Bram Moolenaar


John Marriott wrote:

> 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:
> 
> 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;
>    |  ^~
> 
> 
> The attached patch tries to fix it.

I saw your patch only after sending out patch 8.2.4266.  The effect
should be the same.

> 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?

We don't want to reset did_emsg here.  It's a corner case anyway, the
comment mentions "magic braces":

// An error in a function call during evaluation of an expression in magic
// braces should not cause the function not to be defined.

I'm not sure this is true, we usually abort when an error is detected.
But I don't like to change old behavior unless we know why it was done
that way.


-- 
DENNIS: You can't expect to wield supreme executive power just 'cause some
watery tart threw a sword at you!
 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- b...@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///

-- 
-- 
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 vim_dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/vim_dev/20220130200141.5BC2E1C1918%40moolenaar.net.


Re: Patch 8.2.4264

2022-01-30 Fir de Conversatie John Marriott


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:

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;
  |  ^~


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 vim_dev+unsubscr...@googlegroups.com.
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();
 ga_init(_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:
  * funcnormal 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.
  */