Re: Patch 8.2.4678

2022-04-03 Fir de Conversatie Bram Moolenaar


John Marriott wrote:

> On 04-Apr-2022 06:12, Bram Moolenaar wrote:
> > Patch 8.2.4678
> > Problem:Vim9: not all code is tested.
> > Solution:   Add a few more tests.
> > Files:  src/vim9execute.c, src/testdir/test_vim9_script.vim,
> >  src/testdir/test_vim9_import.vim, src/testdir/test_vim9_cmd.> 
> > vim
> >
> >
> >
> After this patch, mingw64 (gcc 11.2.0) throws this error:
> 
> 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 vim9execute.c -o 
> gobjnative/vim9execute.o
> In file included from vim9execute.c:15:
> vim9execute.c: In function 'exec_instructions':
> vim9execute.c:2640:37: error: 'e_cant_open_file_str_2' undeclared (first 
> use in this function); did you mean 'e_cant_open_file_str'?
>   2640 |  > Â>    semsg(_(e_cant_open_file_str_2), 
> si->sn_name);
>    |   > Â>  >  ^~
> vim.h:564:25: note: in definition of macro '_'
>    564 | # define _(x) ((char *)(x))
>    |   > Â>   ^
> vim9execute.c:2640:37: note: each undeclared identifier is reported only 
> once for each function it appears in
>   2640 |  > Â>    semsg(_(e_cant_open_file_str_2), 
> si->sn_name);
>    |   > Â>  >  ^~
> vim.h:564:25: note: in definition of macro '_'
>    564 | # define _(x) ((char *)(x))
>    |   > Â>   ^
> make: *** [Make_cyg_ming.mak:1187: gobjnative/vim9execute.o] Error 1
> 
> 
> The attached patch tries to fix it.

I had just sent out a patch to fix this.

> Also, I noticed that two error messages have the same error number in 
> errors.h:

Missing quote?

If it's a very similar error, that would be OK.

-- 
BRIDGEKEEPER: What is the air-speed velocity of an unladen swallow?
ARTHUR:   What do you mean?  An African or European swallow?
BRIDGEKEEPER: Er ...  I don't know that ... Arrggghhh!
   BRIDGEKEEPER is cast into the gorge.
 "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/20220403210047.82C9D1C05DA%40moolenaar.net.


Re: Patch 8.2.4678

2022-04-03 Fir de Conversatie John Marriott


On 04-Apr-2022 06:12, Bram Moolenaar wrote:

Patch 8.2.4678
Problem:Vim9: not all code is tested.
Solution:   Add a few more tests.
Files:  src/vim9execute.c, src/testdir/test_vim9_script.vim,
 src/testdir/test_vim9_import.vim, src/testdir/test_vim9_cmd.vim




After this patch, mingw64 (gcc 11.2.0) throws this error:

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 vim9execute.c -o 
gobjnative/vim9execute.o

In file included from vim9execute.c:15:
vim9execute.c: In function 'exec_instructions':
vim9execute.c:2640:37: error: 'e_cant_open_file_str_2' undeclared (first 
use in this function); did you mean 'e_cant_open_file_str'?
 2640 | semsg(_(e_cant_open_file_str_2), 
si->sn_name);

  | ^~
vim.h:564:25: note: in definition of macro '_'
  564 | # define _(x) ((char *)(x))
  | ^
vim9execute.c:2640:37: note: each undeclared identifier is reported only 
once for each function it appears in
 2640 | semsg(_(e_cant_open_file_str_2), 
si->sn_name);

  | ^~
vim.h:564:25: note: in definition of macro '_'
  564 | # define _(x) ((char *)(x))
  | ^
make: *** [Make_cyg_ming.mak:1187: gobjnative/vim9execute.o] Error 1


The attached patch tries to fix it.

Also, I noticed that two error messages have the same error number in 
errors.h:




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/7060f31a-7608-b503-bd4b-361487bf2494%40internode.on.net.
--- errors.h.orig   2022-04-01 05:46:13.356515400 +1100
+++ errors.h2022-04-04 06:42:25.760817400 +1000
@@ -1123,8 +1123,10 @@
 #ifdef FEAT_POSTSCRIPT
 EXTERN char e_error_writing_to_postscript_output_file[]
INIT(= N_("E455: Error writing to PostScript output file"));
+#endif
 EXTERN char e_cant_open_file_str_2[]
INIT(= N_("E456: Can't open file \"%s\""));
+#ifdef FEAT_POSTSCRIPT
 EXTERN char e_cant_find_postscript_resource_file_str_ps[]
INIT(= N_("E456: Can't find PostScript resource file \"%s.ps\""));
 EXTERN char e_cant_read_postscript_resource_file_str[]


Patch 8.2.4678

2022-04-03 Fir de Conversatie Bram Moolenaar


Patch 8.2.4678
Problem:Vim9: not all code is tested.
Solution:   Add a few more tests.
Files:  src/vim9execute.c, src/testdir/test_vim9_script.vim,
src/testdir/test_vim9_import.vim, src/testdir/test_vim9_cmd.vim


