Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build failure on Xcode 12.5 beta 3 #2297

Merged
merged 1 commit into from
Mar 12, 2021
Merged

Fix build failure on Xcode 12.5 beta 3 #2297

merged 1 commit into from
Mar 12, 2021

Conversation

vincentisambart
Copy link
Contributor

When I tried building our app with Xcode 12.5 beta 3, it failed building RxCocoa.
Here are fixes for RxSwift and AllTests to build (and run) successfully on Xcode 12.5 (I also made sure I did not break Xcode 12.4).

@@ -1022,7 +1022,7 @@ -(BOOL)ensureSwizzledSelector:(SEL __nonnull)selector

#if TRACE_RESOURCES

NSInteger RX_number_of_dynamic_subclasses() {
NSInteger RX_number_of_dynamic_subclasses(void) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Xcode gave the following error before the fix:

.../RxSwift/RxCocoa/Runtime/_RXObjCRuntime.m:1025:42: error: this old-style function definition is not preceded by a prototype [-Werror,-Wstrict-prototypes]
NSInteger RX_number_of_dynamic_subclasses() {
                                         ^
.../RxSwift/RxCocoa/Runtime/_RXObjCRuntime.m:1034:50: error: this old-style function definition is not preceded by a prototype [-Werror,-Wstrict-prototypes]
NSInteger RX_number_of_forwarding_enabled_classes() {
                                                 ^
.../RxSwift/RxCocoa/Runtime/_RXObjCRuntime.m:1043:44: error: this old-style function definition is not preceded by a prototype [-Werror,-Wstrict-prototypes]
NSInteger RX_number_of_intercepting_classes() {
                                           ^
.../RxSwift/RxCocoa/Runtime/_RXObjCRuntime.m:1052:41: error: this old-style function definition is not preceded by a prototype [-Werror,-Wstrict-prototypes]
NSInteger RX_number_of_forwarded_methods() {
                                        ^
.../RxSwift/RxCocoa/Runtime/_RXObjCRuntime.m:1056:40: error: this old-style function definition is not preceded by a prototype [-Werror,-Wstrict-prototypes]
NSInteger RX_number_of_swizzled_methods() {
                                       ^
5 errors generated.

@@ -307,7 +307,7 @@ -(NSInteger)message_allSupportedParameters:(id __nullable)p1
p16:(some_insanely_large_struct_t)p16 { \
[self.privateBaseMessages addObject:A( \
p1 ?: [NSNull null], \
p2 ?: [NSNull null], \
(id)p2 ?: [NSNull null], \
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Without these changes, the library built successfully, but Xcode could not build the tests with the following error:

.../RxSwift/Tests/RxCocoaTests/RXObjCRuntime+Testing.m:604:1: error: incompatible operand types ('Class _Nullable' and 'NSNull * _Nonnull') [-Werror]
IMPLEMENT_OBSERVING_CLASS_PAIR_FOR_TEST(shared)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../RxSwift/Tests/RxCocoaTests/RXObjCRuntime+Testing.m:56:59: note: expanded from macro 'IMPLEMENT_OBSERVING_CLASS_PAIR_FOR_TEST'
#define IMPLEMENT_OBSERVING_CLASS_PAIR_FOR_TEST(testName) _IMPLEMENT_OBSERVING_CLASS_PAIR_FOR_TEST(testName,,)
                                                          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.../RxSwift/Tests/RxCocoaTests/RXObjCRuntime+Testing.m:310:12: note: expanded from macro '_IMPLEMENT_OBSERVING_CLASS_PAIR_FOR_TEST'
        p2 ?: [NSNull null],                                                                                                                   \
        ~~ ^  ~~~~~~~~~~~~~
.../RxSwift/Tests/RxCocoaTests/RXObjCRuntime+Testing.m:17:49: note: expanded from macro 'A'
#define A(...) [Arguments argumentsWithValues:@[__VA_ARGS__]]
                                                ^~~~~~~~~~~

It was complaining that p2 being a Class does not go well along with a NSNull so I made sure p2 was seen as an id with a cast.

Copy link
Member

@freak4pc freak4pc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fixes! Weird that Xcode 12.5 enables strict flags by default.

@freak4pc freak4pc merged commit cee84b2 into ReactiveX:develop Mar 12, 2021
@vincentisambart vincentisambart deleted the fix-xcode-12.5b3 branch April 22, 2021 22:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants