On 27-Jan-2017 07:36, Bram Moolenaar wrote:
Patch 8.0.0241
Problem:    Vim defines a mch_memmove() function but it doesn't work, thus is
             always unused.
Solution:   Remove the mch_memmove implementation. (suggested by Dominique
             Pelle)
Files:      src/os_unix.h, src/misc2.c, src/vim.h



After applying this patch, gcc (Mingw64) spews out a whole bunch of warnings. For example:
...
gcc -c -Iproto -DWIN32 -DWINVER=0x0603 -D_WIN32_WINNT=0x0603 -DHAVE_PATHDEF -DFEAT_NORMAL -DHAVE_STDINT_H -pipe -march=n ative -Wall -O3 -fomit-frame-pointer -freg-struct-return -s userfunc.c -o objnative/userfunc.o
In file included from userfunc.c:14:0:
userfunc.c: In function 'fname_trans_sid':
vim.h:1718:73: warning: passing argument 3 of 'memmove' makes integer from pointer without a cast [-Wint-conversion] # define mch_memmove(to, from, len) memmove((char*)(to), (char*)(from), (char*)(len))
^
userfunc.c:530:3: note: in expansion of macro 'mch_memmove'
   mch_memmove(fname, fname_buf, (size_t)i);
   ^
In file included from C:/Programs/MinGW64/x86_64-w64-mingw32/include/io.h:10:0,
                 from vimio.h:18,
                 from vim.h:31,
                 from userfunc.c:14:
C:/Programs/MinGW64/x86_64-w64-mingw32/include/string.h:66:17: note: expected 'size_t {aka long long unsigned int}' but
argument is of type 'char *'
void *__cdecl memmove(void *_Dst,const void *_Src,size_t _Size) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
                 ^~~~~~~
In file included from userfunc.c:14:0:
userfunc.c: In function 'trans_function_name':
vim.h:1718:73: warning: passing argument 3 of 'memmove' makes integer from pointer without a cast [-Wint-conversion] # define mch_memmove(to, from, len) memmove((char*)(to), (char*)(from), (char*)(len))
^
userfunc.c:1615:6: note: in expansion of macro 'mch_memmove'
      mch_memmove(name + 3, name + 5, STRLEN(name + 5) + 1);
      ^
In file included from C:/Programs/MinGW64/x86_64-w64-mingw32/include/io.h:10:0,
                 from vimio.h:18,
                 from vim.h:31,
                 from userfunc.c:14:
C:/Programs/MinGW64/x86_64-w64-mingw32/include/string.h:66:17: note: expected 'size_t {aka long long unsigned int}' but
argument is of type 'char *'
void *__cdecl memmove(void *_Dst,const void *_Src,size_t _Size) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
                 ^~~~~~~
In file included from userfunc.c:14:0:
vim.h:1718:73: warning: passing argument 3 of 'memmove' makes integer from pointer without a cast [-Wint-conversion] # define mch_memmove(to, from, len) memmove((char*)(to), (char*)(from), (char*)(len))
^
userfunc.c:1692:2: note: in expansion of macro 'mch_memmove'
  mch_memmove(name + lead, lv.ll_name, (size_t)len);
  ^
In file included from C:/Programs/MinGW64/x86_64-w64-mingw32/include/io.h:10:0,
                 from vimio.h:18,
                 from vim.h:31,
                 from userfunc.c:14:
C:/Programs/MinGW64/x86_64-w64-mingw32/include/string.h:66:17: note: expected 'size_t {aka long long unsigned int}' but
argument is of type 'char *'
void *__cdecl memmove(void *_Dst,const void *_Src,size_t _Size) __MINGW_ATTRIB_DEPRECATED_SEC_WARN;
                 ^~~~~~~

The definition for macro mch_memmove in vim.h (line 1718) is wrong. The attached patch makes gcc happy again.

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].
For more options, visit https://groups.google.com/d/optout.
--- vim/src/vim_orig.h  2017-01-27 07:39:19.758132100 +1100
+++ vim/src/vim.h       2017-01-27 08:47:49.646726800 +1100
@@ -1715,7 +1715,7 @@
 typedef void       *vim_acl_T;         /* dummy to pass an ACL to a function */
 
 #ifndef mch_memmove
-# define mch_memmove(to, from, len) memmove((char*)(to), (char*)(from), 
(char*)(len))
+# define mch_memmove(to, from, len) memmove((char*)(to), (char*)(from), 
(size_t)(len))
 #endif
 
 /*

Raspunde prin e-mail lui