*** ../vim-8.2.4677/src/vim9execute.c   2022-04-01 15:26:54.988558723 +0100
--- src/vim9execute.c   2022-04-03 19:46:09.277664634 +0100
***
*** 2636,2642 
--- 2636,2645 
SOURCING_LNUM = iptr->isn_lnum;
if (do_source(si->sn_name, FALSE, DOSO_NONE, NULL)
   == FAIL)
+   {
+   semsg(_(e_cant_open_file_str_2), si->sn_name);
goto on_error;
+   }
}
}
break;
*** ../vim-8.2.4677/src/testdir/test_vim9_script.vim2022-04-03 
16:13:03.420370565 +0100
--- src/testdir/test_vim9_script.vim2022-04-03 21:10:45.923612372 +0100
***
*** 2130,2135 
--- 2130,2146 
endfor
assert_equal('', res)
  
+   total = 0
+   for c in null_list
+ total += 1
+   endfor
+   assert_equal(0, total)
+ 
+   for c in null_blob
+ total += 1
+   endfor
+   assert_equal(0, total)
+ 
var foo: list> = [
{a: 'Cat'}
  ]
*** ../vim-8.2.4677/src/testdir/test_vim9_import.vim2022-03-31 
16:18:19.916278625 +0100
--- src/testdir/test_vim9_import.vim2022-04-03 20:26:55.879006212 +0100
***
*** 858,863 
--- 858,865 
writefile(lines, 'XimportRel.vim')
writefile(lines, 'XimportRel2.vim')
writefile(lines, 'XimportRel3.vim')
+   writefile(lines, 'XimportRel4.vim')
+   writefile(lines, 'XimportRel5.vim')
  
lines =<< trim END
vim9script
***
*** 928,944 
END
v9.CheckScriptFailure(lines, 'E1049: Item not exported in script: notexp', 
1)
  
lines =<< trim END
vim9script
!   import autoload './XimportRel.vim'
def Func()
! XimportRel.notexp = 'bad'
enddef
Func()
END
v9.CheckScriptFailure(lines, 'E1049: Item not exported in script: notexp', 
1)
  
!   # does not fail if the script wasn't loaded yet
g:loaded = 'no'
lines =<< trim END
vim9script
--- 930,947 
END
v9.CheckScriptFailure(lines, 'E1049: Item not exported in script: notexp', 
1)
  
+   # Same, script not imported before
lines =<< trim END
vim9script
!   import autoload './XimportRel4.vim'
def Func()
! echo XimportRel4.notexp
enddef
Func()
END
v9.CheckScriptFailure(lines, 'E1049: Item not exported in script: notexp', 
1)
  
!   # does not fail if the script wasn't loaded yet and only compiling
g:loaded = 'no'
lines =<< trim END
vim9script
***
*** 951,956 
--- 954,969 
v9.CheckScriptSuccess(lines)
assert_equal('no', g:loaded)
  
+   lines =<< trim END
+   vim9script
+   import autoload './XimportRel.vim'
+   def Func()
+ XimportRel.notexp = 'bad'
+   enddef
+   Func()
+   END
+   v9.CheckScriptFailure(lines, 'E1049: Item not exported in script: notexp', 
1)
+ 
# fails with a not loaded import
lines =<< trim END
vim9script
***
*** 964,972 
--- 977,1013 
assert_equal('yes', g:loaded)
unlet g:loaded
  
+   lines =<< trim END
+   vim9script
+   import autoload './XimportRel5.vim'
+   def Func()
+ XimportRel5.nosuchvar = 'bad'
+   enddef
+   Func()
+   END
+   v9.CheckScriptFailure(lines, 'E121: Undefined variable: nosuchvar', 1)
+   unlet g:loaded
+ 
+   # nasty: delete script after compiling function
+   writefile(['vim9script'], 'XimportRelDel.vim')
+   lines =<< trim END
+   vim9script
+ 
+   import autoload './XimportRelDel.vim'
+   def DoIt()
+ echo XimportRelDel.var
+   enddef
+   defcompile
+   delete('XimportRelDel.vim')
+   DoIt()
+   END
+   v9.CheckScriptFailure(lines, 'E456:')
+ 
delete('XimportRel.vim')
delete('XimportRel2.vim')
delete('XimportRel3.vim')
+   delete('XimportRel4.vim')
+   delete('XimportRel5.vim')
  enddef
  
  def Test_autoload_import_relative_autoload_dir()
***
*** 1576,1585 
var lines =<< trim END
vim9script
  
!   if exists('g:loaded')
  finish
endif
!   g:loaded = 1
delcommand CallFunc
command CallFunc Func()
def Func()
--- 1617,1626 
var lines =<< trim END
vim9script
  
!   if exists('g:loadedThis')
  finish
endif
!   g:loadedThis = 1
delcommand CallFunc
command CallFunc Func()
def Func()
***
*** 1594,1600 
  
delete('Xrelo