[gambit-list] Warnings Compiling Gambit Under Windows
MichaelL at frogware.com
MichaelL at frogware.com
Sun May 15 17:38:12 EDT 2005
Gambit is generating some warnings under Windows. Some of them look like
real errors:
1 d:\tools\Scheme\proj\gambc40b13\lib\os_tty.c(7344) : warning
C4113: 'BOOL (__stdcall *)()' differs in parameter lists from
'PHANDLER_ROUTINE'
2 d:\tools\Scheme\proj\gambc40b13\lib\os_tty.c(7362) : warning
C4113: 'BOOL (__stdcall *)()' differs in parameter lists from
'PHANDLER_ROUTINE'
3 d:\tools\Scheme\proj\gambc40b13\lib\os_time.c(234) : warning
C4307: '*' : integral constant overflow
4 d:\tools\Scheme\proj\gambc40b13\lib\os_time.c(234) : warning
C4244: 'initializing' : conversion from 'LONGLONG' to 'int', possible loss
of data
5 d:\tools\Scheme\proj\gambc40b13\lib\os_time.c(235) : warning
C4244: 'initializing' : conversion from 'LONGLONG' to 'int', possible loss
of data
6 d:\tools\Scheme\proj\gambc40b13\lib\os_time.c(1316) : warning
C4113: 'DWORD (__stdcall *)()' differs in parameter lists from
'LPTHREAD_START_ROUTINE'
7 d:\tools\Scheme\proj\gambc40b13\lib\os_shell.c(177) : warning
C4244: '=' : conversion from 'unsigned short' to 'char', possible loss of
data
8 d:\tools\Scheme\proj\gambc40b13\lib\os_shell.c(444) : warning
C4244: '=' : conversion from 'unsigned short' to 'char', possible loss of
data
9 d:\tools\Scheme\proj\gambc40b13\lib\os_shell.c(466) : warning
C4244: '=' : conversion from 'unsigned short' to 'char', possible loss of
data
10 d:\tools\Scheme\proj\gambc40b13\lib\os_shell.c(594) : warning
C4244: '=' : conversion from 'unsigned short' to 'char', possible loss of
data
11 d:\tools\scheme\proj\gambc40b13\lib\os_io.c(5527) : warning C4700:
local variable 'dev' used without having been initialized
There are two other warnings that appear about 200 times building the
library. I presume they're intentional:
12 d:\tools\Scheme\proj\gambc40b13\lib\_std.c(2011) : warning C4146:
unary minus operator applied to unsigned type, result still unsigned
13 d:\tools\Scheme\proj\gambc40b13\lib\_std.c(21221) : warning C4244:
'=' : conversion from 'double' to 'float', possible loss of data
Here's an example of the first:
___BIGFIX1(-0x80000000L)
Here's an example of the second:
___F32VECTORSET(___R1,___R3,___F64V1)
==================================================
Problems 1, 2, and 6 are happening because __STDC__ isn't defined by
default under MSVC. MS thinks that because they define various extensions
they aren't strict ANSI C, so by default they define _MSC_EXTENSIONS
instead. Here are the relevant bits from the docs:
__STDC__
Indicates full conformance with the ANSI C standard. Defined as
the integer constant 1
only if the /Za compiler option is given and you are not compiling
C++ code; otherwise is
undefined.
_MSC_EXTENSIONS
This macro is defined when compiling with the /Ze compiler option
(the default). Its
value, when defined, is 1.
Because of all of the above, __P falls through to the #else at 1150 in
gambit.h and treats params as K&R, which is wrong.
The problem can be fixed by either looking specifically for something like
_MFC_VER or _MSC_EXTENSIONS or by forcing a #define of __STDC__. (I took
the second route in my project file.)
Problem 11 looks legit.
(The problem with ___REGISTER_HOST_ENTRY was described elsewhere.)
More information about the Gambit-list
mailing list