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
···
On Mar 23, 2016, at 9:43 AM, James Campbell via swift-users <swift-users@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?
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@swift.org> wrote:
On Mar 23, 2016, at 9:43 AM, James Campbell via swift-users <swift-users@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.
On Wed, Mar 23, 2016 at 11:23 PM, Daniel Dunbar <daniel_dunbar@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@swift.org> wrote:
>
>
>> On Mar 23, 2016, at 9:43 AM, James Campbell via swift-users < > swift-users@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@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
On Wed, Mar 23, 2016 at 11:23 PM, Daniel Dunbar <daniel_dunbar@apple.com <mailto:daniel_dunbar@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@swift.org <mailto:swift-users@swift.org>> wrote:
>
>
>> On Mar 23, 2016, at 9:43 AM, James Campbell via swift-users <swift-users@swift.org <mailto:swift-users@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@swift.org <mailto:swift-users@swift.org>
> https://lists.swift.org/mailman/listinfo/swift-users
On Wed, Mar 23, 2016 at 11:23 PM, Daniel Dunbar <daniel_dunbar@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@swift.org> wrote:
>
>
>> On Mar 23, 2016, at 9:43 AM, James Campbell via swift-users < >> swift-users@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@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
Explained in rest of the thread. It seems that in Xcode 7.2 if you
specified a C Macro in the build settings it was imported (i.e
API_VERSION=2). However in Xcode 7.3, only ones specified in code are
imported *not* ones specified in a build setting.
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@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.
On Wed, Mar 23, 2016 at 11:23 PM, Daniel Dunbar <daniel_dunbar@apple.com <mailto:daniel_dunbar@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@swift.org <mailto:swift-users@swift.org>> wrote:
>
>
>> On Mar 23, 2016, at 9:43 AM, James Campbell via swift-users <swift-users@swift.org <mailto:swift-users@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@swift.org <mailto:swift-users@swift.org>
> https://lists.swift.org/mailman/listinfo/swift-users
On Thu, Mar 24, 2016 at 3:54 PM, Daniel Dunbar <daniel_dunbar@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@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.
On Wed, Mar 23, 2016 at 11:23 PM, Daniel Dunbar <daniel_dunbar@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@swift.org> wrote:
>
>
>> On Mar 23, 2016, at 9:43 AM, James Campbell via swift-users < >>> swift-users@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@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
On Thu, Mar 24, 2016 at 3:54 PM, Daniel Dunbar <daniel_dunbar@apple.com <mailto:daniel_dunbar@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@supmenow.com <mailto:james@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.
On Wed, Mar 23, 2016 at 11:23 PM, Daniel Dunbar <daniel_dunbar@apple.com <mailto:daniel_dunbar@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@swift.org <mailto:swift-users@swift.org>> wrote:
>
>
>> On Mar 23, 2016, at 9:43 AM, James Campbell via swift-users <swift-users@swift.org <mailto:swift-users@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@swift.org <mailto:swift-users@swift.org>
> https://lists.swift.org/mailman/listinfo/swift-users
Ahh. Yes, we were. We would define the macro in Clang, then when we do a lookup we'd get it back out in Swift. I, um, wouldn't have considered that intentional, but clearly people are depending on it. Sorry, James!
Doug, we saw a similar issue with macros in bridging headers, right? Do you remember which that was? Do you have an opinion here?
Jordan
···
On Mar 24, 2016, at 9:06 , Daniel Dunbar <daniel_dunbar@apple.com> wrote:
(+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@supmenow.com <mailto:james@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
On Thu, Mar 24, 2016 at 3:54 PM, Daniel Dunbar <daniel_dunbar@apple.com <mailto:daniel_dunbar@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@supmenow.com <mailto:james@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.
On Wed, Mar 23, 2016 at 11:23 PM, Daniel Dunbar <daniel_dunbar@apple.com <mailto:daniel_dunbar@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@swift.org <mailto:swift-users@swift.org>> wrote:
>
>
>> On Mar 23, 2016, at 9:43 AM, James Campbell via swift-users <swift-users@swift.org <mailto:swift-users@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@swift.org <mailto:swift-users@swift.org>
> https://lists.swift.org/mailman/listinfo/swift-users
The reason this wouldn't have been considered intentional is because it only works for targets with bridging headers. Frameworks? Nope. Pure Swift targets? Nope.
Jordan
···
On Mar 24, 2016, at 10:05 , Jordan Rose <jordan_rose@apple.com> wrote:
Ahh. Yes, we were. We would define the macro in Clang, then when we do a lookup we'd get it back out in Swift. I, um, wouldn't have considered that intentional, but clearly people are depending on it. Sorry, James!
Doug, we saw a similar issue with macros in bridging headers, right? Do you remember which that was? Do you have an opinion here?
Jordan
On Mar 24, 2016, at 9:06 , Daniel Dunbar <daniel_dunbar@apple.com <mailto:daniel_dunbar@apple.com>> wrote:
(+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@supmenow.com <mailto:james@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
On Thu, Mar 24, 2016 at 3:54 PM, Daniel Dunbar <daniel_dunbar@apple.com <mailto:daniel_dunbar@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@supmenow.com <mailto:james@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.
On Wed, Mar 23, 2016 at 11:23 PM, Daniel Dunbar <daniel_dunbar@apple.com <mailto:daniel_dunbar@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@swift.org <mailto:swift-users@swift.org>> wrote:
>
>
>> On Mar 23, 2016, at 9:43 AM, James Campbell via swift-users <swift-users@swift.org <mailto:swift-users@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@swift.org <mailto:swift-users@swift.org>
> https://lists.swift.org/mailman/listinfo/swift-users
I'm not following the macro issue as closely as I maybe should, but in
my current ObjC apps I depend on GCC_PREPROCESSOR_DEFINITIONS to
conditionally include sections of code (or not). (I don't however use it
to directly expand as a macro value.)
This is typically to accomodate differences between Mac App Store and
Developer ID builds, by defining these values in .xcconfig files.
Hopefully some mechanism like this will be available in Swift if ?
···
On 3/24/16 14:05, Jordan Rose via swift-users wrote:
Ahh. Yes, we were. We would define the macro in Clang, then when we
do a lookup we'd get it back out in Swift. I, um, wouldn't have
considered that intentional, but clearly people are depending on it.
--
Rainer Brockerhoff <rainer@brockerhoff.net>
Belo Horizonte, Brazil
"In the affairs of others even fools are wise
In their own business even sages err."
Yeah I noticed that it only works in Xcode 7.2 when you have a bridging
header and in Xcode 7.3 if it's explicitly declared in code and you have a
bridging header.
Is there a way we could bring this back for a Swift 2.2.1 ? It eased our
migration from Objective-C.
If the recommended path is to have swift constants and if statements, then
we could remove this again in Swift 3 since there are already a lot of
things breaking in that version I would expect something like this to
happen :)
On Thu, Mar 24, 2016 at 5:06 PM, Jordan Rose <jordan_rose@apple.com> wrote:
The reason this wouldn't have been considered intentional is because it
only works for targets with bridging headers. Frameworks? Nope. Pure Swift
targets? Nope.
Jordan
On Mar 24, 2016, at 10:05 , Jordan Rose <jordan_rose@apple.com> wrote:
Ahh. Yes, we were. We would define the macro in Clang, then when we do a
lookup we'd get it back out in Swift. I, um, wouldn't have considered that
intentional, but clearly people are depending on it. Sorry, James!
Doug, we saw a similar issue with macros in bridging headers, right? Do
you remember which that was? Do you have an opinion here?
Jordan
On Mar 24, 2016, at 9:06 , Daniel Dunbar <daniel_dunbar@apple.com> wrote:
(+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@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
On Thu, Mar 24, 2016 at 3:54 PM, Daniel Dunbar <daniel_dunbar@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@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.
On Wed, Mar 23, 2016 at 11:23 PM, Daniel Dunbar <daniel_dunbar@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@swift.org> wrote:
>
>
>> On Mar 23, 2016, at 9:43 AM, James Campbell via swift-users < >>>> swift-users@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@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
I'm not sure what I would recommend; it depends what you're using this for. If it's C-style conditional compilation, Swift's own similar-but-more-limited if and -D flags are more powerful…but then you need to maintain two sets of flags. If it's constant integer values, typed constants (using 'static const' in C) are pretty much always better, even if you initialize them with a macro value. Constant strings don't really gain any benefit from 'static const' today, but it'll work.
The "2.2 is a minor update and shouldn't have changed behavior here" is a fair point.
Jordan
···
On Mar 24, 2016, at 10:25, James Campbell <james@supmenow.com> wrote:
Yeah I noticed that it only works in Xcode 7.2 when you have a bridging header and in Xcode 7.3 if it's explicitly declared in code and you have a bridging header.
Is there a way we could bring this back for a Swift 2.2.1 ? It eased our migration from Objective-C.
If the recommended path is to have swift constants and if statements, then we could remove this again in Swift 3 since there are already a lot of things breaking in that version I would expect something like this to happen :)
On Thu, Mar 24, 2016 at 5:06 PM, Jordan Rose <jordan_rose@apple.com <mailto:jordan_rose@apple.com>> wrote:
The reason this wouldn't have been considered intentional is because it only works for targets with bridging headers. Frameworks? Nope. Pure Swift targets? Nope.
Jordan
On Mar 24, 2016, at 10:05 , Jordan Rose <jordan_rose@apple.com <mailto:jordan_rose@apple.com>> wrote:
Ahh. Yes, we were. We would define the macro in Clang, then when we do a lookup we'd get it back out in Swift. I, um, wouldn't have considered that intentional, but clearly people are depending on it. Sorry, James!
Doug, we saw a similar issue with macros in bridging headers, right? Do you remember which that was? Do you have an opinion here?
Jordan
On Mar 24, 2016, at 9:06 , Daniel Dunbar <daniel_dunbar@apple.com <mailto:daniel_dunbar@apple.com>> wrote:
(+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@supmenow.com <mailto:james@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
On Thu, Mar 24, 2016 at 3:54 PM, Daniel Dunbar <daniel_dunbar@apple.com <mailto:daniel_dunbar@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@supmenow.com <mailto:james@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.
On Wed, Mar 23, 2016 at 11:23 PM, Daniel Dunbar <daniel_dunbar@apple.com <mailto:daniel_dunbar@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@swift.org <mailto:swift-users@swift.org>> wrote:
>
>
>> On Mar 23, 2016, at 9:43 AM, James Campbell via swift-users <swift-users@swift.org <mailto:swift-users@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@swift.org <mailto:swift-users@swift.org>
> https://lists.swift.org/mailman/listinfo/swift-users
On Thu, Mar 24, 2016 at 5:46 PM, Jordan Rose <jordan_rose@apple.com> wrote:
I'm not sure what I would recommend; it depends what you're using this
for. If it's C-style conditional compilation, Swift's own
similar-but-more-limited if and -D flags are more powerful…but then you
need to maintain two sets of flags. If it's constant integer values, typed
constants (using 'static const' in C) are pretty much always better, even
if you initialize them with a macro value. Constant strings don't really
gain any benefit from 'static const' today, but it'll work.
The "2.2 is a minor update and shouldn't have changed behavior here" is a
fair point.
Jordan
On Mar 24, 2016, at 10:25, James Campbell <james@supmenow.com> wrote:
Yeah I noticed that it only works in Xcode 7.2 when you have a bridging
header and in Xcode 7.3 if it's explicitly declared in code and you have a
bridging header.
Is there a way we could bring this back for a Swift 2.2.1 ? It eased our
migration from Objective-C.
If the recommended path is to have swift constants and if statements,
then we could remove this again in Swift 3 since there are already a lot of
things breaking in that version I would expect something like this to
happen :)
On Thu, Mar 24, 2016 at 5:06 PM, Jordan Rose <jordan_rose@apple.com> > wrote:
The reason this wouldn't have been considered intentional is because it
only works for targets with bridging headers. Frameworks? Nope. Pure Swift
targets? Nope.
Jordan
On Mar 24, 2016, at 10:05 , Jordan Rose <jordan_rose@apple.com> wrote:
Ahh. Yes, we were. We would define the macro in Clang, then when we do a
lookup we'd get it back out in Swift. I, um, wouldn't have considered that
intentional, but clearly people are depending on it. Sorry, James!
Doug, we saw a similar issue with macros in bridging headers, right? Do
you remember which that was? Do you have an opinion here?
Jordan
On Mar 24, 2016, at 9:06 , Daniel Dunbar <daniel_dunbar@apple.com> wrote:
(+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@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
On Thu, Mar 24, 2016 at 3:54 PM, Daniel Dunbar <daniel_dunbar@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@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.
On Wed, Mar 23, 2016 at 11:23 PM, Daniel Dunbar < >>>> daniel_dunbar@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@swift.org> wrote:
>
>
>> On Mar 23, 2016, at 9:43 AM, James Campbell via swift-users < >>>>> swift-users@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@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users
On Thu, Mar 24, 2016 at 5:46 PM, Jordan Rose <jordan_rose@apple.com <mailto:jordan_rose@apple.com>> wrote:
I'm not sure what I would recommend; it depends what you're using this for. If it's C-style conditional compilation, Swift's own similar-but-more-limited if and -D flags are more powerful…but then you need to maintain two sets of flags. If it's constant integer values, typed constants (using 'static const' in C) are pretty much always better, even if you initialize them with a macro value. Constant strings don't really gain any benefit from 'static const' today, but it'll work.
The "2.2 is a minor update and shouldn't have changed behavior here" is a fair point.
Jordan
On Mar 24, 2016, at 10:25, James Campbell <james@supmenow.com <mailto:james@supmenow.com>> wrote:
Yeah I noticed that it only works in Xcode 7.2 when you have a bridging header and in Xcode 7.3 if it's explicitly declared in code and you have a bridging header.
Is there a way we could bring this back for a Swift 2.2.1 ? It eased our migration from Objective-C.
If the recommended path is to have swift constants and if statements, then we could remove this again in Swift 3 since there are already a lot of things breaking in that version I would expect something like this to happen :)
On Thu, Mar 24, 2016 at 5:06 PM, Jordan Rose <jordan_rose@apple.com <mailto:jordan_rose@apple.com>> wrote:
The reason this wouldn't have been considered intentional is because it only works for targets with bridging headers. Frameworks? Nope. Pure Swift targets? Nope.
Jordan
On Mar 24, 2016, at 10:05 , Jordan Rose <jordan_rose@apple.com <mailto:jordan_rose@apple.com>> wrote:
Ahh. Yes, we were. We would define the macro in Clang, then when we do a lookup we'd get it back out in Swift. I, um, wouldn't have considered that intentional, but clearly people are depending on it. Sorry, James!
Doug, we saw a similar issue with macros in bridging headers, right? Do you remember which that was? Do you have an opinion here?
Jordan
On Mar 24, 2016, at 9:06 , Daniel Dunbar <daniel_dunbar@apple.com <mailto:daniel_dunbar@apple.com>> wrote:
(+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@supmenow.com <mailto:james@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
On Thu, Mar 24, 2016 at 3:54 PM, Daniel Dunbar <daniel_dunbar@apple.com <mailto:daniel_dunbar@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@supmenow.com <mailto:james@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.
On Wed, Mar 23, 2016 at 11:23 PM, Daniel Dunbar <daniel_dunbar@apple.com <mailto:daniel_dunbar@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@swift.org <mailto:swift-users@swift.org>> wrote:
>
>
>> On Mar 23, 2016, at 9:43 AM, James Campbell via swift-users <swift-users@swift.org <mailto:swift-users@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@swift.org <mailto:swift-users@swift.org>
> https://lists.swift.org/mailman/listinfo/swift-users