On 17/12/2010 16:44, James Vega wrote:
On Fri, Dec 17, 2010 at 11:14 AM, Mike Williams
<mike.willi...@globalgraphics.com>  wrote:
On 17/12/2010 16:09, Cesar Romani wrote:

By building vim 7.3.083 on Win XP with MinGW, I'm getting:

--------------------
...
gcc -c -Iproto -DWIN32 ... fileio.c -o gobjZ/fileio.o
fileio.c:10306:1: error: expected declaration specifiers or '...' before
'(' token
fileio.c:10306:1: error: expected declaration specifiers or '...' before
'(' token
fileio.c:10306:1: error: expected declaration specifiers or '...' before
'(' token
fileio.c:10306:1: error: conflicting types for 'read'
c:\mingw\bin\../lib/gcc/mingw32/4.5.0/../../../../include/io.h:452:37:
note: previous declaration of 'read' was here
fileio.c: In function 'read':
fileio.c:10309:13: error: declaration for parameter 'bufsize' but no
such parameter
fileio.c:10308:14: error: declaration for parameter 'buf' but no such
parameter
fileio.c:10307:13: error: declaration for parameter 'fd' but no such
parameter
fileio.c: At top level:
fileio.c:10327:1: error: expected declaration specifiers or '...' before
'(' token
fileio.c:10327:1: error: expected declaration specifiers or '...' before
'(' token
fileio.c:10327:1: error: expected declaration specifiers or '...' before
'(' token
fileio.c:10327:1: error: conflicting types for 'write'
c:\mingw\bin\../lib/gcc/mingw32/4.5.0/../../../../include/io.h:458:37:
note: previous declaration of 'write' was here
fileio.c: In function 'write':
fileio.c:10330:13: error: declaration for parameter 'bufsize' but no
such parameter
fileio.c:10329:14: error: declaration for parameter 'buf' but no such
parameter
fileio.c:10328:13: error: declaration for parameter 'fd' but no such
parameter
make: *** [gobjZ/fileio.o] Error 1
--------------------

Similar with VC8:

fileio.c(10306) : error C2143: syntax error : missing ')' before '('
fileio.c(10306) : error C2143: syntax error : missing ')' before '('
fileio.c(10306) : error C2091: function returns function
fileio.c(10306) : error C2091: function returns function
fileio.c(10306) : error C2059: syntax error : ')'
fileio.c(10306) : error C2373: 'read' : redefinition; different type
modifiers
        H:\Program Files\Microsoft Visual Studio 8\VC\INCLUDE\io.h(329) : see
declaration of 'read'
fileio.c(10306) : error C2059: syntax error : 'type'
fileio.c(10310) : error C2449: found '{' at file scope (missing function
header?)
fileio.c(10320) : error C2059: syntax error : '}'
fileio.c(10330) : error C2449: found '{' at file scope (missing function
header?)
fileio.c(10348) : error C2059: syntax error : '}'
fileio.c(10348) : error C2014: preprocessor command must start as first
nonwhite space
fileio.c(10350) : fatal error C1070: mismatched #if/#endif pair in file
'h:\vim\vim\src\fileio.c'

A quick look shows that macros for read_eintr and write_eintr are being
defined as well as trying to compiler the code for them.  So in vim.h EINTR
is undefined and in fileio.c it is undefined.  Not a good idea.

EINTR is defined by errno.h.  Attached patch moves include of errno.h to
the relevant os_win*.h from the respective os_win*.c files.  The former
are included in vim.h, so EINTR will be defined before trying to define
the read_eintr/write_eintr macros.

Yep, that solves the above errors. The original bug of doing pointer arithmetic on a void* also needs to be fixed and then everything is good again.

Is there any reason why -pedantic is not used on gcc builds? Then again it is not just pedantry, it's not valid C so I would hope that using -std=c89 would flag it as an error. Ah, that isn't used either. Oh well. Looks like we will hit this problem again in the future some time.

TTFN

Mike
--
An object will fall so as to do the most damage.

--
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

Raspunde prin e-mail lui