-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Description
| Previous ID | SR-15104 |
| Radar | None |
| Original Reporter | kencarroll (JIRA User) |
| Type | New Feature |
| Status | Closed |
| Resolution | Invalid |
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler |
| Labels | New Feature |
| Assignee | None |
| Priority | Medium |
md5: fe3fe7453f0368659c15d0054060070a
Issue Description:
The macro #if os(Linux) of #if MY_FLAG requires full syntactic correctness.
For example code will compile.
#if !os(Linux)
public var x = 1
#else
@objc public var x = 1
#endif
However, the following code will not compile:
#if !os(Linux)
@objc
#endif
public var x = 1
This is compounded in protocols, classes and enums where multiple fully syntactically correct versions must exist for each class, protocol or enum to be exported to Objective C on an Apple platform.
This means that a single code base cannot be used to build for the different target platforms (Linux, Apple) necessitating either bespoke pre-build project generation or separate code branches or directories for affected libraries.
Clearly, both of these solutions are error prone and could be solved by not requiring syntactic correctness of conditionally dependent code snippets.