Cygwin: fix initializing MEM_EXTENDED_PARAMETER, take 2

In https://cygwin.com/pipermail/cygwin/2021-September/249361.html
Brian pointed out that initializing the structure would be more
future proof, should the developers at Microsoft ever decide to
split the Reserved field and use some bits of the struct for
other purposes.

Fixes: 3d322ac930 ("Cygwin: fix initializing MEM_EXTENDED_PARAMETER")
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
This commit is contained in:
Corinna Vinschen 2021-09-08 10:07:46 +02:00
parent b52f10c4ca
commit 8fba45f0cc
2 changed files with 4 additions and 8 deletions

View File

@ -517,9 +517,8 @@ class thread_allocator
THREAD_STACK_SLOT
};
/* g++ 11.2 workaround: don't use initializer */
MEM_EXTENDED_PARAMETER thread_ext;
MEM_EXTENDED_PARAMETER thread_ext = { 0 };
thread_ext.Type = MemExtendedParameterAddressRequirements;
thread_ext.Reserved = 0;
thread_ext.Pointer = (PVOID) &thread_req;
SIZE_T real_size = roundup2 (size, THREAD_STACK_SLOT);
@ -539,9 +538,8 @@ class thread_allocator
THREAD_STACK_SLOT
};
/* g++ 11.2 workaround: don't use initializer */
MEM_EXTENDED_PARAMETER mmap_ext;
MEM_EXTENDED_PARAMETER mmap_ext = { 0 };
mmap_ext.Type = MemExtendedParameterAddressRequirements;
mmap_ext.Reserved = 0;
mmap_ext.Pointer = (PVOID) &mmap_req;
real_stackaddr = VirtualAlloc2 (GetCurrentProcess(), NULL, real_size,

View File

@ -207,9 +207,8 @@ MapView (HANDLE h, void *addr, size_t len, DWORD openflags,
0
};
/* g++ 11.2 workaround: don't use initializer */
MEM_EXTENDED_PARAMETER mmap_ext;
MEM_EXTENDED_PARAMETER mmap_ext = { 0 };
mmap_ext.Type = MemExtendedParameterAddressRequirements;
mmap_ext.Reserved = 0;
mmap_ext.Pointer = (PVOID) &mmap_req;
alloc_type |= attached (prot) ? MEM_RESERVE : 0;
@ -1628,9 +1627,8 @@ fhandler_dev_zero::mmap (caddr_t *addr, size_t len, int prot,
0
};
/* g++ 11.2 workaround: don't use initializer */
MEM_EXTENDED_PARAMETER mmap_ext;
MEM_EXTENDED_PARAMETER mmap_ext = { 0 };
mmap_ext.Type = MemExtendedParameterAddressRequirements;
mmap_ext.Reserved = 0;
mmap_ext.Pointer = (PVOID) &mmap_req;
base = VirtualAlloc2 (GetCurrentProcess(), *addr, len, alloc_type,