From 1840083919375f85ae76acafd5cb09594a0b269f Mon Sep 17 00:00:00 2001 From: Christian Blichmann Date: Tue, 2 Feb 2021 00:56:30 -0800 Subject: [PATCH] Avoid complex designated initializer, initialize internal struct padding The former is to fix compilation on GCC 7, the latter to satisfy MSAN. PiperOrigin-RevId: 355114355 Change-Id: I5c89a65df16fe9338bcfa24b2e48c246d240ce62 --- sandboxed_api/call.h | 6 +++--- sandboxed_api/client.cc | 6 +----- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/sandboxed_api/call.h b/sandboxed_api/call.h index 8859f9b..06def7e 100644 --- a/sandboxed_api/call.h +++ b/sandboxed_api/call.h @@ -78,14 +78,14 @@ struct FuncCall { struct FuncRet { // Return type: - v::Type ret_type = v::Type::kVoid; + v::Type ret_type; // Return value. union { - uintptr_t int_val = 0; + uintptr_t int_val; long double float_val; }; // Status of the operation: success/failure. - bool success = false; + bool success; }; } // namespace sapi diff --git a/sandboxed_api/client.cc b/sandboxed_api/client.cc index 48f22ce..ab8c5ec 100644 --- a/sandboxed_api/client.cc +++ b/sandboxed_api/client.cc @@ -340,11 +340,7 @@ void ServeRequest(sandbox2::Comms* comms) { CHECK(comms->RecvTLV(&tag, &bytes)); - FuncRet ret = { - .ret_type = v::Type::kVoid, - .int_val = static_cast(Error::kUnset), - .success = false, - }; + FuncRet ret{}; // Brace-init zeroes struct padding switch (tag) { case comms::kMsgCall: