On 01/06/2010 10:51, Mike Williams wrote:
Hi,

I compiled VIM on my home machine over the weekend and got a few warnings:

misc2.c(6277) : warning C4244: '=' : conversion from 'long_u' to 'int',
possible loss of data
undo.c(828) : warning C4267: '=' : conversion from 'size_t' to 'int',
possible loss of data
undo.c(1630) : warning C4311: 'type cast' : pointer truncation from
'u_header_T *' to 'long'
undo.c(1635) : warning C4311: 'type cast' : pointer truncation from
'u_header_T *' to 'long'
undo.c(1640) : warning C4311: 'type cast' : pointer truncation from
'u_header_T *' to 'long'
undo.c(1645) : warning C4311: 'type cast' : pointer truncation from
'u_header_T *' to 'long'

At home I am using:

VC 2005 Express
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 14.00.50727.762
for 80x86

Build command I am using is:

nmake -f make_mvc.mak GUI=yes POSTSCRIPT=yes PYTHON=e:\python26
PYTHON_VER=26 DYNAMIC_PYTHON=yes

What is odd is that with the same sources and build line I don't get
these warnings on my work machine. The difference is that that is using
a commercial version of VC 2005. Ah, for some reason the 64 bit warnings
are not being enabled - do that and I do get the above warnings. The
warnings in undo.c indicate code that will cause errors with Windows 64
bit builds - uh_seq should be an intptr_t or whatever the final decision
was on type name for 64 bit integers that can hold pointer values.

I'll work on a patch for the makefile to ensure the 64 bit warnings get
produced in both the Express and full versions of VC8 - unless someone
else gets there before me.

Lack of warnings now fixed with the attached patch.

The problem was that defining the 64 warnings flag was dependent on a variable that was defined later in the makefile. I have just moved the definition of MSVCVER up in the makefile. I have put it before the inclusion of win32.mak since I have a copy whose contents may depend on what MSVCVER has been set to.

Note - this does mean that people using some versions of Visual Studio and the Windows SDK may result in a change in the built executable (for example, one copy of if the SDK win32.mak I have turns on buffer checks for VC7 builds.)

TTFN

Mike
--
Don't marry for money; you can borrow it cheaper.

--
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
diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak
--- a/src/Make_mvc.mak
+++ b/src/Make_mvc.mak
@@ -203,6 +203,61 @@
 MAKEFLAGS_GVIMEXT = DEBUG=yes
 !endif
 
+# Derive version of VC being used from nmake if not specified
+!if "$(MSVCVER)" == ""
+!if "$(_NMAKE_VER)" == ""
+MSVCVER = 4.0
+!endif
+!if "$(_NMAKE_VER)" == "162"
+MSVCVER = 5.0
+!endif
+!if "$(_NMAKE_VER)" == "6.00.8168.0"
+MSVCVER = 6.0
+CPU = ix86
+!endif
+!if "$(_NMAKE_VER)" == "7.00.9466"
+MSVCVER = 7.0
+!endif
+!if "$(_NMAKE_VER)" == "7.10.3077"
+MSVCVER = 7.1
+!endif
+!if "$(_NMAKE_VER)" == "8.00.50727.42"
+MSVCVER = 8.0
+!endif
+!if "$(_NMAKE_VER)" == "8.00.50727.762"
+MSVCVER = 8.0
+!endif
+!if "$(_NMAKE_VER)" == "9.00.20706.01"
+MSVCVER = 9.0
+!endif
+!if "$(_NMAKE_VER)" == "9.00.21022.08"
+MSVCVER = 9.0
+!endif
+!if "$(_NMAKE_VER)" == "9.00.30729.01"
+MSVCVER = 9.0
+!endif
+!if "$(_NMAKE_VER)" == "10.00.20506.01"
+MSVCVER = 10.0
+!endif
+!if "$(_NMAKE_VER)" == "10.00.30128.01"
+MSVCVER = 10.0
+!endif
+!if "$(_NMAKE_VER)" == "10.00.30319.01"
+MSVCVER = 10.0
+!endif
+!endif
+
+# Abort bulding VIM if version of VC is unrecognised.
+!ifndef MSVCVER
+!message *** ERROR
+!message Cannot determine Visual C version being used.  If you are using the
+!message Windows SDK then you must have the environment variable MSVCVER set to
+!message your version of the VC compiler.  If you are not using the Express
+!message version of Visual C, you can either set MSVCVER or update this 
makefile
+!message to handle the new value for _NMAKE_VER, "$(_NMAKE_VER)".
+!error Make aborted.
+!endif
+
 
 # Get all sorts of useful, standard macros from the Platform SDK.
 
@@ -325,61 +380,6 @@
 INTDIR=$(OBJDIR)
 OUTDIR=$(OBJDIR)
 
-# Derive version of VC being used from nmake if not specified
-!if "$(MSVCVER)" == ""
-!if "$(_NMAKE_VER)" == ""
-MSVCVER = 4.0
-!endif
-!if "$(_NMAKE_VER)" == "162"
-MSVCVER = 5.0
-!endif
-!if "$(_NMAKE_VER)" == "6.00.8168.0"
-MSVCVER = 6.0
-CPU = ix86
-!endif
-!if "$(_NMAKE_VER)" == "7.00.9466"
-MSVCVER = 7.0
-!endif
-!if "$(_NMAKE_VER)" == "7.10.3077"
-MSVCVER = 7.1
-!endif
-!if "$(_NMAKE_VER)" == "8.00.50727.42"
-MSVCVER = 8.0
-!endif
-!if "$(_NMAKE_VER)" == "8.00.50727.762"
-MSVCVER = 8.0
-!endif
-!if "$(_NMAKE_VER)" == "9.00.20706.01"
-MSVCVER = 9.0
-!endif
-!if "$(_NMAKE_VER)" == "9.00.21022.08"
-MSVCVER = 9.0
-!endif
-!if "$(_NMAKE_VER)" == "9.00.30729.01"
-MSVCVER = 9.0
-!endif
-!if "$(_NMAKE_VER)" == "10.00.20506.01"
-MSVCVER = 10.0
-!endif
-!if "$(_NMAKE_VER)" == "10.00.30128.01"
-MSVCVER = 10.0
-!endif
-!if "$(_NMAKE_VER)" == "10.00.30319.01"
-MSVCVER = 10.0
-!endif
-!endif
-
-# Abort bulding VIM if version of VC is unrecognised.
-!ifndef MSVCVER
-!message *** ERROR
-!message Cannot determine Visual C version being used.  If you are using the
-!message Windows SDK then you must have the environment variable MSVCVER set to
-!message your version of the VC compiler.  If you are not using the Express
-!message version of Visual C, you can either set MSVCVER or update this 
makefile
-!message to handle the new value for _NMAKE_VER, "$(_NMAKE_VER)".
-!error Make aborted.
-!endif
-
 # Convert processor ID to MVC-compatible number
 !if ("$(MSVCVER)" != "8.0") && ("$(MSVCVER)" != "9.0") && ("$(MSVCVER)" != 
"10.0")
 !if "$(CPUNR)" == "i386"

Raspunde prin e-mail lui