[K/N] Add workaround for NS_FORMAT_ARGUMENT(A)

See KT-48807 for explanation
This commit is contained in:
Sergey Bogolepov
2022-08-25 12:10:30 +03:00
parent 5c1641430c
commit 5f847ac40d
2 changed files with 4 additions and 5 deletions
@@ -9,11 +9,7 @@
#include <functional>
// 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 <UIKit/UIApplication.h>
#undef NS_FORMAT_ARGUMENT
#include "CompilerConstants.hpp"
#include "objc_support/NSNotificationSubscription.hpp"
@@ -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" }