[swift-users] Serious Issue with Project Preprocessor Build Setting, Xcode 7.3 and Swift.

Daniel Dunbar daniel_dunbar at apple.com
Thu Mar 24 11:06:24 CDT 2016


(+Jordan)

Jordan, did something change here? Were we previously getting these via the Clang importer in a way we aren't anymore?

 - Daniel

> On Mar 24, 2016, at 9:02 AM, James Campbell <james at supmenow.com> wrote:
> 
> I've just attached one now. The preprocessor macro is specified in the build settings.
> 
> In Xcode 7.2 these were imported and worked like they did in C i.e API_VERSION=2 would be imported as a constant named API_VERSION and would be a 2
> 
> In Xcode 7.3 it broke.
> 
> ___________________________________
> 
> James⎥Head Of CEO
> 
> james at supmenow.com <mailto:james at supmenow.com>⎥supmenow.com <http://supmenow.com/>
> Sup
> 
> Runway East
> 
> 
> 10 Finsbury Square
> 
> London
> 
> 
> EC2A 1AF 
> 
> 
> On Thu, Mar 24, 2016 at 3:54 PM, Daniel Dunbar <daniel_dunbar at apple.com <mailto:daniel_dunbar at apple.com>> wrote:
> Swift has never supported referring directly to macros, it only supports "build configurations". I'm still not sure exactly what you have that could have worked previously.
> 
> Can you please attach a complete project showing something which worked in 7.2 and does not work now to the bug you filed?
> 
>  - Daniel
> 
>> On Mar 24, 2016, at 8:50 AM, James Campbell <james at supmenow.com <mailto:james at supmenow.com>> wrote:
>> 
>> To hold keys and api endpoints.
>> 
>> In the past for Objective-C I would have used it like this:
>> 
>> request.api_endpoint = MY_MACRO_ENDPOINT
>> 
>> And then when Swift was released I was able to do it in Xcode 7.2:
>> 
>> request.api_endpoint = MY_MACRO_ENDPOINT
>> 
>> But when using Xocde 7.3 I get this:
>> 
>> request.api_endpoint = MY_MACRO_ENDPOINT //MY_MACRO_ENDPOINT not defined.
>> 
>> 
>> ___________________________________
>> 
>> James⎥Head Of CEO
>> 
>> james at supmenow.com <mailto:james at supmenow.com>⎥supmenow.com <http://supmenow.com/>
>> Sup
>> 
>> Runway East
>> 
>> 
>> 10 Finsbury Square
>> 
>> London
>> 
>> 
>> EC2A 1AF 
>> 
>> 
>> On Thu, Mar 24, 2016 at 3:40 PM, Daniel Dunbar <daniel_dunbar at apple.com <mailto:daniel_dunbar at apple.com>> wrote:
>> 
>>> On Mar 24, 2016, at 5:21 AM, James Campbell <james at supmenow.com <mailto:james at supmenow.com>> wrote:
>>> 
>>> This is the "GCC_PREPROCESSOR_DEFINITIONS" build setting. This previously imported into swift. But in Xcode 7.3 it no longer does this.
>> 
>> Ok, and exactly how are you trying to use them? Via an #if in C or via an #if in Swift?
>> 
>>  - Daniel
>> 
>>> 
>>> If I write the Macros in the bridging header they are imported but I would ideally like to keep them in a build setting.
>>> 
>>> ___________________________________
>>> 
>>> James⎥Head Of CEO
>>> 
>>> james at supmenow.com <mailto:james at supmenow.com>⎥supmenow.com <http://supmenow.com/>
>>> Sup
>>> 
>>> Runway East
>>> 
>>> 
>>> 10 Finsbury Square
>>> 
>>> London
>>> 
>>> 
>>> EC2A 1AF 
>>> 
>>> 
>>> On Wed, Mar 23, 2016 at 11:23 PM, Daniel Dunbar <daniel_dunbar at apple.com <mailto:daniel_dunbar at apple.com>> wrote:
>>> To follow on to what Joe said, can you provide more info about the exact problem. Is this a C preprocessor definition that you expect to be available in code imported by the Clang importer (i.e., bridging header files, etc.), or is a a macro you are expecting to use within Swift itself? And please let us know exactly which build setting you are referring to.
>>> 
>>> Thanks,
>>>  - Daniel
>>> 
>>> > On Mar 23, 2016, at 3:59 PM, Joe Groff via swift-users <swift-users at swift.org <mailto:swift-users at swift.org>> wrote:
>>> >
>>> >
>>> >> On Mar 23, 2016, at 9:43 AM, James Campbell via swift-users <swift-users at swift.org <mailto:swift-users at swift.org>> wrote:
>>> >>
>>> >> 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?
>>> >
>>> > The Swift and C family build settings in Xcode are distinct. Are you sure you set the -D flags in "Other Swift Flags" and not in the C build settings? Swift doesn't have preprocessor macros.
>>> >
>>> > -Joe
>>> >
>>> > _______________________________________________
>>> > swift-users mailing list
>>> > swift-users at swift.org <mailto:swift-users at swift.org>
>>> > https://lists.swift.org/mailman/listinfo/swift-users <https://lists.swift.org/mailman/listinfo/swift-users>
>>> 
>>> 
>> 
>> 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-users/attachments/20160324/c403c6e9/attachment.html>


More information about the swift-users mailing list