On 03-Sep-2019 07:50, Yegappan Lakshmanan wrote:
Hi,

On Mon, Sep 2, 2019 at 1:47 PM John Marriott <[email protected]> wrote:
On 03-Sep-2019 06:32, Bram Moolenaar wrote:
Patch 8.1.1966
Problem:    Some code in options.c fits better elsewhere.
Solution:   Move functions from options.c to other files. (Yegappan
              Lakshmanan, closes #4889)
Files:            src/evalfunc.c, src/globals.h, src/indent.c, src/map.c,
              src/option.c, src/proto/map.pro, src/proto/option.pro,
              src/proto/quickfix.pro, src/proto/screen.pro, src/proto/spell.pro,
              src/proto/window.pro, src/quickfix.c, src/screen.c, src/spell.c,
              src/window.c
After this patch, gcc (mingw) throws these errors:

I built Vim 8.1.1967 using mingw-w64 GCC on MS-Windows without these errors.
Can you make sure that the changes to the src/quickfix.c and
src/proto/quickfix.pro
files are present in your view?

- Yegappan

I use git to keep the sources up to date. I downloaded the tar.gz archive and got the same result. I am happy that the files were updated correctly.

It turns out that I have both FEAT_QUICKFIX and FEAT_TEXT_PROP (amongst other things) disabled for this build. The attached patches "8.1.1966.quickfix.pro.patch" and "8.1.1966.evalfunc.pro.patch" fixes the error for me.


I tried some experimentation. If I have FEAT_QUICKFIX enabled, but FEAT_TEXT_PROP disabled, I get a warning and a couple of errors.

The warning:

gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD -pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return buffer.c -o gobjnative/buffer.o buffer.c:5507:1: warning: 'find_win_for_buf' defined but not used [-Wunused-function]
 5507 | find_win_for_buf(
      | ^~~~~~~~~~~~~~~~

The attached patch "8.1.1966.buffer.c.patch" tries to fix this.

The first error:

gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD -pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return popupmnu.c -o gobjnative/popupmnu.o
popupmnu.c: In function 'pum_set_selected':
popupmnu.c:763:6: error: 'has_info' undeclared (first use in this function); did you mean 'hash_init'?
763 |      has_info = TRUE;
      |      ^~~~~~~~
      |      hash_init

The attached patch "8.1.1966.popupmnu.c.patch" tries to fix this.

The second error:

gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -DFEAT_GUI_MSWIN -DFEAT_CLIPBOARD -pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return quickfix.c -o gobjnative/quickfix.o
quickfix.c: In function 'qf_jump_newwin':
quickfix.c:3430:22: error: 'old_KeyTyped' undeclared (first use in this function); did you mean 'KeyTyped'?
 3430 |      &opened_window, old_KeyTyped, print_message);
      |                      ^~~~~~~~~~~~
      |                      KeyTyped

The attached patch "8.1.1966.quickfix.c.patch" tries to fix this. This was caused by having FEAT_FOLDING disabled.


Now if I enable both FEAT_QUICKFIX and FEAT_TEXT_PROP, I get some warnings and a linker error.

The warnings:

gcc -c -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return memline.c -o objnative/memline.o
In file included from memline.c:45:
memline.c: In function 'ml_append_int':
vim.h:1694:37: warning: 'line' may be used uninitialized in this function [-Wmaybe-uninitialized]  1694 | # define mch_memmove(to, from, len) memmove((char*)(to), (char*)(from), (size_t)(len))
      | ^~~~~~~
memline.c:2774:13: note: 'line' was declared here
 2774 |     char_u *line = line_arg;
      | ^~~~
memline.c:3281:5: warning: 'tofree' may be used uninitialized in this function [-Wmaybe-uninitialized]
 3281 | vim_free(tofree);
      | ^~~~~~~~~~~~~~~~
memline.c:2719:10: warning: 'new_len' may be used uninitialized in this function [-Wmaybe-uninitialized]
 2719 |     int new_len;
      | ^~~~~~~

The warning from line 2719 seems straightforward but the others are just weird. I wonder if gcc has lost the plot here.

I also get this linker error when building vim.exe (the console version):

gcc -I. -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -pipe -march=native -Wall -O3 -fomit-frame-pointer -freg-struct-return -Wl,-nxcompat,-dynamicbase -municode -s -o vim.exe objnative/arabic.o objnative/arglist.o objnative/autocmd.o objnative/beval.o objnative/blob.o objnative/blowfish.o objnative/buffer.o objnative/change.o objnative/charset.o objnative/cmdexpand.o objnative/cmdhist.o objnative/crypt.o objnative/crypt_zip.o objnative/debugger.o objnative/dict.o objnative/diff.o objnative/digraph.o objnative/edit.o objnative/eval.o objnative/evalfunc.o objnative/evalvars.o objnative/ex_cmds.o objnative/ex_cmds2.o objnative/ex_docmd.o objnative/ex_eval.o objnative/ex_getln.o objnative/fileio.o objnative/findfile.o objnative/fold.o objnative/getchar.o objnative/hardcopy.o objnative/hashtab.o objnative/highlight.o objnative/indent.o objnative/insexpand.o objnative/json.o objnative/list.o objnative/main.o objnative/map.o objnative/mark.o objnative/memfile.o objnative/memline.o objnative/menu.o objnative/message.o objnative/misc1.o objnative/misc2.o objnative/move.o objnative/mbyte.o objnative/normal.o objnative/ops.o objnative/option.o objnative/os_mswin.o objnative/os_win32.o objnative/pathdef.o objnative/popupmnu.o objnative/popupwin.o objnative/profiler.o objnative/quickfix.o objnative/regexp.o objnative/scriptfile.o objnative/screen.o objnative/search.o objnative/session.o objnative/sha256.o objnative/sign.o objnative/spell.o objnative/spellfile.o objnative/syntax.o objnative/tag.o objnative/term.o objnative/testing.o objnative/textprop.o objnative/ui.o objnative/undo.o objnative/usercmd.o objnative/userfunc.o objnative/version.o objnative/viminfo.o objnative/winclip.o objnative/window.o objnative/os_w32exe.o objnative/vimrc.o objnative/xdiffi.o objnative/xemit.o objnative/xprepare.o objnative/xutils.o objnative/xhistogram.o objnative/xpatience.o objnative/iscygpty.o -lkernel32 -luser32 -lgdi32 -ladvapi32 -lcomdlg32 -lcomctl32 -lnetapi32 -lversion -lole32 -luuid D:/Users/John/Documents/software/MinGW/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.1/../../../../x86_64-w64-mingw32/bin/ld.exe: objnative/beval.o:beval.c:(.text+0x126): undefined reference to `vcol2col'
collect2.exe: error: ld returned 1 exit status
make: *** [Make_cyg_ming.mak:1033: vim.exe] Error 1
make: Target 'all' not remade because of errors.

The attached patch "8.1.1966.ui.c.patch" tries to fix it.


I hope this all makes sense!

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/c1d15343-2d6b-4e68-7e40-200d0500ed72%40internode.on.net.
--- buffer.c.new        2019-09-03 13:29:39.853446300 +1000
+++ buffer.c    2019-08-22 07:11:24.786442700 +1000
@@ -5495,7 +5495,9 @@
     else
        restore_buffer(save_curbuf);
 }
+#endif
 
+#if defined(FEAT_QUICKFIX) || defined(SWITCH_TO_WIN) || defined(PROTO)
 /*
  * Find a window for buffer "buf".
  * If found OK is returned and "wp" and "tp" are set to the window and tabpage.
--- evalfunc.pro        2019-08-04 06:31:09.639061300 +1000
+++ evalfunc.pro.new    2019-09-03 11:56:45.000000000 +1000
@@ -18,4 +18,9 @@
 void put_callback(callback_T *cb, typval_T *tv);
 void set_callback(callback_T *dest, callback_T *src);
 void free_callback(callback_T *callback);
+void f_getloclist(typval_T *argvars, typval_T *rettv);
+void f_getqflist(typval_T *argvars, typval_T *rettv);
+void f_setloclist(typval_T *argvars, typval_T *rettv);
+void f_setqflist(typval_T *argvars, typval_T *rettv);
 /* vim: set ft=c : */
--- quickfix.pro        2019-09-03 06:37:05.140944200 +1000
+++ quickfix.pro.new    2019-09-03 11:58:32.000000000 +1000
@@ -31,8 +31,4 @@
 void ex_cbuffer(exarg_T *eap);
 void ex_cexpr(exarg_T *eap);
 void ex_helpgrep(exarg_T *eap);
-void f_getloclist(typval_T *argvars, typval_T *rettv);
-void f_getqflist(typval_T *argvars, typval_T *rettv);
-void f_setloclist(typval_T *argvars, typval_T *rettv);
-void f_setqflist(typval_T *argvars, typval_T *rettv);
 /* vim: set ft=c : */
--- quickfix.c  2019-09-03 06:37:05.145949100 +1000
+++ quickfix.c.new      2019-09-03 11:49:20.000000000 +1000
@@ -3381,9 +3381,7 @@
     int                        prev_winid;
     int                        opened_window = FALSE;
     int                        print_message = TRUE;
-#ifdef FEAT_FOLDING
     int                        old_KeyTyped = KeyTyped; // getting file may 
reset it
-#endif
     int                        retval = OK;
 
     if (qi == NULL)
--- popupmnu.c  2019-08-22 05:01:33.411417000 +1000
+++ popupmnu.c.new      2019-09-03 11:45:41.000000000 +1000
@@ -760,7 +760,9 @@
 # else
 #  define use_popup 0
 # endif
+#ifdef FEAT_TEXT_PROP
            has_info = TRUE;
+#endif
 
            // Open a preview window.  3 lines by default.  Prefer
            // 'previewheight' if set and smaller.
@@ -928,7 +930,7 @@
        }
 #endif
     }
-#if defined(FEAT_TEXT_PROP) && defined(FEAT_QUICKFIX)
+#ifdef FEAT_TEXT_PROP
     if (!has_info)
        // hide any popup info window
        popup_hide_info();
--- ui.c.new    2019-09-04 06:09:56.755312500 +1000
+++ ui.c        2019-08-25 06:34:15.419301700 +1000
@@ -3678,6 +3678,10 @@
 }
 #endif
 
+#if defined(FEAT_GUI_MOTIF) || defined(FEAT_GUI_GTK) || defined(FEAT_GUI_MAC) \
+       || defined(FEAT_GUI_ATHENA) || defined(FEAT_GUI_MSWIN) \
+       || defined(FEAT_GUI_PHOTON) || defined(FEAT_BEVAL) \
+       || defined(FEAT_TERM_POPUP_MENU) || defined(PROTO)
 /*
  * Convert a virtual (screen) column to a character column.
  * The first column is one.
@@ -3698,6 +3702,7 @@
     }
     return (int)(ptr - line);
 }
+#endif
 
 #endif /* FEAT_MOUSE */
 

Raspunde prin e-mail lui