Fix a load of assumptions about default calling convention, a lot more remain.

svn path=/trunk/; revision=69242
This commit is contained in:
Stefan Ginsberg 2015-09-15 13:15:28 +00:00
parent b987b1571e
commit 6b5b096ee2
19 changed files with 39 additions and 29 deletions

View file

@ -1243,6 +1243,7 @@ CallPerInstanceInitFunctions (
} }
VOID VOID
__cdecl
wmainCRTStartup ( wmainCRTStartup (
VOID VOID
) )

View file

@ -445,6 +445,7 @@ SmpUnhandledExceptionFilter(IN PEXCEPTION_POINTERS ExceptionInfo)
} }
NTSTATUS NTSTATUS
__cdecl
_main(IN INT argc, _main(IN INT argc,
IN PCHAR argv[], IN PCHAR argv[],
IN PCHAR envp[], IN PCHAR envp[],

View file

@ -37,7 +37,7 @@ LRESULT CALLBACK ConnectionDialogProc(HWND, UINT, WPARAM, LPARAM);
LRESULT CALLBACK CaptureDialogProc(HWND, UINT, WPARAM, LPARAM); LRESULT CALLBACK CaptureDialogProc(HWND, UINT, WPARAM, LPARAM);
VOID EnableFileMenuItemByID(UINT Id, BOOL Enable); VOID EnableFileMenuItemByID(UINT Id, BOOL Enable);
VOID CheckLocalEchoMenuItem(BOOL Checked); VOID CheckLocalEchoMenuItem(BOOL Checked);
VOID Rs232Thread(VOID* Parameter); VOID __cdecl Rs232Thread(VOID* Parameter);
int APIENTRY _tWinMain(HINSTANCE hInstance, int APIENTRY _tWinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance, HINSTANCE hPrevInstance,
@ -437,7 +437,7 @@ VOID CheckLocalEchoMenuItem(BOOL Checked)
CheckMenuItem(hFileMenu, IDM_FILE_LOCALECHO, MF_BYCOMMAND|(Checked ? MF_CHECKED : MF_UNCHECKED)); CheckMenuItem(hFileMenu, IDM_FILE_LOCALECHO, MF_BYCOMMAND|(Checked ? MF_CHECKED : MF_UNCHECKED));
} }
VOID Rs232Thread(VOID* Parameter) VOID __cdecl Rs232Thread(VOID* Parameter)
{ {
BYTE Byte; BYTE Byte;
TCHAR String[MAX_PATH]; TCHAR String[MAX_PATH];

View file

@ -672,6 +672,7 @@ extern "C" {
_CRTIMP _CRTIMP
wchar_t* wchar_t*
__cdecl
wcsncat( wcsncat(
wchar_t *_Dest, wchar_t *_Dest,
const wchar_t *_Source, const wchar_t *_Source,

View file

@ -388,10 +388,10 @@ extern "C" {
#ifdef _USE_32BIT_TIME_T #ifdef _USE_32BIT_TIME_T
/* Do it like this to be compatible to msvcrt.dll on 32 bit windows XP and before */ /* Do it like this to be compatible to msvcrt.dll on 32 bit windows XP and before */
__CRT_INLINE wchar_t *__cdecl _wctime32(const time_t *_Time) { return _wctime(_Time); } __CRT_INLINE wchar_t *__cdecl _wctime32(const time_t *_Time) { return _wctime(_Time); }
__CRT_INLINE errno_t _wctime32_s(wchar_t *_Buffer, size_t _SizeInWords,const __time32_t *_Time) { return _wctime32_s(_Buffer, _SizeInWords, _Time); } __CRT_INLINE errno_t __cdecl _wctime32_s(wchar_t *_Buffer, size_t _SizeInWords,const __time32_t *_Time) { return _wctime32_s(_Buffer, _SizeInWords, _Time); }
#else #else
__CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime64(_Time); } __CRT_INLINE wchar_t *__cdecl _wctime(const time_t *_Time) { return _wctime64(_Time); }
__CRT_INLINE errno_t _wctime_s(wchar_t *_Buffer, size_t _SizeInWords,const time_t *_Time) { return _wctime64_s(_Buffer, _SizeInWords, _Time); } __CRT_INLINE errno_t __cdecl _wctime_s(wchar_t *_Buffer, size_t _SizeInWords,const time_t *_Time) { return _wctime64_s(_Buffer, _SizeInWords, _Time); }
#endif #endif
#endif #endif

View file

@ -2450,7 +2450,7 @@ EngSetPrinterData(
_In_ DWORD cjPrinterData); _In_ DWORD cjPrinterData);
#endif /* !USERMODE_DRIVER */ #endif /* !USERMODE_DRIVER */
typedef int (CDECL *SORTCOMP)(const void *pv1, const void *pv2); typedef int (__cdecl /*CDECL*/ *SORTCOMP)(const void *pv1, const void *pv2);
ENGAPI ENGAPI
VOID VOID

View file

@ -387,9 +387,9 @@ FT_BEGIN_HEADER
#ifndef FT_EXPORT #ifndef FT_EXPORT
#ifdef __cplusplus #ifdef __cplusplus
#define FT_EXPORT( x ) extern "C" x #define FT_EXPORT( x ) extern "C" x __cdecl
#else #else
#define FT_EXPORT( x ) extern x #define FT_EXPORT( x ) extern x __cdecl
#endif #endif
#endif /* !FT_EXPORT */ #endif /* !FT_EXPORT */
@ -398,9 +398,9 @@ FT_BEGIN_HEADER
#ifndef FT_EXPORT_DEF #ifndef FT_EXPORT_DEF
#ifdef __cplusplus #ifdef __cplusplus
#define FT_EXPORT_DEF( x ) extern "C" x #define FT_EXPORT_DEF( x ) extern "C" x __cdecl
#else #else
#define FT_EXPORT_DEF( x ) extern x #define FT_EXPORT_DEF( x ) extern x __cdecl
#endif #endif
#endif /* !FT_EXPORT_DEF */ #endif /* !FT_EXPORT_DEF */

View file

@ -21,7 +21,7 @@ extern "C" {
#ifdef __REACTOS__ #ifdef __REACTOS__
#include "malloc.h" #include "malloc.h"
struct _exception; struct _exception;
__declspec(dllimport) void __setusermatherr(int (__cdecl *)(struct _exception *)); __declspec(dllimport) void __cdecl __setusermatherr(int (__cdecl *)(struct _exception *));
#define __mingw_fprintf fprintf #define __mingw_fprintf fprintf
#define __mingw_vfprintf vfprintf #define __mingw_vfprintf vfprintf
#endif #endif

View file

@ -24,7 +24,7 @@
_PVFV *__onexitbegin; _PVFV *__onexitbegin;
_PVFV *__onexitend; _PVFV *__onexitend;
extern _CRTIMP _onexit_t __dllonexit (_onexit_t, _PVFV**, _PVFV**); extern _CRTIMP _onexit_t __cdecl __dllonexit (_onexit_t, _PVFV**, _PVFV**);
extern _onexit_t (__cdecl * __MINGW_IMP_SYMBOL(_onexit)) (_onexit_t func); extern _onexit_t (__cdecl * __MINGW_IMP_SYMBOL(_onexit)) (_onexit_t func);
/* Choose a different name to prevent name conflicts. The CRT one works fine. */ /* Choose a different name to prevent name conflicts. The CRT one works fine. */

View file

@ -7,13 +7,13 @@
#include <sect_attribs.h> #include <sect_attribs.h>
#include <internal.h> #include <internal.h>
__declspec(dllimport) int __lconv_init (void); __declspec(dllimport) int __cdecl __lconv_init (void);
int mingw_initcharmax = 0; int mingw_initcharmax = 0;
int _charmax = 255; int _charmax = 255;
static int my_lconv_init(void) static int __cdecl my_lconv_init(void)
{ {
return __lconv_init(); return __lconv_init();
} }

View file

@ -14,10 +14,10 @@ extern HINSTANCE __mingw_winmain_hInstance;
extern LPWSTR __mingw_winmain_lpCmdLine; extern LPWSTR __mingw_winmain_lpCmdLine;
extern DWORD __mingw_winmain_nShowCmd; extern DWORD __mingw_winmain_nShowCmd;
int wmain (int, wchar_t **, wchar_t **); int __cdecl wmain (int, wchar_t **, wchar_t **);
/*ARGSUSED*/ /*ARGSUSED*/
int wmain (int __UNUSED_PARAM(flags), int __cdecl wmain (int __UNUSED_PARAM(flags),
wchar_t ** __UNUSED_PARAM(cmdline), wchar_t ** __UNUSED_PARAM(cmdline),
wchar_t ** __UNUSED_PARAM(inst)) wchar_t ** __UNUSED_PARAM(inst))
{ {

View file

@ -40,7 +40,7 @@ PIMAGE_SECTION_HEADER _FindPESectionExec (size_t);
PBYTE _GetPEImageBase (void); PBYTE _GetPEImageBase (void);
int __mingw_init_ehandler (void); int __mingw_init_ehandler (void);
extern void _fpreset (void); extern void __cdecl _fpreset (void);
#if defined(_WIN64) && !defined(_MSC_VER) #if defined(_WIN64) && !defined(_MSC_VER)
EXCEPTION_DISPOSITION __mingw_SEH_error_handler(struct _EXCEPTION_RECORD *, void *, struct _CONTEXT *, void *); EXCEPTION_DISPOSITION __mingw_SEH_error_handler(struct _EXCEPTION_RECORD *, void *, struct _CONTEXT *, void *);
@ -90,7 +90,7 @@ __mingw_init_ehandler (void)
return 1; return 1;
} }
extern void _fpreset (void); extern void __cdecl _fpreset (void);
EXCEPTION_DISPOSITION EXCEPTION_DISPOSITION
__mingw_SEH_error_handler (struct _EXCEPTION_RECORD* ExceptionRecord, __mingw_SEH_error_handler (struct _EXCEPTION_RECORD* ExceptionRecord,

View file

@ -54,11 +54,12 @@ extern WINBOOL WINAPI DllMain (HANDLE hDllHandle, DWORD dwReason, LPVOID lpreser
extern WINBOOL WINAPI DllEntryPoint (HANDLE, DWORD, LPVOID); extern WINBOOL WINAPI DllEntryPoint (HANDLE, DWORD, LPVOID);
static int pre_c_init (void); static int __cdecl pre_c_init (void);
_CRTALLOC(".CRT$XIAA") _PIFV pcinit = pre_c_init; _CRTALLOC(".CRT$XIAA") _PIFV pcinit = pre_c_init;
static int static int
__cdecl
pre_c_init (void) pre_c_init (void)
{ {
_PVFV *onexitbegin; _PVFV *onexitbegin;

View file

@ -39,7 +39,7 @@ extern char *** __MINGW_IMP_SYMBOL(__initenv);
/* This symbol is defined by ld. */ /* This symbol is defined by ld. */
extern IMAGE_DOS_HEADER __ImageBase; extern IMAGE_DOS_HEADER __ImageBase;
extern void _fpreset (void); extern void __cdecl _fpreset (void);
#define SPACECHAR _T(' ') #define SPACECHAR _T(' ')
#define DQUOTECHAR _T('\"') #define DQUOTECHAR _T('\"')
@ -147,11 +147,11 @@ pre_cpp_init (void)
#endif #endif
} }
static int __tmainCRTStartup (void); static int __cdecl __tmainCRTStartup (void);
int WinMainCRTStartup (void); int __cdecl WinMainCRTStartup (void);
int WinMainCRTStartup (void) int __cdecl WinMainCRTStartup (void)
{ {
int ret = 255; int ret = 255;
#ifdef __SEH__ #ifdef __SEH__
@ -173,13 +173,13 @@ int WinMainCRTStartup (void)
return ret; return ret;
} }
int mainCRTStartup (void); int __cdecl mainCRTStartup (void);
#ifdef _WIN64 #ifdef _WIN64
int __mingw_init_ehandler (void); int __mingw_init_ehandler (void);
#endif #endif
int mainCRTStartup (void) int __cdecl mainCRTStartup (void)
{ {
int ret = 255; int ret = 255;
#ifdef __SEH__ #ifdef __SEH__
@ -202,7 +202,8 @@ int mainCRTStartup (void)
} }
static static
__declspec(noinline) int __declspec(noinline)
int __cdecl
__tmainCRTStartup (void) __tmainCRTStartup (void)
{ {
_TCHAR *lpszCommandLine = NULL; _TCHAR *lpszCommandLine = NULL;
@ -410,7 +411,7 @@ static void duplicate_ppstrings (int ac, char ***av)
#else #else
#define __UNUSED_PARAM_1 __UNUSED_PARAM #define __UNUSED_PARAM_1 __UNUSED_PARAM
#endif #endif
static void static void __cdecl
__mingw_invalidParameterHandler (const wchar_t * __UNUSED_PARAM_1(expression), __mingw_invalidParameterHandler (const wchar_t * __UNUSED_PARAM_1(expression),
const wchar_t * __UNUSED_PARAM_1(function), const wchar_t * __UNUSED_PARAM_1(function),
const wchar_t * __UNUSED_PARAM_1(file), const wchar_t * __UNUSED_PARAM_1(file),

View file

@ -6,7 +6,7 @@
#pragma function(_tcslen) #pragma function(_tcslen)
#endif /* _MSC_VER */ #endif /* _MSC_VER */
size_t _tcslen(const _TCHAR * str) size_t __cdecl _tcslen(const _TCHAR * str)
{ {
const _TCHAR * s; const _TCHAR * s;

View file

@ -2,7 +2,7 @@
#include <stddef.h> #include <stddef.h>
#include <tchar.h> #include <tchar.h>
size_t _tcsnlen(const _TCHAR * str, size_t count) size_t __cdecl _tcsnlen(const _TCHAR * str, size_t count)
{ {
const _TCHAR * s; const _TCHAR * s;

View file

@ -511,6 +511,7 @@ SetWorldTransformForMetafile(
} }
void void
__cdecl
_assert ( _assert (
const char *exp, const char *exp,
const char *file, const char *file,

View file

@ -641,7 +641,7 @@ QueryEnvironmentVariable(PUNICODE_STRING Name,
return(STATUS_VARIABLE_NOT_FOUND); return(STATUS_VARIABLE_NOT_FOUND);
} }
static int static int __cdecl
DbgCompareChannels(const void * a, const void * b) DbgCompareChannels(const void * a, const void * b)
{ {
return wcscmp((WCHAR*)a, ((DBG_CHANNEL*)b)->Name); return wcscmp((WCHAR*)a, ((DBG_CHANNEL*)b)->Name);

View file

@ -43,6 +43,10 @@ typedef struct _SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
#include <math.h> #include <math.h>
#include <intrin.h> #include <intrin.h>
// Needed because windef.h messes up CDECL for whatever
#undef CDECL
#define CDECL __cdecl
/* Avoid type casting, by defining RECT to RECTL */ /* Avoid type casting, by defining RECT to RECTL */
#define RECT RECTL #define RECT RECTL
#define PRECT PRECTL #define PRECT PRECTL