Add __unused to variable to silence unused-variable warning

NSCAssert() can be optimised away leaving the `firstField` appear as unused.  (See details in the internal CL)
pull/10165/head
Vy Nguyen 3 years ago committed by GitHub
parent 046bde0017
commit 60a7f1f2fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      objectivec/GPBUtilities.m

@ -2248,7 +2248,7 @@ void GPBMaybeClearOneof(GPBMessage *self, GPBOneofDescriptor *oneof,
NSCAssert([[self descriptor] oneofWithName:oneof.name] == oneof,
@"OneofDescriptor %@ doesn't appear to be for %@ messages.",
oneof.name, [self class]);
GPBFieldDescriptor *firstField = oneof->fields_[0];
GPBFieldDescriptor *firstField __unused = oneof->fields_[0];
NSCAssert(firstField->description_->hasIndex == oneofHasIndex,
@"Internal error, oneofHasIndex (%d) doesn't match (%d).",
firstField->description_->hasIndex, oneofHasIndex);

Loading…
Cancel
Save