[K/N] Remove code for deprecated targets from runtime ^KT-59008

This commit is contained in:
Alexander Shabalin
2023-08-10 18:09:18 +02:00
committed by Space Team
parent e4a51dfa1b
commit 958d613911
59 changed files with 89 additions and 10406 deletions
@@ -43,8 +43,6 @@ sealed class ClangArgs(
"WINDOWS".takeIf { target.family == Family.MINGW },
"MACOSX".takeIf { target.family == Family.OSX },
"NO_THREADS".takeUnless { target.supportsThreads() },
"NO_EXCEPTIONS".takeUnless { target.supportsExceptions() },
"NO_MEMMEM".takeUnless { target.suportsMemMem() },
"NO_64BIT_ATOMIC".takeUnless { target.supports64BitAtomics() },
"NO_UNALIGNED_ACCESS".takeUnless { target.supportsUnalignedAccess() },
@@ -55,7 +53,6 @@ sealed class ClangArgs(
"HAS_UIKIT_FRAMEWORK".takeIf { target.hasUIKitFramework() },
"REPORT_BACKTRACE_TO_IOS_CRASH_LOG".takeIf { target.supportsIosCrashLog() },
"NEED_SMALL_BINARY".takeIf { target.needSmallBinary() },
"TARGET_HAS_ADDRESS_DEPENDENCY".takeIf { target.hasAddressDependencyInMemoryModel() },
"SUPPORTS_GRAND_CENTRAL_DISPATCH".takeIf { target.supportsGrandCentralDispatch },
).map { "KONAN_$it=1" }
val otherOptions = listOfNotNull(
@@ -71,8 +68,7 @@ sealed class ClangArgs(
// so just undefine it.
"NS_FORMAT_ARGUMENT(A)=".takeIf { target.family.isAppleFamily },
)
val customOptions = target.customArgsForKonanSources()
return (konanOptions + otherOptions + customOptions).map { "-D$it" }
return (konanOptions + otherOptions).map { "-D$it" }
}
private val binDir = when (HostManager.host) {
@@ -177,26 +177,3 @@ val KonanTarget.supportsGrandCentralDispatch
Family.WATCHOS, Family.IOS, Family.TVOS, Family.OSX -> true
else -> false
}
// TODO: this is bad function. It should be replaced by capabilities functions like above
// but two affected targets are too strange, so we postpone it
fun KonanTarget.customArgsForKonanSources() = when (this) {
KonanTarget.WASM32 -> listOf(
"KONAN_NO_FFI=1",
"KONAN_INTERNAL_DLMALLOC=1",
"KONAN_INTERNAL_SNPRINTF=1",
"KONAN_INTERNAL_NOW=1",
"KONAN_NO_CTORS_SECTION=1",
"KONAN_NO_BACKTRACE=1",
"KONAN_NO_EXTERNAL_CALLS_CHECKER=1",
)
is KonanTarget.ZEPHYR -> listOf(
"KONAN_NO_FFI=1",
"KONAN_NO_MATH=1",
"KONAN_INTERNAL_SNPRINTF=1",
"KONAN_INTERNAL_NOW=1",
"KONAN_NO_CTORS_SECTION=1",
"KONAN_NO_BACKTRACE=1"
)
else -> emptyList()
}