On 28-May-2022 03:06, Bram Moolenaar wrote:
Patch 8.2.5030
Problem:    autocmd_add() can only handle one event and pattern.
Solution:   Support a list of events and patterns. (Yegappan Lakshmanan,
             closes #10483)
Files:      runtime/doc/builtin.txt, src/autocmd.c, src/errors.h,
             src/testdir/test_autocmd.vim



After this patch mingw64 (gcc 11.3.0) spits out this error if FEAT_QUICKFIX is not defined:
<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 autocmd.c -o gobjnative/autocmd.o
In file included from autocmd.c:14:
autocmd.c: In function 'autocmd_add_or_delete':
autocmd.c:2828:24: error: 'e_string_or_list_expected' undeclared (first use in this function)
 2828 |                 emsg(_(e_string_or_list_expected));
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~
vim.h:564:25: note: in definition of macro '_'
  564 | # define _(x) ((char *)(x))
      |                         ^
autocmd.c:2828:24: note: each undeclared identifier is reported only once for each function it appears in
 2828 |                 emsg(_(e_string_or_list_expected));
      |                        ^~~~~~~~~~~~~~~~~~~~~~~~~
vim.h:564:25: note: in definition of macro '_'
  564 | # define _(x) ((char *)(x))
      |                         ^
make: *** [Make_cyg_ming.mak:1187: gobjnative/autocmd.o] Error 1
</snip>

The attached patch of errors.h tries to fix it.



After applying this patch, mingw64 then spat out 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 autocmd.c -o gobjnative/autocmd.o
autocmd.c: In function 'f_autocmd_add':
autocmd.c:2967:20: warning: 'p' may be used uninitialized in this function [-Wmaybe-uninitialized]
 2967 |                 if (p == NULL)
      |                    ^
autocmd.c:2772:18: note: 'p' was declared here
 2772 |     char_u      *p;
      |                  ^
autocmd.c: In function 'f_autocmd_delete':
autocmd.c:2967:20: warning: 'p' may be used uninitialized in this function [-Wmaybe-uninitialized]
 2967 |                 if (p == NULL)
      |                    ^
autocmd.c:2772:18: note: 'p' was declared here
 2772 |     char_u      *p;
      |                  ^
</snip>

The attached patch of autocmd.c tries to fix 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/933e88bd-1f57-492a-d871-1882302a9cdd%40internode.on.net.
--- autocmd.c.orig      2022-05-28 05:16:51.294478700 +1000
+++ autocmd.c   2022-05-28 05:17:06.085181100 +1000
@@ -2769,7 +2769,6 @@
     listitem_T *pli;
     char_u     *cmd = NULL;
     char_u     *end;
-    char_u     *p;
     int                once;
     int                nested;
     int                replace;                // replace the cmd for a 
group/event
@@ -2937,6 +2936,8 @@
        }
        else
        {
+           char_u      *p = NULL;
+
            eli = NULL;
            end = NULL;
            while (TRUE)
--- errors.h.orig       2022-05-28 04:59:44.487914400 +1000
+++ errors.h    2022-05-28 05:07:11.723421600 +1000
@@ -1953,10 +1953,10 @@
 #ifdef FEAT_QUICKFIX
 EXTERN char e_no_location_list[]
        INIT(= N_("E776: No location list"));
+#endif
 # ifdef FEAT_EVAL
 EXTERN char e_string_or_list_expected[]
        INIT(= N_("E777: String or List expected"));
-# endif
 #endif
 #ifdef FEAT_SPELL
 EXTERN char e_this_does_not_look_like_sug_file_str[]

Raspunde prin e-mail lui