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

[SR-1045] Serious Issue with unable to use Macros defined in Project Preprocessor Build Setting With Xcode 7.3 and Swift. #43657

Open
swift-ci opened this issue Mar 23, 2016 · 6 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-1045
Radar https://openradar.appspot.com/25322018
Original Reporter jscampbell05 (JIRA User)
Type Bug

Attachment: Download

Environment

Xcode 7.3, OS X 10.11, Swift 2.2

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, ClangImporter
Assignee None
Priority Medium

md5: 2f6f4152186372585254b5d992921f7c

Issue Description:

We are experiencing an issue when compiling swift code under Xcode 7.3.

Preprocessor macros specified in the Xcode Project aren't imported into swift. Ones manually declared in code are imported fine.

Specifying Xcode 7.3 to use the Xcode 7.2 toolchain (Swift 2.1 etc) has no effect on this.

This is preventing us from using Xcode 7.3 and being able to test for 9.3. Anybody else getting this issue?

@belkadan
Copy link
Contributor

Please attach a self-contained test case, so that we know we're seeing the same issue. (It's very possible this is an Xcode issue rather than a Swift issue, in which case this would not be the right place to file it.)

@swift-ci
Copy link
Collaborator Author

Comment by James Campbell (JIRA)

I've attached a project. This works in Xcode 7.2 but not Xcode 7.3.

@swift-ci
Copy link
Collaborator Author

swift-ci commented Apr 8, 2016

Comment by Joaquin (JIRA)

Is there any updates on this? I'm facing the same problem with Xcode 7.3

@swift-ci
Copy link
Collaborator Author

swift-ci commented Apr 8, 2016

Comment by James Campbell (JIRA)

Patrono (JIRA User) The compiler team said that this was unintended behaviour in earlier version of Swift.

To still use it you have to bridge the macros in like so:

Macros.h (Included in the bridging header):

static NSString * const kENDPOINT_MACRO = ENDPOINT_MACRO;

Code.swift:

print(kENDPOINT_MACRO)

@swift-ci
Copy link
Collaborator Author

swift-ci commented Apr 8, 2016

Comment by Joaquin (JIRA)

jscampbell05 (JIRA User) thanks for that solution!

@modocache
Copy link
Mannequin

modocache mannequin commented Dec 29, 2016

If this is the desired behavior, should this task be closed as invalid?

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

2 participants