Fixes of mimalloc warnings (#3765)
This commit is contained in:
+2
-2
@@ -70,7 +70,7 @@ open class CommonInteropArguments(val argParser: ArgParser) {
|
||||
|
||||
class CInteropArguments(argParser: ArgParser =
|
||||
ArgParser("cinterop",
|
||||
prefixStyle = ArgParser.OPTION_PREFIX_STYLE.JVM)): CommonInteropArguments(argParser) {
|
||||
prefixStyle = ArgParser.OptionPrefixStyle.JVM)): CommonInteropArguments(argParser) {
|
||||
val target by argParser.option(ArgType.String, description = "native target to compile to").default("host")
|
||||
val def by argParser.option(ArgType.String, description = "the library definition file")
|
||||
val header by argParser.option(ArgType.String, description = "header file to produce kotlin bindings for")
|
||||
@@ -99,7 +99,7 @@ class CInteropArguments(argParser: ArgParser =
|
||||
}
|
||||
|
||||
class JSInteropArguments(argParser: ArgParser = ArgParser("jsinterop",
|
||||
prefixStyle = ArgParser.OPTION_PREFIX_STYLE.JVM)): CommonInteropArguments(argParser) {
|
||||
prefixStyle = ArgParser.OptionPrefixStyle.JVM)): CommonInteropArguments(argParser) {
|
||||
val target by argParser.option(ArgType.Choice(listOf("wasm32")),
|
||||
description = "wasm target to compile to").default("wasm32")
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ open class CompileToBitcode @Inject constructor(@InputDirectory val srcRoot: Fil
|
||||
Language.C -> Triple("clang",
|
||||
// Used flags provided by original build of allocator C code.
|
||||
commonFlags + listOf("-std=gnu11", "-O3", "-Wall", "-Wextra", "-Wno-unknown-pragmas",
|
||||
"-ftls-model=initial-exec"),
|
||||
"-Werror", "-ftls-model=initial-exec", "-Wno-unused-function"),
|
||||
listOf("**/*.c"))
|
||||
Language.CPP -> Triple("clang++",
|
||||
commonFlags + listOfNotNull("-std=c++14", "-Werror", "-O2",
|
||||
|
||||
@@ -163,12 +163,23 @@ bool _mi_page_is_valid(mi_page_t* page);
|
||||
static inline bool mi_mul_overflow(size_t count, size_t size, size_t* total) {
|
||||
#if __has_builtin(__builtin_umul_overflow) || __GNUC__ >= 5
|
||||
#include <limits.h> // UINT_MAX, ULONG_MAX
|
||||
#if (SIZE_MAX == UINT_MAX)
|
||||
return __builtin_umul_overflow(count, size, total);
|
||||
#elif (SIZE_MAX == ULONG_MAX)
|
||||
return __builtin_umull_overflow(count, size, total);
|
||||
// Changed order for armv7 (ULONG_MAX == UINT_MAX, but size_t = unsigned long)
|
||||
#if defined(__MACH__) && KONAN_MI_MALLOC
|
||||
#if (SIZE_MAX == ULONG_MAX)
|
||||
return __builtin_umull_overflow(count, size, total);
|
||||
#elif (SIZE_MAX == UINT_MAX)
|
||||
return __builtin_umul_overflow(count, size, total);
|
||||
#else
|
||||
return __builtin_umulll_overflow(count, size, total);
|
||||
#endif
|
||||
#else
|
||||
return __builtin_umulll_overflow(count, size, total);
|
||||
#if (SIZE_MAX == UINT_MAX)
|
||||
return __builtin_umul_overflow(count, size, total);
|
||||
#elif (SIZE_MAX == ULONG_MAX)
|
||||
return __builtin_umull_overflow(count, size, total);
|
||||
#else
|
||||
return __builtin_umulll_overflow(count, size, total);
|
||||
#endif
|
||||
#endif
|
||||
#else /* __builtin_umul_overflow is unavailable */
|
||||
*total = count * size;
|
||||
@@ -471,7 +482,7 @@ static inline uintptr_t _mi_thread_id(void) mi_attr_noexcept {
|
||||
#if KONAN_MI_MALLOC
|
||||
#include <TargetConditionals.h>
|
||||
#if TARGET_OS_EMBEDDED // iOS/tvOS/watchOS devices.
|
||||
tid = pthread_self();
|
||||
tid = pthread_mach_thread_np(pthread_self());
|
||||
#else
|
||||
__asm__("movq %%gs:0, %0" : "=r" (tid) : : ); // x86_64 macOS uses GS
|
||||
#endif
|
||||
|
||||
+1
-1
@@ -11,7 +11,7 @@ import java.util.concurrent.*
|
||||
import kotlinx.cli.*
|
||||
|
||||
fun generatePlatformLibraries(args: Array<String>) {
|
||||
val argParser = ArgParser("generate-platform", prefixStyle = ArgParser.OPTION_PREFIX_STYLE.JVM)
|
||||
val argParser = ArgParser("generate-platform", prefixStyle = ArgParser.OptionPrefixStyle.JVM)
|
||||
val inputDirectoryPath by argParser.option(
|
||||
ArgType.String, "input-directory", "i", "Input directory").required()
|
||||
val outputDirectoryPath by argParser.option(
|
||||
|
||||
Reference in New Issue
Block a user