From 6933e2f499b8c2b3a318cc4dbceb83b88ab39b0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Campam=C3=A1?= Date: Tue, 5 Jun 2018 15:14:19 -0400 Subject: [PATCH] Update code to work for Xcode 10b1 (#4729) * Update code to work for Xcode 10b * Update README and test scripts to mention that Xcode 7 is no longer supported --- objectivec/DevTools/full_mac_build.sh | 3 +-- objectivec/GPBArray.m | 4 ++-- objectivec/GPBDescriptor.m | 6 +++--- objectivec/GPBDictionary.m | 4 ++-- objectivec/README.md | 2 +- 5 files changed, 9 insertions(+), 10 deletions(-) diff --git a/objectivec/DevTools/full_mac_build.sh b/objectivec/DevTools/full_mac_build.sh index 42e4105aa8..c673fcba37 100755 --- a/objectivec/DevTools/full_mac_build.sh +++ b/objectivec/DevTools/full_mac_build.sh @@ -244,8 +244,7 @@ if [[ "${DO_XCODE_IOS_TESTS}" == "yes" ]] ; then exit 10 ;; 7.* ) - echo "ERROR: The unittests include Swift code that is now Swift 3.0." 1>&2 - echo "ERROR: Xcode 8.0 or higher is required to build the test suite, but the library works with Xcode 7.x." 1>&2 + echo "ERROR: Xcode 7.x no longer supported for building, please use 8.0 or higher." 1>&2 exit 11 ;; 8.0* ) diff --git a/objectivec/GPBArray.m b/objectivec/GPBArray.m index f401631d12..122e0304b3 100644 --- a/objectivec/GPBArray.m +++ b/objectivec/GPBArray.m @@ -2537,12 +2537,12 @@ static BOOL ArrayDefault_IsValidValue(int32_t value) { return [_array countByEnumeratingWithState:state objects:buffer count:len]; } -- (void)enumerateObjectsUsingBlock:(void (^)(id obj, NSUInteger idx, BOOL *stop))block { +- (void)enumerateObjectsUsingBlock:(void (NS_NOESCAPE ^)(id obj, NSUInteger idx, BOOL *stop))block { [_array enumerateObjectsUsingBlock:block]; } - (void)enumerateObjectsWithOptions:(NSEnumerationOptions)opts - usingBlock:(void (^)(id obj, NSUInteger idx, BOOL *stop))block { + usingBlock:(void (NS_NOESCAPE ^)(id obj, NSUInteger idx, BOOL *stop))block { [_array enumerateObjectsWithOptions:opts usingBlock:block]; } diff --git a/objectivec/GPBDescriptor.m b/objectivec/GPBDescriptor.m index 83cbce07ae..ad46ef4f03 100644 --- a/objectivec/GPBDescriptor.m +++ b/objectivec/GPBDescriptor.m @@ -411,7 +411,7 @@ static NSArray *NewFieldsArrayForHasIndex(int hasIndex, } - (NSString *)name { - return @(name_); + return (NSString * _Nonnull)@(name_); } - (GPBFieldDescriptor *)fieldWithNumber:(uint32_t)fieldNumber { @@ -582,7 +582,7 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) { } - (NSString *)name { - return @(description_->name); + return (NSString * _Nonnull)@(description_->name); } - (BOOL)isRequired { @@ -1015,7 +1015,7 @@ uint32_t GPBFieldAlternateTag(GPBFieldDescriptor *self) { } - (NSString *)singletonName { - return @(description_->singletonName); + return (NSString * _Nonnull)@(description_->singletonName); } - (const char *)singletonNameC { diff --git a/objectivec/GPBDictionary.m b/objectivec/GPBDictionary.m index aa21670aa3..cedf5e549d 100644 --- a/objectivec/GPBDictionary.m +++ b/objectivec/GPBDictionary.m @@ -12102,14 +12102,14 @@ void GPBDictionaryReadEntry(id mapDictionary, } } -- (void)enumerateKeysAndObjectsUsingBlock:(void (^)(id key, +- (void)enumerateKeysAndObjectsUsingBlock:(void (NS_NOESCAPE ^)(id key, id obj, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsUsingBlock:block]; } - (void)enumerateKeysAndObjectsWithOptions:(NSEnumerationOptions)opts - usingBlock:(void (^)(id key, + usingBlock:(void (NS_NOESCAPE ^)(id key, id obj, BOOL *stop))block { [_dictionary enumerateKeysAndObjectsWithOptions:opts usingBlock:block]; diff --git a/objectivec/README.md b/objectivec/README.md index 110e7f55df..21ac07d804 100644 --- a/objectivec/README.md +++ b/objectivec/README.md @@ -13,7 +13,7 @@ Requirements The Objective C implementation requires: - Objective C 2.0 Runtime (32bit & 64bit iOS, 64bit OS X). -- Xcode 7.0 (or later). +- Xcode 8.0 (or later). - The library code does *not* use ARC (for performance reasons), but it all can be called from ARC code.