Skip to content

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

Open
@lilyball

Description

@lilyball
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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.c interopFeature: Interoperability with Cc/c++ macroscompilerThe Swift compiler itself

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions