Commit 40ff94eb authored by Thomas Van Lenten's avatar Thomas Van Lenten

Merge pull request #1617 from thomasvl/more_warnings

Add -Woverriding-method-mismatch.
parents 86e8f1fd 38b9e746
...@@ -164,15 +164,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) { ...@@ -164,15 +164,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
//% [super dealloc]; //% [super dealloc];
//%} //%}
//% //%
//%- (BOOL)isEqual:(GPB##NAME##Array *)other { //%- (BOOL)isEqual:(id)other {
//% if (self == other) { //% if (self == other) {
//% return YES; //% return YES;
//% } //% }
//% if (![other isKindOfClass:[GPB##NAME##Array class]]) { //% if (![other isKindOfClass:[GPB##NAME##Array class]]) {
//% return NO; //% return NO;
//% } //% }
//% return (_count == other->_count //% GPB##NAME##Array *otherArray = other;
//% && memcmp(_values, other->_values, (_count * sizeof(TYPE))) == 0); //% return (_count == otherArray->_count
//% && memcmp(_values, otherArray->_values, (_count * sizeof(TYPE))) == 0);
//%} //%}
//% //%
//%- (NSUInteger)hash { //%- (NSUInteger)hash {
...@@ -374,15 +375,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) { ...@@ -374,15 +375,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
[super dealloc]; [super dealloc];
} }
- (BOOL)isEqual:(GPBInt32Array *)other { - (BOOL)isEqual:(id)other {
if (self == other) { if (self == other) {
return YES; return YES;
} }
if (![other isKindOfClass:[GPBInt32Array class]]) { if (![other isKindOfClass:[GPBInt32Array class]]) {
return NO; return NO;
} }
return (_count == other->_count GPBInt32Array *otherArray = other;
&& memcmp(_values, other->_values, (_count * sizeof(int32_t))) == 0); return (_count == otherArray->_count
&& memcmp(_values, otherArray->_values, (_count * sizeof(int32_t))) == 0);
} }
- (NSUInteger)hash { - (NSUInteger)hash {
...@@ -621,15 +623,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) { ...@@ -621,15 +623,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
[super dealloc]; [super dealloc];
} }
- (BOOL)isEqual:(GPBUInt32Array *)other { - (BOOL)isEqual:(id)other {
if (self == other) { if (self == other) {
return YES; return YES;
} }
if (![other isKindOfClass:[GPBUInt32Array class]]) { if (![other isKindOfClass:[GPBUInt32Array class]]) {
return NO; return NO;
} }
return (_count == other->_count GPBUInt32Array *otherArray = other;
&& memcmp(_values, other->_values, (_count * sizeof(uint32_t))) == 0); return (_count == otherArray->_count
&& memcmp(_values, otherArray->_values, (_count * sizeof(uint32_t))) == 0);
} }
- (NSUInteger)hash { - (NSUInteger)hash {
...@@ -868,15 +871,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) { ...@@ -868,15 +871,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
[super dealloc]; [super dealloc];
} }
- (BOOL)isEqual:(GPBInt64Array *)other { - (BOOL)isEqual:(id)other {
if (self == other) { if (self == other) {
return YES; return YES;
} }
if (![other isKindOfClass:[GPBInt64Array class]]) { if (![other isKindOfClass:[GPBInt64Array class]]) {
return NO; return NO;
} }
return (_count == other->_count GPBInt64Array *otherArray = other;
&& memcmp(_values, other->_values, (_count * sizeof(int64_t))) == 0); return (_count == otherArray->_count
&& memcmp(_values, otherArray->_values, (_count * sizeof(int64_t))) == 0);
} }
- (NSUInteger)hash { - (NSUInteger)hash {
...@@ -1115,15 +1119,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) { ...@@ -1115,15 +1119,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
[super dealloc]; [super dealloc];
} }
- (BOOL)isEqual:(GPBUInt64Array *)other { - (BOOL)isEqual:(id)other {
if (self == other) { if (self == other) {
return YES; return YES;
} }
if (![other isKindOfClass:[GPBUInt64Array class]]) { if (![other isKindOfClass:[GPBUInt64Array class]]) {
return NO; return NO;
} }
return (_count == other->_count GPBUInt64Array *otherArray = other;
&& memcmp(_values, other->_values, (_count * sizeof(uint64_t))) == 0); return (_count == otherArray->_count
&& memcmp(_values, otherArray->_values, (_count * sizeof(uint64_t))) == 0);
} }
- (NSUInteger)hash { - (NSUInteger)hash {
...@@ -1362,15 +1367,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) { ...@@ -1362,15 +1367,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
[super dealloc]; [super dealloc];
} }
- (BOOL)isEqual:(GPBFloatArray *)other { - (BOOL)isEqual:(id)other {
if (self == other) { if (self == other) {
return YES; return YES;
} }
if (![other isKindOfClass:[GPBFloatArray class]]) { if (![other isKindOfClass:[GPBFloatArray class]]) {
return NO; return NO;
} }
return (_count == other->_count GPBFloatArray *otherArray = other;
&& memcmp(_values, other->_values, (_count * sizeof(float))) == 0); return (_count == otherArray->_count
&& memcmp(_values, otherArray->_values, (_count * sizeof(float))) == 0);
} }
- (NSUInteger)hash { - (NSUInteger)hash {
...@@ -1609,15 +1615,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) { ...@@ -1609,15 +1615,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
[super dealloc]; [super dealloc];
} }
- (BOOL)isEqual:(GPBDoubleArray *)other { - (BOOL)isEqual:(id)other {
if (self == other) { if (self == other) {
return YES; return YES;
} }
if (![other isKindOfClass:[GPBDoubleArray class]]) { if (![other isKindOfClass:[GPBDoubleArray class]]) {
return NO; return NO;
} }
return (_count == other->_count GPBDoubleArray *otherArray = other;
&& memcmp(_values, other->_values, (_count * sizeof(double))) == 0); return (_count == otherArray->_count
&& memcmp(_values, otherArray->_values, (_count * sizeof(double))) == 0);
} }
- (NSUInteger)hash { - (NSUInteger)hash {
...@@ -1856,15 +1863,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) { ...@@ -1856,15 +1863,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
[super dealloc]; [super dealloc];
} }
- (BOOL)isEqual:(GPBBoolArray *)other { - (BOOL)isEqual:(id)other {
if (self == other) { if (self == other) {
return YES; return YES;
} }
if (![other isKindOfClass:[GPBBoolArray class]]) { if (![other isKindOfClass:[GPBBoolArray class]]) {
return NO; return NO;
} }
return (_count == other->_count GPBBoolArray *otherArray = other;
&& memcmp(_values, other->_values, (_count * sizeof(BOOL))) == 0); return (_count == otherArray->_count
&& memcmp(_values, otherArray->_values, (_count * sizeof(BOOL))) == 0);
} }
- (NSUInteger)hash { - (NSUInteger)hash {
...@@ -2127,15 +2135,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) { ...@@ -2127,15 +2135,16 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) {
[super dealloc]; [super dealloc];
} }
- (BOOL)isEqual:(GPBEnumArray *)other { - (BOOL)isEqual:(id)other {
if (self == other) { if (self == other) {
return YES; return YES;
} }
if (![other isKindOfClass:[GPBEnumArray class]]) { if (![other isKindOfClass:[GPBEnumArray class]]) {
return NO; return NO;
} }
return (_count == other->_count GPBEnumArray *otherArray = other;
&& memcmp(_values, other->_values, (_count * sizeof(int32_t))) == 0); return (_count == otherArray->_count
&& memcmp(_values, otherArray->_values, (_count * sizeof(int32_t))) == 0);
} }
- (NSUInteger)hash { - (NSUInteger)hash {
......
...@@ -39,6 +39,12 @@ ...@@ -39,6 +39,12 @@
NS_ASSUME_NONNULL_BEGIN 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() //%PDDM-EXPAND DECLARE_DICTIONARIES()
// This block of code is generated, do not edit it directly. // This block of code is generated, do not edit it directly.
...@@ -2085,6 +2091,8 @@ NS_ASSUME_NONNULL_BEGIN ...@@ -2085,6 +2091,8 @@ NS_ASSUME_NONNULL_BEGIN
//%PDDM-EXPAND-END DECLARE_DICTIONARIES() //%PDDM-EXPAND-END DECLARE_DICTIONARIES()
#pragma clang diagnostic pop
NS_ASSUME_NONNULL_END NS_ASSUME_NONNULL_END
//%PDDM-DEFINE DECLARE_DICTIONARIES() //%PDDM-DEFINE DECLARE_DICTIONARIES()
......
This diff is collapsed.
...@@ -2563,7 +2563,7 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream( ...@@ -2563,7 +2563,7 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream(
#pragma mark - isEqual: & hash Support #pragma mark - isEqual: & hash Support
- (BOOL)isEqual:(GPBMessage *)other { - (BOOL)isEqual:(id)other {
if (other == self) { if (other == self) {
return YES; return YES;
} }
...@@ -2572,9 +2572,10 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream( ...@@ -2572,9 +2572,10 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream(
return NO; return NO;
} }
GPBMessage *otherMsg = other;
GPBDescriptor *descriptor = [[self class] descriptor]; GPBDescriptor *descriptor = [[self class] descriptor];
uint8_t *selfStorage = (uint8_t *)messageStorage_; 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_) { for (GPBFieldDescriptor *field in descriptor->fields_) {
if (GPBFieldIsMapOrArray(field)) { if (GPBFieldIsMapOrArray(field)) {
...@@ -2668,14 +2669,14 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream( ...@@ -2668,14 +2669,14 @@ static void MergeRepeatedNotPackedFieldFromCodedInputStream(
} // for(fields) } // for(fields)
// nil and empty are equal // nil and empty are equal
if (extensionMap_.count != 0 || other->extensionMap_.count != 0) { if (extensionMap_.count != 0 || otherMsg->extensionMap_.count != 0) {
if (![extensionMap_ isEqual:other->extensionMap_]) { if (![extensionMap_ isEqual:otherMsg->extensionMap_]) {
return NO; return NO;
} }
} }
// nil and empty are equal // nil and empty are equal
GPBUnknownFieldSet *otherUnknowns = other->unknownFields_; GPBUnknownFieldSet *otherUnknowns = otherMsg->unknownFields_;
if ([unknownFields_ countOfFields] != 0 || if ([unknownFields_ countOfFields] != 0 ||
[otherUnknowns countOfFields] != 0) { [otherUnknowns countOfFields] != 0) {
if (![unknownFields_ isEqual:otherUnknowns]) { if (![unknownFields_ isEqual:otherUnknowns]) {
......
...@@ -836,6 +836,7 @@ ...@@ -836,6 +836,7 @@
"-Wreserved-id-macro", "-Wreserved-id-macro",
"-Wswitch-enum", "-Wswitch-enum",
"-Wdirect-ivar-access", "-Wdirect-ivar-access",
"-Woverriding-method-mismatch",
); );
}; };
name = Debug; name = Debug;
...@@ -892,6 +893,7 @@ ...@@ -892,6 +893,7 @@
"-Wreserved-id-macro", "-Wreserved-id-macro",
"-Wswitch-enum", "-Wswitch-enum",
"-Wdirect-ivar-access", "-Wdirect-ivar-access",
"-Woverriding-method-mismatch",
); );
}; };
name = Release; name = Release;
......
...@@ -999,6 +999,7 @@ ...@@ -999,6 +999,7 @@
"-Wreserved-id-macro", "-Wreserved-id-macro",
"-Wswitch-enum", "-Wswitch-enum",
"-Wdirect-ivar-access", "-Wdirect-ivar-access",
"-Woverriding-method-mismatch",
); );
}; };
name = Debug; name = Debug;
...@@ -1056,6 +1057,7 @@ ...@@ -1056,6 +1057,7 @@
"-Wreserved-id-macro", "-Wreserved-id-macro",
"-Wswitch-enum", "-Wswitch-enum",
"-Wdirect-ivar-access", "-Wdirect-ivar-access",
"-Woverriding-method-mismatch",
); );
}; };
name = Release; name = Release;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment