Bug 218850

Summary: configure-xcode-for-embedded-development breaks @available in Swift files
Product: WebKit Reporter: Ali Juma <ajuma>
Component: Tools / TestsAssignee: Ali Juma <ajuma>
Status: RESOLVED FIXED    
Severity: Normal CC: jbedard, webkit-bug-importer
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
Attachments:
Description Flags
Patch none

Description Ali Juma 2020-11-12 08:49:39 PST
The changes applied by configure-xcode-for-embedded-development leave Xcode in state where using @available in a Swift class breaks compilation of Objective-C methods marked with API_AVAILABLE that call into that class.

Specifically, suppose we have:
-a Swift class Foo marked @available(iOS 14.0, *)
-an ObjC class Bar with a method myMethod marked API_AVAILABLE(ios(14))

The changes applied by configure-xcode-for-embedded-development for AvailabilityProhibitedInternal.h cause API_AVAILABLE to be ignored, but @available is not ignored. This means that calling from myMethod into Foo, which should be fine since both are available only in iOS 14+, results in a build failure when building with -Werror -Wunguarded-availability, since after pre-processing, myMethod has no availability notation.

I ran into this when trying to build Chrome for iOS using the same Xcode that I use for building WebKit.
Comment 1 Ali Juma 2020-11-12 08:59:43 PST
Created attachment 413939 [details]
Patch
Comment 2 Jonathan Bedard 2020-11-12 09:04:30 PST
Comment on attachment 413939 [details]
Patch

I think this is correct, but I want to verify that our embedded builds still work after this change, which will take some time. Unfortunately, EWS isn't going to test the changes here.
Comment 3 Jonathan Bedard 2020-11-12 14:06:51 PST
Comment on attachment 413939 [details]
Patch

Tested with out embedded builds, should be good to go!
Comment 4 Ali Juma 2020-11-12 14:09:45 PST
(In reply to Jonathan Bedard from comment #3)
> Comment on attachment 413939 [details]
> Patch
> 
> Tested with out embedded builds, should be good to go!

Thanks for the review and for testing this!
Comment 5 EWS 2020-11-12 14:19:10 PST
Committed r269752: <https://trac.webkit.org/changeset/269752>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 413939 [details].
Comment 6 Radar WebKit Bug Importer 2020-11-12 14:20:18 PST
<rdar://problem/71343631>