Skip to content

Commit 302e8e7

Browse files
committed
Deprecate versioned __swift__ macro in imported (Obj)C(++) code.
Leaving behind an un-versioned `__swift__` macro. Originally added in swiftlang#4510 (rdar://26921435) following a discussion in https://lists.swift.org/pipermail/swift-dev/Week-of-Mon-20160822/002754.html, the versioned macro was used to allow clients primarily to ready their existing ObjectiveC code for Swift 2 -> Swift 3 transition. Now that neither one of those versions is a supported language mode and we have versioned APINotes support, and we do not currently know of clients that rely on the version carried by this macro, we would like to deprecate it, leaving behind the un-versioned `-D__swift__`. The reason for the deprecation is that it is likely that in a build with multiple targets which have very similar configuration aside from Swift language version, they would not be able to share module dependencies due to the mismatch in the macro value.
1 parent 9c94192 commit 302e8e7

File tree

4 files changed

+4
-8
lines changed

4 files changed

+4
-8
lines changed

include/swift/SIL/SILBuilder.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3319,7 +3319,7 @@ class DebugLocOverrideRAII {
33193319
}
33203320

33213321
~DebugLocOverrideRAII() {
3322-
ASSERT(Builder.getCurrentDebugLocOverride() == installedOverride &&
3322+
assert(Builder.getCurrentDebugLocOverride() == installedOverride &&
33233323
"Restoring debug location override to an unexpected state");
33243324
Builder.applyDebugLocOverride(oldOverride);
33253325
}

lib/ClangImporter/ClangImporter.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -509,7 +509,7 @@ void importer::getNormalInvocationArguments(
509509
// Enable block support.
510510
"-fblocks",
511511

512-
languageVersion.preprocessorDefinition("__swift__", {10000, 100, 1}),
512+
"-D__swift__",
513513

514514
"-fretain-comments-from-system-headers",
515515

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
#if !defined(__swift__)
22
# error "__swift__ not defined"
3-
#elif __swift__ < 30000
4-
# error "Why are you using such an old version of Swift?"
5-
#elif __swift__ >= 810000
6-
# error "Is Swift 81 out already? If so, please update this test."
73
#else
8-
void swift3ReadyToGo();
4+
void swiftReadyToGo();
95
#endif

test/ClangImporter/predefined_macros.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@
22

33
import PredefinedMacros
44

5-
swift3ReadyToGo()
5+
swiftReadyToGo()

0 commit comments

Comments
 (0)