This gets us better warnings when compiling with `-fanalyzer`.
From: Alex Henrie alexhenrie24@gmail.com
--- dlls/concrt140/details.c | 2 +- dlls/concrt140/details.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/concrt140/details.c b/dlls/concrt140/details.c index a8e7478b9a6..487eb65ee3e 100644 --- a/dlls/concrt140/details.c +++ b/dlls/concrt140/details.c @@ -398,7 +398,7 @@ DEFINE_RTTI_DATA0(_Runtime_object, 0, ".?AV_Runtime_object@details@Concurrency@@
typedef struct __Concurrent_vector_base_v4 { - void* (__cdecl *allocator)(struct __Concurrent_vector_base_v4 *, size_t); + void* (__cdecl __WINE_ALLOC_SIZE(2) *allocator)(struct __Concurrent_vector_base_v4 *, size_t); void *storage[3]; size_t first_block; size_t early_size; diff --git a/dlls/concrt140/details.h b/dlls/concrt140/details.h index fc229e1704a..f5f2c90024b 100644 --- a/dlls/concrt140/details.h +++ b/dlls/concrt140/details.h @@ -22,8 +22,8 @@ #include "winternl.h" #include "cppexcept.h"
-void* __cdecl operator_new(size_t); void __cdecl operator_delete(void*); +void* __cdecl operator_new(size_t) __WINE_ALLOC_SIZE(1) __WINE_DEALLOC(operator_delete) __WINE_MALLOC;
bool __cdecl Context_IsCurrentTaskCollectionCanceling(void);
From: Alex Henrie alexhenrie24@gmail.com
--- dlls/msvcirt/msvcirt.c | 2 +- dlls/msvcirt/msvcirt.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/msvcirt/msvcirt.c b/dlls/msvcirt/msvcirt.c index 05e3aee4b6a..a36671cb6e8 100644 --- a/dlls/msvcirt/msvcirt.c +++ b/dlls/msvcirt/msvcirt.c @@ -5129,7 +5129,7 @@ void __cdecl _mtunlock(CRITICAL_SECTION *crit) LeaveCriticalSection(crit); }
-static void* (__cdecl *MSVCRT_operator_new)(SIZE_T); +static void* (__cdecl __WINE_ALLOC_SIZE(1) *MSVCRT_operator_new)(SIZE_T); static void (__cdecl *MSVCRT_operator_delete)(void*);
void* __cdecl operator_new(SIZE_T size) diff --git a/dlls/msvcirt/msvcirt.h b/dlls/msvcirt/msvcirt.h index ccbc7027146..0dfaa03dc7c 100644 --- a/dlls/msvcirt/msvcirt.h +++ b/dlls/msvcirt/msvcirt.h @@ -68,7 +68,7 @@ typedef enum { FLAGS_stdio = 0x4000 } ios_flags;
-void* __cdecl operator_new(SIZE_T); void __cdecl operator_delete(void*); +void* __cdecl operator_new(SIZE_T) __WINE_ALLOC_SIZE(1) __WINE_DEALLOC(operator_delete) __WINE_MALLOC;
void init_exception(void*);
From: Alex Henrie alexhenrie24@gmail.com
--- dlls/msvcp60/ios.c | 2 +- dlls/msvcp60/main.c | 2 +- dlls/msvcp60/msvcp.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/dlls/msvcp60/ios.c b/dlls/msvcp60/ios.c index e54161a1d3c..b94dba86062 100644 --- a/dlls/msvcp60/ios.c +++ b/dlls/msvcp60/ios.c @@ -279,7 +279,7 @@ typedef struct { char *seekhigh; streamsize minsize; int strmode; - void* (__cdecl *palloc)(size_t); + void* (__cdecl __WINE_ALLOC_SIZE(1) *palloc)(size_t); void (__cdecl *pfree)(void*); } strstreambuf;
diff --git a/dlls/msvcp60/main.c b/dlls/msvcp60/main.c index 5d1894cb073..001dd64d0e2 100644 --- a/dlls/msvcp60/main.c +++ b/dlls/msvcp60/main.c @@ -58,7 +58,7 @@ DEFINE_VTBL_WRAPPER(56); /* ?_Fpz@std@@3_JB */ const __int64 std_Fpz = 0;
-static void* (__cdecl *MSVCRT_operator_new)(size_t); +static void* (__cdecl __WINE_ALLOC_SIZE(1) *MSVCRT_operator_new)(size_t); static void (__cdecl *MSVCRT_operator_delete)(void*); void* (__cdecl *MSVCRT_set_new_handler)(void*);
diff --git a/dlls/msvcp60/msvcp.h b/dlls/msvcp60/msvcp.h index 0a9ee7f11c1..2eb220745ae 100644 --- a/dlls/msvcp60/msvcp.h +++ b/dlls/msvcp60/msvcp.h @@ -30,8 +30,8 @@ void __cdecl _invalid_parameter(const wchar_t*, const wchar_t*, const wchar_t*, unsigned int, uintptr_t); BOOL __cdecl __uncaught_exception(void);
-void* __cdecl operator_new(size_t); void __cdecl operator_delete(void*); +void* __cdecl operator_new(size_t) __WINE_ALLOC_SIZE(1) __WINE_DEALLOC(operator_delete) __WINE_MALLOC;
/* basic_string<char, char_traits<char>, allocator<char>> */ typedef struct @@ -71,8 +71,8 @@ void __thiscall MSVCP_basic_string_wchar_clear(basic_string_wchar*); basic_string_wchar* __thiscall MSVCP_basic_string_wchar_append_ch(basic_string_wchar*, wchar_t); size_t __thiscall MSVCP_basic_string_wchar_length(const basic_string_wchar*);
-char* __thiscall MSVCP_allocator_char_allocate(void*, size_t); void __thiscall MSVCP_allocator_char_deallocate(void*, char*, size_t); +char* __thiscall MSVCP_allocator_char_allocate(void*, size_t) __WINE_ALLOC_SIZE(2) __WINE_DEALLOC(MSVCP_allocator_char_deallocate, 2); size_t __thiscall MSVCP_allocator_char_max_size(const void*); wchar_t* __thiscall MSVCP_allocator_wchar_allocate(void*, size_t); void __thiscall MSVCP_allocator_wchar_deallocate(void*, wchar_t*, size_t);
From: Alex Henrie alexhenrie24@gmail.com
--- dlls/msvcp90/details.c | 2 +- dlls/msvcp90/ios.c | 2 +- dlls/msvcp90/msvcp90.h | 4 ++-- dlls/msvcp90/msvcp_main.c | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/dlls/msvcp90/details.c b/dlls/msvcp90/details.c index 984a277ed12..2bf2f052561 100644 --- a/dlls/msvcp90/details.c +++ b/dlls/msvcp90/details.c @@ -412,7 +412,7 @@ DEFINE_RTTI_DATA0(_Runtime_object, 0, ".?AV_Runtime_object@details@Concurrency@@
typedef struct __Concurrent_vector_base_v4 { - void* (__cdecl *allocator)(struct __Concurrent_vector_base_v4 *, size_t); + void* (__cdecl __WINE_ALLOC_SIZE(2) *allocator)(struct __Concurrent_vector_base_v4 *, size_t); void *storage[3]; size_t first_block; size_t early_size; diff --git a/dlls/msvcp90/ios.c b/dlls/msvcp90/ios.c index 80e7694bd0f..cb3e7573283 100644 --- a/dlls/msvcp90/ios.c +++ b/dlls/msvcp90/ios.c @@ -296,7 +296,7 @@ typedef struct { char *endsave; char *seekhigh; int strmode; - void* (__cdecl *palloc)(size_t); + void* (__cdecl __WINE_ALLOC_SIZE(1) *palloc)(size_t); void (__cdecl *pfree)(void*); } strstreambuf;
diff --git a/dlls/msvcp90/msvcp90.h b/dlls/msvcp90/msvcp90.h index 23ce63947e5..925af2eda73 100644 --- a/dlls/msvcp90/msvcp90.h +++ b/dlls/msvcp90/msvcp90.h @@ -38,8 +38,8 @@ void __cdecl _invalid_parameter_noinfo(void); BOOL __cdecl __uncaught_exception(void); int __cdecl _callnewh(size_t);
-void* __cdecl operator_new(size_t); void __cdecl operator_delete(void*); +void* __cdecl operator_new(size_t) __WINE_ALLOC_SIZE(1) __WINE_DEALLOC(operator_delete) __WINE_MALLOC; extern void* (__cdecl *MSVCRT_set_new_handler)(void*);
#if _MSVCP_VER >= 110 @@ -160,8 +160,8 @@ void __thiscall MSVCP_basic_string_wchar_clear(basic_string_wchar*); basic_string_wchar* __thiscall MSVCP_basic_string_wchar_append_ch(basic_string_wchar*, wchar_t); size_t __thiscall MSVCP_basic_string_wchar_length(const basic_string_wchar*);
-char* __thiscall MSVCP_allocator_char_allocate(void*, size_t); void __thiscall MSVCP_allocator_char_deallocate(void*, char*, size_t); +char* __thiscall MSVCP_allocator_char_allocate(void*, size_t) __WINE_ALLOC_SIZE(2) __WINE_DEALLOC(MSVCP_allocator_char_deallocate, 2) __WINE_MALLOC; size_t __thiscall MSVCP_allocator_char_max_size(const void*); wchar_t* __thiscall MSVCP_allocator_wchar_allocate(void*, size_t); void __thiscall MSVCP_allocator_wchar_deallocate(void*, wchar_t*, size_t); diff --git a/dlls/msvcp90/msvcp_main.c b/dlls/msvcp90/msvcp_main.c index 8717384c2c6..ad0137f4741 100644 --- a/dlls/msvcp90/msvcp_main.c +++ b/dlls/msvcp90/msvcp_main.c @@ -246,7 +246,7 @@ void __cdecl _invalid_parameter(const wchar_t *expr, const wchar_t *func, const _invalid_parameter_noinfo(); } #else -static void* (__cdecl *MSVCRT_operator_new)(size_t); +static void* (__cdecl __WINE_ALLOC_SIZE(1) *MSVCRT_operator_new)(size_t); static void (__cdecl *MSVCRT_operator_delete)(void*);
void* __cdecl operator_new(size_t size)
From: Alex Henrie alexhenrie24@gmail.com
--- dlls/msvcrt/msvcrt.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dlls/msvcrt/msvcrt.h b/dlls/msvcrt/msvcrt.h index 480d0e238fc..77170fff919 100644 --- a/dlls/msvcrt/msvcrt.h +++ b/dlls/msvcrt/msvcrt.h @@ -250,11 +250,11 @@ extern unsigned int MSVCRT__commode; /* FIXME: This should be declared in new.h but it's not an extern "C" so * it would not be much use anyway. Even for Winelib applications. */ -void* __cdecl operator_new(size_t); void __cdecl operator_delete(void*); +void* __cdecl operator_new(size_t) __WINE_ALLOC_SIZE(1) __WINE_DEALLOC(operator_delete) __WINE_MALLOC; int __cdecl _set_new_mode(int mode);
-typedef void* (__cdecl *malloc_func_t)(size_t); +typedef void* (__cdecl __WINE_ALLOC_SIZE(1) *malloc_func_t)(size_t); typedef void (__cdecl *free_func_t)(void*);
/* Setup and teardown multi threaded locks */
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The tests also ran into some preexisting test failures. If you know how to fix them that would be helpful. See the TestBot job for the details:
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=150636
Your paranoid android.
=== debian11b (64 bit WoW report) ===
user32: input.c:4305: Test succeeded inside todo block: button_down_hwnd_todo 1: got MSG_TEST_WIN hwnd 0000000001B700F6, msg WM_LBUTTONDOWN, wparam 0x1, lparam 0x320032
Piotr Caban (@piotr) commented about dlls/msvcirt/msvcirt.c:
LeaveCriticalSection(crit);
}
-static void* (__cdecl *MSVCRT_operator_new)(SIZE_T); +static void* (__cdecl __WINE_ALLOC_SIZE(1) *MSVCRT_operator_new)(SIZE_T);
Shouldn't we also add __WINE_MALLOC attribute here?
On Thu Jan 2 14:15:42 2025 +0000, Piotr Caban wrote:
Shouldn't we also add __WINE_MALLOC attribute here?
GCC doesn't currently support `__attribute__((malloc))` on function pointers: If you try to use it here, you get `warning: ‘malloc’ attribute does not apply to types [-Wattributes]`.
This merge request was approved by Piotr Caban.