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-485] C macros of the form ((long long)-1) should be imported #43102

Open
lilyball mannequin opened this issue Jan 6, 2016 · 2 comments
Open

[SR-485] C macros of the form ((long long)-1) should be imported #43102

lilyball mannequin opened this issue Jan 6, 2016 · 2 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. c/c++ macros c interop Feature: Interoperability with C compiler The Swift compiler in itself

Comments

@lilyball
Copy link
Mannequin

lilyball mannequin commented Jan 6, 2016

Previous ID SR-485
Radar rdar://problem/20462344
Original Reporter @lilyball
Type Bug
Environment

Apple Swift version 2.1.1 (swiftlang-700.1.101.15 clang-700.1.81)
Target: x86_64-apple-darwin15.2.0

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

md5: 4f56b5e5a3db09cb27d77f8e3f9984fc

relates to:

  • SR-141 Complex C header files macros are ignored
  • SR-2402 Clang importer should import nullary function-like macros

Issue Description:

It turns out that NSURLResponseUnknownLength isn't exposed to Swift because the macro definition doesn't match Swift's rules for importable macros. The definition is:

#define NSURLResponseUnknownLength ((long long)-1)

This looks relatively straightforward, and should be simple enough that Swift can support. In general, any macro whose definition is the form ((SomeType)literal) should be importable.

@swift-ci
Copy link
Collaborator

Comment by Rick M (JIRA)

I'm having a similar problem with #define foo 1*2*3

@swift-ci
Copy link
Collaborator

Comment by Ky (JIRA)

This is necessary to complete the contract described in https://developer.apple.com/documentation/foundation/urlresponse/1413507-expectedcontentlength.

Without this, that contract cannot be fulfilled by API users

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. c/c++ macros c interop Feature: Interoperability with C compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

2 participants