From ef406a6c215d70139364c62a2b4c94dc65e101a4 Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Tue, 4 May 2021 10:08:23 +0900 Subject: Suppress maybe-uninitialized warning by mingw gcc 11 --- thread_win32.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'thread_win32.c') diff --git a/thread_win32.c b/thread_win32.c index f4b4ea214c..04c48653c5 100644 --- a/thread_win32.c +++ b/thread_win32.c @@ -546,6 +546,17 @@ ruby_init_stack(volatile VALUE *addr) #define CHECK_ERR(expr) \ {if (!(expr)) {rb_bug("err: %lu - %s", GetLastError(), #expr);}} +COMPILER_WARNING_PUSH +#if defined(__GNUC__) +COMPILER_WARNING_IGNORED(-Wmaybe-uninitialized) +#endif +static inline SIZE_T +query_memory_basic_info(PMEMORY_BASIC_INFORMATION mi) +{ + return VirtualQuery(mi, mi, sizeof(*mi)); +} +COMPILER_WARNING_POP + static void native_thread_init_stack(rb_thread_t *th) { @@ -553,7 +564,7 @@ native_thread_init_stack(rb_thread_t *th) char *base, *end; DWORD size, space; - CHECK_ERR(VirtualQuery(&mi, &mi, sizeof(mi))); + CHECK_ERR(query_memory_basic_info(&mi)); base = mi.AllocationBase; end = mi.BaseAddress; end += mi.RegionSize; -- cgit v1.2.3