POSIX module names collide with language keywords

Originator:zwaldowski
Number:rdar://18440532 Date Originated:24 Sep 2014
Status:Open Resolved:false
Product:Developer Tools Product Version:Xcode 6.1 DP2 (6A1030), OS X 10.10 Beta 3 (14A361p)
Classification:Enhancement Reproducible:Sometimes
 
Summary:
In a perfect world, every header in /usr/include and /System/Library/Frameworks should have a parent module available to include. An average Objective-C project should be able to use @imports universally without relying on Clang auto-translating #imports.

Certain modules,

Steps to Reproduce:

Steps to Reproduce:
1. Enable modules for an Xcode project.
2. Active "-Wauto-import" to migrate to @import modules.
3. Use Xcode Fix-It to replace "#import <netinet/in.h>" and "#import <net/if.h>" with "@import Darwin.POSIX.netinet.in;" and "@import Darwin.POSIX.net.if;", respectively.

Expected Results:
The project builds successfully after using the Fix-It to switch to @import.

Actual Results:
Xcode fails to build the file thereafter, with a parse error "expected a module name after module import". The code editor in Xcode highlights "in" and "if" in the module names as if they are language keywords.

Version:
Xcode 6.1 DP2 (6A1030), OS X 10.10 Beta 3 (14A361p)

Notes:
Workaround involves leaving the old #import in, relying on Clang auto-import, and disabling "-Wauto-import".

Configuration:
Does not occur in a legacy project without modules enabled. Does not occur when @import is avoided but modules are activated, using Clang's auto-import feature.

Attachments:

Comments

This issue still occurs in Xcode Version 7.0 beta 2.

By zwaldowski at June 23, 2015, 8:53 p.m. (reply...)

This issue still occurs in Xcode Version 6.3 (6D532l).

By zwaldowski at Feb. 23, 2015, 11:57 p.m. (reply...)

This issue still occurs in Xcode Version 6.3 (6D520o).

By zwaldowski at Feb. 10, 2015, 2:49 a.m. (reply...)

Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!