Fixed required to make MSVC build with fastcall optimization (-Gr) healthy.

There is a trick in MSVC is to turn on the -Gr compiler switch which tells MSVC to compile all functions using fastcall calling convention. This way you don't have to edit each function declaration. But certain functions must NOT be fastcall, and those are callbacks from Windows which are defined either as cdecl or stdcall. The entry point main() also has to remain cdecl.
Patch by Darek Mihocka
This commit is contained in:
Stanislav Shwartsman 2008-04-07 20:20:04 +00:00
parent a851cfd8f0
commit 8424d2b888
4 changed files with 15 additions and 16 deletions

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: bochs.h,v 1.224 2008-02-07 21:08:55 sshwarts Exp $
// $Id: bochs.h,v 1.225 2008-04-07 20:20:04 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -465,7 +465,7 @@ typedef struct {
} bx_debug_t;
#define BX_ASSERT(x) do {if (!(x)) BX_PANIC(("failed assertion \"%s\" at %s:%d\n", #x, __FILE__, __LINE__));} while (0)
void bx_signal_handler(int signum);
void CDECL bx_signal_handler(int signum);
int bx_atexit(void);
BOCHSAPI extern bx_debug_t bx_dbg;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: rfb.cc,v 1.57 2008-03-06 21:15:40 sshwarts Exp $
// $Id: rfb.cc,v 1.58 2008-04-07 20:20:04 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2000 Psyon.Org!
@ -170,7 +170,7 @@ static SOCKET sGlobal;
static Bit32u clientEncodingsCount = 0;
static Bit32u *clientEncodings = NULL;
void ServerThreadInit(void *indata);
void CDECL ServerThreadInit(void *indata);
void HandleRfbClient(SOCKET sClient);
int ReadExact(int sock, char *buf, int len);
int WriteExact(int sock, char *buf, int len);
@ -348,7 +348,7 @@ bool StopWinsock()
}
#endif
void ServerThreadInit(void *indata)
void CDECL ServerThreadInit(void *indata)
{
SOCKET sServer;
SOCKET sClient;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: win32.cc,v 1.118 2008-02-15 22:05:40 sshwarts Exp $
// $Id: win32.cc,v 1.119 2008-04-07 20:20:04 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -206,7 +206,7 @@ sharedThreadInfo stInfo;
LRESULT CALLBACK mainWndProc (HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK simWndProc (HWND, UINT, WPARAM, LPARAM);
VOID UIThread(PVOID);
VOID CDECL UIThread(PVOID);
void SetStatusText(int Num, const char *Text, bx_bool active);
void terminateEmul(int);
void create_vga_font(void);
@ -489,7 +489,6 @@ Bit32u win32_to_bx_key[2][0x100] =
#if defined(__MINGW32__) || defined(_MSC_VER)
VOID CALLBACK MyTimer(HWND,UINT,UINT,DWORD);
void alarm(int);
void bx_signal_handler(int);
#endif
static void processMouseXY(int x, int y, int z, int windows_state, int implied_state_change)
@ -799,7 +798,7 @@ void resize_main_window()
}
// This thread controls the GUI window.
VOID UIThread(PVOID pvoid)
VOID CDECL UIThread(PVOID pvoid)
{
MSG msg;
HDC hdc;

View File

@ -1,5 +1,5 @@
/////////////////////////////////////////////////////////////////////////
// $Id: main.cc,v 1.377 2008-04-05 20:41:00 sshwarts Exp $
// $Id: main.cc,v 1.378 2008-04-07 20:20:04 sshwarts Exp $
/////////////////////////////////////////////////////////////////////////
//
// Copyright (C) 2002 MandrakeSoft S.A.
@ -253,7 +253,7 @@ void print_tree(bx_param_c *node, int level)
}
#endif
int bxmain () {
int bxmain (void) {
#ifdef HAVE_LOCALE_H
// Initialize locale (for isprint() and other functions)
setlocale (LC_ALL, "");
@ -463,7 +463,7 @@ int WINAPI WinMain(
#if !defined(__WXMSW__)
// normal main function, presently in for all cases except for
// wxWidgets under win32.
int main (int argc, char *argv[])
int CDECL main(int argc, char *argv[])
{
bx_startup_flags.argc = argc;
bx_startup_flags.argv = argv;
@ -480,7 +480,7 @@ int main (int argc, char *argv[])
}
#endif
void print_usage()
void print_usage(void)
{
fprintf(stderr,
"Usage: bochs [flags] [bochsrc options]\n\n"
@ -743,7 +743,7 @@ int bx_init_main(int argc, char *argv[])
return 0;
}
bx_bool load_and_init_display_lib()
bx_bool load_and_init_display_lib(void)
{
if (bx_gui != NULL) {
// bx_gui has already been filled in. This happens when you start
@ -924,7 +924,7 @@ int bx_begin_simulation (int argc, char *argv[])
return(0);
}
void bx_stop_simulation()
void bx_stop_simulation(void)
{
// in wxWidgets, the whole simulator is running in a separate thread.
// our only job is to end the thread as soon as possible, NOT to shut
@ -1195,7 +1195,7 @@ int bx_atexit(void)
return 0;
}
void bx_signal_handler(int signum)
void CDECL bx_signal_handler(int signum)
{
// in a multithreaded environment, a signal such as SIGINT can be sent to all
// threads. This function is only intended to handle signals in the