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
This commit is contained in:
Christian Blichmann 2021-02-02 00:56:30 -08:00 committed by Copybara-Service
parent 55a8373ec3
commit 1840083919
2 changed files with 4 additions and 8 deletions

View File

@ -78,14 +78,14 @@ struct FuncCall {
struct FuncRet { struct FuncRet {
// Return type: // Return type:
v::Type ret_type = v::Type::kVoid; v::Type ret_type;
// Return value. // Return value.
union { union {
uintptr_t int_val = 0; uintptr_t int_val;
long double float_val; long double float_val;
}; };
// Status of the operation: success/failure. // Status of the operation: success/failure.
bool success = false; bool success;
}; };
} // namespace sapi } // namespace sapi

View File

@ -340,11 +340,7 @@ void ServeRequest(sandbox2::Comms* comms) {
CHECK(comms->RecvTLV(&tag, &bytes)); CHECK(comms->RecvTLV(&tag, &bytes));
FuncRet ret = { FuncRet ret{}; // Brace-init zeroes struct padding
.ret_type = v::Type::kVoid,
.int_val = static_cast<uintptr_t>(Error::kUnset),
.success = false,
};
switch (tag) { switch (tag) {
case comms::kMsgCall: case comms::kMsgCall: