From 5f847ac40d6b4445a5917da1b68346e563efdd83 Mon Sep 17 00:00:00 2001 From: Sergey Bogolepov Date: Thu, 25 Aug 2022 12:10:30 +0300 Subject: [PATCH] [K/N] Add workaround for NS_FORMAT_ARGUMENT(A) See KT-48807 for explanation --- kotlin-native/runtime/src/mm/cpp/AppStateTrackingUIKit.mm | 4 ---- .../kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt | 5 ++++- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/kotlin-native/runtime/src/mm/cpp/AppStateTrackingUIKit.mm b/kotlin-native/runtime/src/mm/cpp/AppStateTrackingUIKit.mm index 9be4200f3f4..e2e1bf04da0 100644 --- a/kotlin-native/runtime/src/mm/cpp/AppStateTrackingUIKit.mm +++ b/kotlin-native/runtime/src/mm/cpp/AppStateTrackingUIKit.mm @@ -9,11 +9,7 @@ #include -// Workaround from https://youtrack.jetbrains.com/issue/KT-48807#focus=Comments-27-5210791.0-0 -// TODO: remove this once our clang supports NSAttributedString as a valid return from the formatter function. -#define NS_FORMAT_ARGUMENT(x) #import -#undef NS_FORMAT_ARGUMENT #include "CompilerConstants.hpp" #include "objc_support/NSNotificationSubscription.hpp" diff --git a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt index 0148d8ca317..02fa8b699f0 100644 --- a/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt +++ b/kotlin-native/shared/src/main/kotlin/org/jetbrains/kotlin/konan/target/ClangArgs.kt @@ -65,7 +65,10 @@ sealed class ClangArgs( "USE_PE_COFF_SYMBOLS=1".takeIf { target.binaryFormat() == BinaryFormat.PE_COFF }, "UNICODE".takeIf { target.family == Family.MINGW }, "USE_WINAPI_UNWIND=1".takeIf { target.supportsWinAPIUnwind() }, - "USE_GCC_UNWIND=1".takeIf { target.supportsGccUnwind() } + "USE_GCC_UNWIND=1".takeIf { target.supportsGccUnwind() }, + // Clang 11 does not support this attribute. We don't need to handle it properly, + // so just undefine it. + "NS_FORMAT_ARGUMENT(A)=".takeIf { target.family.isAppleFamily }, ) val customOptions = target.customArgsForKonanSources() return (konanOptions + otherOptions + customOptions).map { "-D$it" }