-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Conversation
@@ -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) { |
There was a problem hiding this comment.
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], \ |
There was a problem hiding this comment.
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.
There was a problem hiding this 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.
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).