gtest: Fix maybe-uninitialized compiler warning

This is a cherry-pick from upstream - 4679637f ("Fix warning maybe-uninitialized").

Signed-off-by: Christian Gmeiner <christian.gmeiner@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17121>
This commit is contained in:
Christian Gmeiner 2022-06-18 18:30:23 +02:00 committed by Marge Bot
parent d06335ed76
commit 828793cb82

View File

@ -1288,7 +1288,7 @@ static void StackLowerThanAddress(const void* ptr,
// making comparison result unpredictable.
GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_
static void StackLowerThanAddress(const void* ptr, bool* result) {
int dummy;
int dummy = 0;
*result = (&dummy < ptr);
}
@ -1296,7 +1296,7 @@ static void StackLowerThanAddress(const void* ptr, bool* result) {
GTEST_ATTRIBUTE_NO_SANITIZE_ADDRESS_
GTEST_ATTRIBUTE_NO_SANITIZE_HWADDRESS_
static bool StackGrowsDown() {
int dummy;
int dummy = 0;
bool result;
StackLowerThanAddress(&dummy, &result);
return result;