Merge pull request #1617 from thomasvl/more_warnings

Add -Woverriding-method-mismatch.
This commit is contained in:
Thomas Van Lenten 2016-05-27 15:04:06 -04:00
commit 40ff94ebef
6 changed files with 249 additions and 172 deletions

View File

@ -164,15 +164,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
//% [super dealloc];
//%}
//%
//%- (BOOL)isEqual:(GPB##NAME##Array *)other {
//%- (BOOL)isEqual:(id)other {
//% if (self == other) {
//% return YES;
//% }
//% if (![other isKindOfClass:[GPB##NAME##Array class]]) {
//% return NO;
//% }
//% return (_count == other->_count
//% && memcmp(_values, other->_values, (_count * sizeof(TYPE))) == 0);
//% GPB##NAME##Array *otherArray = other;
//% return (_count == otherArray->_count
//% && memcmp(_values, otherArray->_values, (_count * sizeof(TYPE))) == 0);
//%}
//%
//%- (NSUInteger)hash {
@ -374,15 +375,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
[super dealloc];
}
- (BOOL)isEqual:(GPBInt32Array *)other {
- (BOOL)isEqual:(id)other {
if (self == other) {
return YES;
}
if (![other isKindOfClass:[GPBInt32Array class]]) {
return NO;
}
return (_count == other->_count
&& memcmp(_values, other->_values, (_count * sizeof(int32_t))) == 0);
GPBInt32Array *otherArray = other;
return (_count == otherArray->_count
&& memcmp(_values, otherArray->_values, (_count * sizeof(int32_t))) == 0);
}
- (NSUInteger)hash {
@ -621,15 +623,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
[super dealloc];
}
- (BOOL)isEqual:(GPBUInt32Array *)other {
- (BOOL)isEqual:(id)other {
if (self == other) {
return YES;
}
if (![other isKindOfClass:[GPBUInt32Array class]]) {
return NO;
}
return (_count == other->_count
&& memcmp(_values, other->_values, (_count * sizeof(uint32_t))) == 0);
GPBUInt32Array *otherArray = other;
return (_count == otherArray->_count
&& memcmp(_values, otherArray->_values, (_count * sizeof(uint32_t))) == 0);
}
- (NSUInteger)hash {
@ -868,15 +871,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
[super dealloc];
}
- (BOOL)isEqual:(GPBInt64Array *)other {
- (BOOL)isEqual:(id)other {
if (self == other) {
return YES;
}
if (![other isKindOfClass:[GPBInt64Array class]]) {
return NO;
}
return (_count == other->_count
&& memcmp(_values, other->_values, (_count * sizeof(int64_t))) == 0);
GPBInt64Array *otherArray = other;
return (_count == otherArray->_count
&& memcmp(_values, otherArray->_values, (_count * sizeof(int64_t))) == 0);
}
- (NSUInteger)hash {
@ -1115,15 +1119,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
[super dealloc];
}
- (BOOL)isEqual:(GPBUInt64Array *)other {
- (BOOL)isEqual:(id)other {
if (self == other) {
return YES;
}
if (![other isKindOfClass:[GPBUInt64Array class]]) {
return NO;
}
return (_count == other->_count
&& memcmp(_values, other->_values, (_count * sizeof(uint64_t))) == 0);
GPBUInt64Array *otherArray = other;
return (_count == otherArray->_count
&& memcmp(_values, otherArray->_values, (_count * sizeof(uint64_t))) == 0);
}
- (NSUInteger)hash {
@ -1362,15 +1367,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
[super dealloc];
}
- (BOOL)isEqual:(GPBFloatArray *)other {
- (BOOL)isEqual:(id)other {
if (self == other) {
return YES;
}
if (![other isKindOfClass:[GPBFloatArray class]]) {
return NO;
}
return (_count == other->_count
&& memcmp(_values, other->_values, (_count * sizeof(float))) == 0);
GPBFloatArray *otherArray = other;
return (_count == otherArray->_count
&& memcmp(_values, otherArray->_values, (_count * sizeof(float))) == 0);
}
- (NSUInteger)hash {
@ -1609,15 +1615,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
[super dealloc];
}
- (BOOL)isEqual:(GPBDoubleArray *)other {
- (BOOL)isEqual:(id)other {
if (self == other) {
return YES;
}
if (![other isKindOfClass:[GPBDoubleArray class]]) {
return NO;
}
return (_count == other->_count
&& memcmp(_values, other->_values, (_count * sizeof(double))) == 0);
GPBDoubleArray *otherArray = other;
return (_count == otherArray->_count
&& memcmp(_values, otherArray->_values, (_count * sizeof(double))) == 0);
}
- (NSUInteger)hash {
@ -1856,15 +1863,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
[super dealloc];
}
- (BOOL)isEqual:(GPBBoolArray *)other {
- (BOOL)isEqual:(id)other {
if (self == other) {
return YES;
}
if (![other isKindOfClass:[GPBBoolArray class]]) {
return NO;
}
return (_count == other->_count
&& memcmp(_values, other->_values, (_count * sizeof(BOOL))) == 0);
GPBBoolArray *otherArray = other;
return (_count == otherArray->_count
&& memcmp(_values, otherArray->_values, (_count * sizeof(BOOL))) == 0);
}
- (NSUInteger)hash {
@ -2127,15 +2135,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
[super dealloc];
}
- (BOOL)isEqual:(GPBEnumArray *)other {
- (BOOL)isEqual:(id)other {
if (self == other) {
return YES;
}
if (![other isKindOfClass:[GPBEnumArray class]]) {
return NO;
}
return (_count == other->_count
&& memcmp(_values, other->_values, (_count * sizeof(int32_t))) == 0);
GPBEnumArray *otherArray = other;
return (_count == otherArray->_count
&& memcmp(_values, otherArray->_values, (_count * sizeof(int32_t))) == 0);
}
- (NSUInteger)hash {

View File

@ -39,6 +39,12 @@
NS_ASSUME_NONNULL_BEGIN
// Disable -Woverriding-method-mismatch until resolving the accidental conflict
// with NSObject's KVC category.
// https://github.com/google/protobuf/issues/1616 opened to resolve this.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Woverriding-method-mismatch"
//%PDDM-EXPAND DECLARE_DICTIONARIES()
// This block of code is generated, do not edit it directly.
@ -2085,6 +2091,8 @@ NS_ASSUME_NONNULL_BEGIN
//%PDDM-EXPAND-END DECLARE_DICTIONARIES()
#pragma clang diagnostic pop
NS_ASSUME_NONNULL_END
//%PDDM-DEFINE DECLARE_DICTIONARIES()

File diff suppressed because it is too large Load Diff

View File

@ -2563,7 +2563,7 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream(
#pragma mark - isEqual: & hash Support
- (BOOL)isEqual:(GPBMessage *)other {
- (BOOL)isEqual:(id)other {
if (other == self) {
return YES;
}
@ -2572,9 +2572,10 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream(
return NO;
}
GPBMessage *otherMsg = other;
GPBDescriptor *descriptor = [[self class] descriptor];
uint8_t *selfStorage = (uint8_t *)messageStorage_;
uint8_t *otherStorage = (uint8_t *)other->messageStorage_;
uint8_t *otherStorage = (uint8_t *)otherMsg->messageStorage_;
for (GPBFieldDescriptor *field in descriptor->fields_) {
if (GPBFieldIsMapOrArray(field)) {
@ -2668,14 +2669,14 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream(
} // for(fields)
// nil and empty are equal
if (extensionMap_.count != 0 || other->extensionMap_.count != 0) {
if (![extensionMap_ isEqual:other->extensionMap_]) {
if (extensionMap_.count != 0 || otherMsg->extensionMap_.count != 0) {
if (![extensionMap_ isEqual:otherMsg->extensionMap_]) {
return NO;
}
}
// nil and empty are equal
GPBUnknownFieldSet *otherUnknowns = other->unknownFields_;
GPBUnknownFieldSet *otherUnknowns = otherMsg->unknownFields_;
if ([unknownFields_ countOfFields] != 0 ||
[otherUnknowns countOfFields] != 0) {
if (![unknownFields_ isEqual:otherUnknowns]) {

View File

@ -836,6 +836,7 @@
"-Wreserved-id-macro",
"-Wswitch-enum",
"-Wdirect-ivar-access",
"-Woverriding-method-mismatch",
);
};
name = Debug;
@ -892,6 +893,7 @@
"-Wreserved-id-macro",
"-Wswitch-enum",
"-Wdirect-ivar-access",
"-Woverriding-method-mismatch",
);
};
name = Release;

View File

@ -999,6 +999,7 @@
"-Wreserved-id-macro",
"-Wswitch-enum",
"-Wdirect-ivar-access",
"-Woverriding-method-mismatch",
);
};
name = Debug;
@ -1056,6 +1057,7 @@
"-Wreserved-id-macro",
"-Wswitch-enum",
"-Wdirect-ivar-access",
"-Woverriding-method-mismatch",
);
};
name = Release;