Commit 14072676 authored by Alexandre Julliard's avatar Alexandre Julliard

msvcrt: Use a __thiscall macro where appropriate to make the calling convention clearer.

parent c6423058
......@@ -43,6 +43,7 @@ typedef struct {
#define THISCALL(func) __thiscall_ ## func
#define THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func)
#define __thiscall __stdcall
#define DEFINE_THISCALL_WRAPPER(func,args) \
extern void THISCALL(func)(void); \
__ASM_GLOBAL_FUNC(__thiscall_ ## func, \
......@@ -54,6 +55,7 @@ typedef struct {
#define THISCALL(func) func
#define THISCALL_NAME(func) __ASM_NAME(#func)
#define __thiscall __cdecl
#define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */
#endif /* __i386__ */
......@@ -63,7 +65,7 @@ typedef struct {
* class ios & __thiscall ios::-ios<<(void)
*/
DEFINE_THISCALL_WRAPPER(MSVCIRT_ios_sl_void,4)
void * __stdcall MSVCIRT_ios_sl_void(class_ios * _this)
void * __thiscall MSVCIRT_ios_sl_void(class_ios * _this)
{
FIXME("(%p) stub\n", _this);
return _this;
......@@ -74,7 +76,7 @@ void * __stdcall MSVCIRT_ios_sl_void(class_ios * _this)
* class ostream & __thiscall ostrstream::ostrstream<<(void)
*/
DEFINE_THISCALL_WRAPPER(MSVCIRT_ostrstream_sl_void,4)
void * __stdcall MSVCIRT_ostrstream_sl_void(class_ostream * _this)
void * __thiscall MSVCIRT_ostrstream_sl_void(class_ostream * _this)
{
FIXME("(%p) stub\n", _this);
return _this;
......@@ -85,7 +87,7 @@ void * __stdcall MSVCIRT_ostrstream_sl_void(class_ostream * _this)
* class ostream & __thiscall ostream::operator<<(unsigned char)
*/
DEFINE_THISCALL_WRAPPER(MSVCIRT_operator_sl_uchar,8)
void * __stdcall MSVCIRT_operator_sl_uchar(class_ostream * _this, unsigned char ch)
void * __thiscall MSVCIRT_operator_sl_uchar(class_ostream * _this, unsigned char ch)
{
FIXME("(%p)->(%c) stub\n", _this, ch);
return _this;
......@@ -96,7 +98,7 @@ void * __stdcall MSVCIRT_operator_sl_uchar(class_ostream * _this, unsigned char
* class ostream & __thiscall ostream::operator<<(int)
*/
DEFINE_THISCALL_WRAPPER(MSVCIRT_operator_sl_int,8)
void * __stdcall MSVCIRT_operator_sl_int(class_ostream * _this, int integer)
void * __thiscall MSVCIRT_operator_sl_int(class_ostream * _this, int integer)
{
FIXME("(%p)->(%d) stub\n", _this, integer);
return _this;
......@@ -107,7 +109,7 @@ void * __stdcall MSVCIRT_operator_sl_int(class_ostream * _this, int integer)
* class ostream & __thiscall ostream::operator<<(char const *)
*/
DEFINE_THISCALL_WRAPPER(MSVCIRT_operator_sl_pchar,8)
void * __stdcall MSVCIRT_operator_sl_pchar(class_ostream * _this, const char * string)
void * __thiscall MSVCIRT_operator_sl_pchar(class_ostream * _this, const char * string)
{
FIXME("(%p)->(%s) stub\n", _this, debugstr_a(string));
return _this;
......@@ -118,7 +120,7 @@ void * __stdcall MSVCIRT_operator_sl_pchar(class_ostream * _this, const char * s
* class ostream & __thiscall ostream::operator<<(class ostream & (__cdecl*)(class ostream &))
*/
DEFINE_THISCALL_WRAPPER(MSVCIRT_operator_sl_callback,8)
void * __stdcall MSVCIRT_operator_sl_callback(class_ostream * _this, class_ostream * (__cdecl*func)(class_ostream*))
void * __thiscall MSVCIRT_operator_sl_callback(class_ostream * _this, class_ostream * (__cdecl*func)(class_ostream*))
{
TRACE("%p, %p\n", _this, func);
return func(_this);
......@@ -149,7 +151,7 @@ void * CDECL MSVCIRT_ends(class_ostream * _this)
* class strstreambuf & __thiscall strstreambuf::str(class strstreambuf &)
*/
DEFINE_THISCALL_WRAPPER(MSVCIRT_str_sl_void,4)
char * __stdcall MSVCIRT_str_sl_void(class_strstreambuf * _this)
char * __thiscall MSVCIRT_str_sl_void(class_strstreambuf * _this)
{
FIXME("(%p)->() stub\n", _this);
return 0;
......
......@@ -112,7 +112,7 @@ static type_info exception_type_info = {
};
DEFINE_THISCALL_WRAPPER(MSVCP_exception_ctor, 8)
exception* __stdcall MSVCP_exception_ctor(exception *this, const char **name)
exception* __thiscall MSVCP_exception_ctor(exception *this, const char **name)
{
TRACE("(%p %s)\n", this, *name);
......@@ -130,7 +130,7 @@ exception* __stdcall MSVCP_exception_ctor(exception *this, const char **name)
}
DEFINE_THISCALL_WRAPPER(MSVCP_exception_copy_ctor,8)
exception* __stdcall MSVCP_exception_copy_ctor(exception *this, const exception *rhs)
exception* __thiscall MSVCP_exception_copy_ctor(exception *this, const exception *rhs)
{
TRACE("(%p,%p)\n", this, rhs);
......@@ -145,7 +145,7 @@ exception* __stdcall MSVCP_exception_copy_ctor(exception *this, const exception
}
DEFINE_THISCALL_WRAPPER(MSVCP_exception_dtor,4)
void __stdcall MSVCP_exception_dtor(exception *this)
void __thiscall MSVCP_exception_dtor(exception *this)
{
TRACE("(%p)\n", this);
this->vtable = exception_type_info.vtable;
......@@ -194,7 +194,7 @@ void set_exception_vtable(void)
typedef exception bad_alloc;
DEFINE_THISCALL_WRAPPER(MSVCP_bad_alloc_ctor, 8)
bad_alloc* __stdcall MSVCP_bad_alloc_ctor(bad_alloc *this, const char **name)
bad_alloc* __thiscall MSVCP_bad_alloc_ctor(bad_alloc *this, const char **name)
{
TRACE("%p %s\n", this, *name);
MSVCP_exception_ctor(this, name);
......@@ -203,7 +203,7 @@ bad_alloc* __stdcall MSVCP_bad_alloc_ctor(bad_alloc *this, const char **name)
}
DEFINE_THISCALL_WRAPPER(MSVCP_bad_alloc_copy_ctor, 8)
bad_alloc* __stdcall MSVCP_bad_alloc_copy_ctor(bad_alloc *this, const bad_alloc *rhs)
bad_alloc* __thiscall MSVCP_bad_alloc_copy_ctor(bad_alloc *this, const bad_alloc *rhs)
{
TRACE("%p %p\n", this, rhs);
MSVCP_exception_copy_ctor(this, rhs);
......@@ -212,14 +212,14 @@ bad_alloc* __stdcall MSVCP_bad_alloc_copy_ctor(bad_alloc *this, const bad_alloc
}
DEFINE_THISCALL_WRAPPER(MSVCP_bad_alloc_dtor, 4)
void __stdcall MSVCP_bad_alloc_dtor(bad_alloc *this)
void __thiscall MSVCP_bad_alloc_dtor(bad_alloc *this)
{
TRACE("%p\n", this);
MSVCP_exception_dtor(this);
}
DEFINE_THISCALL_WRAPPER(MSVCP_bad_alloc_vector_dtor, 8)
void * __stdcall MSVCP_bad_alloc_vector_dtor(bad_alloc *this, unsigned int flags)
void * __thiscall MSVCP_bad_alloc_vector_dtor(bad_alloc *this, unsigned int flags)
{
TRACE("%p %x\n", this, flags);
if(flags & 2) {
......@@ -239,7 +239,7 @@ void * __stdcall MSVCP_bad_alloc_vector_dtor(bad_alloc *this, unsigned int flags
}
DEFINE_THISCALL_WRAPPER(MSVCP_what_exception,4)
const char* __stdcall MSVCP_what_exception(exception * this)
const char* __thiscall MSVCP_what_exception(exception * this)
{
TRACE("(%p) returning %s\n", this, this->name);
return this->name ? this->name : "Unknown exception";
......@@ -312,7 +312,7 @@ typedef struct _logic_error {
} logic_error;
DEFINE_THISCALL_WRAPPER(MSVCP_logic_error_ctor, 8)
logic_error* __stdcall MSVCP_logic_error_ctor(
logic_error* __thiscall MSVCP_logic_error_ctor(
logic_error *this, const char **name)
{
TRACE("%p %s\n", this, *name);
......@@ -324,7 +324,7 @@ logic_error* __stdcall MSVCP_logic_error_ctor(
}
DEFINE_THISCALL_WRAPPER(MSVCP_logic_error_copy_ctor, 8)
logic_error* __stdcall MSVCP_logic_error_copy_ctor(
logic_error* __thiscall MSVCP_logic_error_copy_ctor(
logic_error *this, logic_error *rhs)
{
TRACE("%p %p\n", this, rhs);
......@@ -335,7 +335,7 @@ logic_error* __stdcall MSVCP_logic_error_copy_ctor(
}
DEFINE_THISCALL_WRAPPER(MSVCP_logic_error_dtor, 4)
void __stdcall MSVCP_logic_error_dtor(logic_error *this)
void __thiscall MSVCP_logic_error_dtor(logic_error *this)
{
TRACE("%p\n", this);
MSVCP_exception_dtor(&this->e);
......@@ -343,7 +343,7 @@ void __stdcall MSVCP_logic_error_dtor(logic_error *this)
}
DEFINE_THISCALL_WRAPPER(MSVCP_logic_error_vector_dtor, 8)
void* __stdcall MSVCP_logic_error_vector_dtor(
void* __thiscall MSVCP_logic_error_vector_dtor(
logic_error *this, unsigned int flags)
{
TRACE("%p %x\n", this, flags);
......@@ -364,7 +364,7 @@ void* __stdcall MSVCP_logic_error_vector_dtor(
}
DEFINE_THISCALL_WRAPPER(MSVCP_logic_error_what, 4)
const char* __stdcall MSVCP_logic_error_what(logic_error *this)
const char* __thiscall MSVCP_logic_error_what(logic_error *this)
{
TRACE("%p\n", this);
return MSVCP_basic_string_char_c_str(&this->str);
......@@ -434,7 +434,7 @@ static const cxx_exception_type logic_error_cxx_type = {
typedef logic_error length_error;
DEFINE_THISCALL_WRAPPER(MSVCP_length_error_ctor, 8)
length_error* __stdcall MSVCP_length_error_ctor(
length_error* __thiscall MSVCP_length_error_ctor(
length_error *this, const char **name)
{
TRACE("%p %s\n", this, *name);
......@@ -444,7 +444,7 @@ length_error* __stdcall MSVCP_length_error_ctor(
}
DEFINE_THISCALL_WRAPPER(MSVCP_length_error_copy_ctor, 8)
length_error* __stdcall MSVCP_length_error_copy_ctor(
length_error* __thiscall MSVCP_length_error_copy_ctor(
length_error *this, length_error *rhs)
{
TRACE("%p %p\n", this, rhs);
......@@ -454,7 +454,7 @@ length_error* __stdcall MSVCP_length_error_copy_ctor(
}
DEFINE_THISCALL_WRAPPER(MSVCP_length_error_vector_dtor, 8)
void* __stdcall MSVCP_length_error_vector_dtor(
void* __thiscall MSVCP_length_error_vector_dtor(
length_error *this, unsigned int flags)
{
TRACE("%p %x\n", this, flags);
......@@ -525,7 +525,7 @@ static const cxx_exception_type length_error_cxx_type = {
typedef logic_error out_of_range;
DEFINE_THISCALL_WRAPPER(MSVCP_out_of_range_ctor, 8)
out_of_range* __stdcall MSVCP_out_of_range_ctor(
out_of_range* __thiscall MSVCP_out_of_range_ctor(
out_of_range *this, const char **name)
{
TRACE("%p %s\n", this, *name);
......@@ -535,7 +535,7 @@ out_of_range* __stdcall MSVCP_out_of_range_ctor(
}
DEFINE_THISCALL_WRAPPER(MSVCP_out_of_range_copy_ctor, 8)
out_of_range* __stdcall MSVCP_out_of_range_copy_ctor(
out_of_range* __thiscall MSVCP_out_of_range_copy_ctor(
out_of_range *this, out_of_range *rhs)
{
TRACE("%p %p\n", this, rhs);
......@@ -545,7 +545,7 @@ out_of_range* __stdcall MSVCP_out_of_range_copy_ctor(
}
DEFINE_THISCALL_WRAPPER(MSVCP_out_of_range_vector_dtor, 8)
void* __stdcall MSVCP_out_of_range_vector_dtor(
void* __thiscall MSVCP_out_of_range_vector_dtor(
out_of_range *this, unsigned int flags)
{
TRACE("%p %x\n", this, flags);
......@@ -616,7 +616,7 @@ static const cxx_exception_type out_of_range_cxx_type = {
typedef logic_error invalid_argument;
DEFINE_THISCALL_WRAPPER(MSVCP_invalid_argument_ctor, 8)
invalid_argument* __stdcall MSVCP_invalid_argument_ctor(
invalid_argument* __thiscall MSVCP_invalid_argument_ctor(
invalid_argument *this, const char **name)
{
TRACE("%p %s\n", this, *name);
......@@ -626,7 +626,7 @@ invalid_argument* __stdcall MSVCP_invalid_argument_ctor(
}
DEFINE_THISCALL_WRAPPER(MSVCP_invalid_argument_copy_ctor, 8)
invalid_argument* __stdcall MSVCP_invalid_argument_copy_ctor(
invalid_argument* __thiscall MSVCP_invalid_argument_copy_ctor(
invalid_argument *this, invalid_argument *rhs)
{
TRACE("%p %p\n", this, rhs);
......@@ -636,7 +636,7 @@ invalid_argument* __stdcall MSVCP_invalid_argument_copy_ctor(
}
DEFINE_THISCALL_WRAPPER(MSVCP_invalid_argument_vector_dtor, 8)
void* __stdcall MSVCP_invalid_argument_vector_dtor(
void* __thiscall MSVCP_invalid_argument_vector_dtor(
invalid_argument *this, unsigned int flags)
{
TRACE("%p %x\n", this, flags);
......
......@@ -32,6 +32,7 @@ extern void (__cdecl *MSVCRT_operator_delete)(void*);
#define THISCALL(func) __thiscall_ ## func
#define THISCALL_NAME(func) __ASM_NAME("__thiscall_" #func)
#define __thiscall __stdcall
#define DEFINE_THISCALL_WRAPPER(func,args) \
extern void THISCALL(func)(void); \
__ASM_GLOBAL_FUNC(__thiscall_ ## func, \
......@@ -43,6 +44,7 @@ extern void (__cdecl *MSVCRT_operator_delete)(void*);
#define THISCALL(func) func
#define THISCALL_NAME(func) __ASM_NAME(#func)
#define __thiscall __cdecl
#define DEFINE_THISCALL_WRAPPER(func,args) /* nothing */
#endif /* __i386__ */
......
......@@ -592,7 +592,7 @@ static MSVCP_BOOL basic_string_char_grow(
/* ?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@II@Z */
/* ?erase@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@_K0@Z */
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_erase, 12)
basic_string_char* __stdcall MSVCP_basic_string_char_erase(
basic_string_char* __thiscall MSVCP_basic_string_char_erase(
basic_string_char *this, size_t pos, size_t len)
{
TRACE("%p %d %d\n", this, pos, len);
......@@ -618,7 +618,7 @@ basic_string_char* __stdcall MSVCP_basic_string_char_erase(
/* ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ABV12@II@Z */
/* ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@AEBV12@_K1@Z */
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_assign_substr, 16)
basic_string_char* __stdcall MSVCP_basic_string_char_assign_substr(
basic_string_char* __thiscall MSVCP_basic_string_char_assign_substr(
basic_string_char *this, const basic_string_char *assign,
size_t pos, size_t len)
{
......@@ -647,7 +647,7 @@ basic_string_char* __stdcall MSVCP_basic_string_char_assign_substr(
/* ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@ABV12@@Z */
/* ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@AEBV12@@Z */
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_assign, 8)
basic_string_char* __stdcall MSVCP_basic_string_char_assign(
basic_string_char* __thiscall MSVCP_basic_string_char_assign(
basic_string_char *this, const basic_string_char *assign)
{
return MSVCP_basic_string_char_assign_substr(this, assign,
......@@ -657,7 +657,7 @@ basic_string_char* __stdcall MSVCP_basic_string_char_assign(
/* ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBDI@Z */
/* ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@PEBD_K@Z */
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_assign_cstr_len, 12)
basic_string_char* __stdcall MSVCP_basic_string_char_assign_cstr_len(
basic_string_char* __thiscall MSVCP_basic_string_char_assign_cstr_len(
basic_string_char *this, const char *str, size_t len)
{
TRACE("%p %s %d\n", this, debugstr_a(str), len);
......@@ -677,7 +677,7 @@ basic_string_char* __stdcall MSVCP_basic_string_char_assign_cstr_len(
/* ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAEAAV12@PBD@Z */
/* ?assign@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAAAEAV12@PEBD@Z */
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_assign_cstr, 8)
basic_string_char* __stdcall MSVCP_basic_string_char_assign_cstr(
basic_string_char* __thiscall MSVCP_basic_string_char_assign_cstr(
basic_string_char *this, const char *str)
{
return MSVCP_basic_string_char_assign_cstr_len(this, str,
......@@ -687,7 +687,7 @@ basic_string_char* __stdcall MSVCP_basic_string_char_assign_cstr(
/* ?c_str@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QBEPBDXZ */
/* ?c_str@?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEBAPEBDXZ */
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_c_str, 4)
const char* __stdcall MSVCP_basic_string_char_c_str(basic_string_char *this)
const char* __thiscall MSVCP_basic_string_char_c_str(basic_string_char *this)
{
TRACE("%p\n", this);
return basic_string_char_const_ptr(this);
......@@ -696,7 +696,7 @@ const char* __stdcall MSVCP_basic_string_char_c_str(basic_string_char *this)
/* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ */
/* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@XZ */
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_ctor, 4)
basic_string_char* __stdcall MSVCP_basic_string_char_ctor(basic_string_char *this)
basic_string_char* __thiscall MSVCP_basic_string_char_ctor(basic_string_char *this)
{
TRACE("%p\n", this);
......@@ -707,7 +707,7 @@ basic_string_char* __stdcall MSVCP_basic_string_char_ctor(basic_string_char *thi
/* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@ABV01@@Z */
/* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@AEBV01@@Z */
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_copy_ctor, 8)
basic_string_char* __stdcall MSVCP_basic_string_char_copy_ctor(
basic_string_char* __thiscall MSVCP_basic_string_char_copy_ctor(
basic_string_char *this, const basic_string_char *copy)
{
TRACE("%p %p\n", this, copy);
......@@ -720,7 +720,7 @@ basic_string_char* __stdcall MSVCP_basic_string_char_copy_ctor(
/* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@PBD@Z */
/* ??0?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@PEBD@Z */
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_ctor_cstr, 8)
basic_string_char* __stdcall MSVCP_basic_string_char_ctor_cstr(
basic_string_char* __thiscall MSVCP_basic_string_char_ctor_cstr(
basic_string_char *this, const char *str)
{
TRACE("%p %s\n", this, debugstr_a(str));
......@@ -733,7 +733,7 @@ basic_string_char* __stdcall MSVCP_basic_string_char_ctor_cstr(
/* ??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QAE@XZ */
/* ??1?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@QEAA@XZ */
DEFINE_THISCALL_WRAPPER(MSVCP_basic_string_char_dtor, 4)
void __stdcall MSVCP_basic_string_char_dtor(basic_string_char *this)
void __thiscall MSVCP_basic_string_char_dtor(basic_string_char *this)
{
TRACE("%p\n", this);
basic_string_char_tidy(this, TRUE, 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment