[Native] Fix runtime code according to Clang 11 warnings

This commit is contained in:
Sergey Bogolepov
2021-06-10 16:00:11 +07:00
committed by Space
parent 91387e644f
commit 7550351702
7 changed files with 14 additions and 14 deletions
@@ -3331,10 +3331,10 @@ void ClearMemoryForTests(MemoryState*) {
// Nothing to do, DeinitMemory will do the job. // Nothing to do, DeinitMemory will do the job.
} }
OBJ_GETTER(AllocInstanceStrict, const TypeInfo* type_info) { RUNTIME_NOTHROW OBJ_GETTER(AllocInstanceStrict, const TypeInfo* type_info) {
RETURN_RESULT_OF(allocInstance<true>, type_info); RETURN_RESULT_OF(allocInstance<true>, type_info);
} }
OBJ_GETTER(AllocInstanceRelaxed, const TypeInfo* type_info) { RUNTIME_NOTHROW OBJ_GETTER(AllocInstanceRelaxed, const TypeInfo* type_info) {
RETURN_RESULT_OF(allocInstance<false>, type_info); RETURN_RESULT_OF(allocInstance<false>, type_info);
} }
@@ -3429,7 +3429,7 @@ RUNTIME_NOTHROW void UpdateHeapRefIfNull(ObjHeader** location, const ObjHeader*
updateHeapRefIfNull(location, object); updateHeapRefIfNull(location, object);
} }
OBJ_GETTER(SwapHeapRefLocked, RUNTIME_NOTHROW OBJ_GETTER(SwapHeapRefLocked,
ObjHeader** location, ObjHeader* expectedValue, ObjHeader* newValue, int32_t* spinlock, int32_t* cookie) { ObjHeader** location, ObjHeader* expectedValue, ObjHeader* newValue, int32_t* spinlock, int32_t* cookie) {
RETURN_RESULT_OF(swapHeapRefLocked, location, expectedValue, newValue, spinlock, cookie); RETURN_RESULT_OF(swapHeapRefLocked, location, expectedValue, newValue, spinlock, cookie);
} }
@@ -3438,7 +3438,7 @@ RUNTIME_NOTHROW void SetHeapRefLocked(ObjHeader** location, ObjHeader* newValue,
setHeapRefLocked(location, newValue, spinlock, cookie); setHeapRefLocked(location, newValue, spinlock, cookie);
} }
OBJ_GETTER(ReadHeapRefLocked, ObjHeader** location, int32_t* spinlock, int32_t* cookie) { RUNTIME_NOTHROW OBJ_GETTER(ReadHeapRefLocked, ObjHeader** location, int32_t* spinlock, int32_t* cookie) {
RETURN_RESULT_OF(readHeapRefLocked, location, spinlock, cookie); RETURN_RESULT_OF(readHeapRefLocked, location, spinlock, cookie);
} }
@@ -3584,11 +3584,11 @@ RUNTIME_NOTHROW void DisposeStablePointerFor(MemoryState* memoryState, KNativePt
DisposeStablePointer(pointer); DisposeStablePointer(pointer);
} }
OBJ_GETTER(DerefStablePointer, KNativePtr pointer) { RUNTIME_NOTHROW OBJ_GETTER(DerefStablePointer, KNativePtr pointer) {
RETURN_RESULT_OF(derefStablePointer, pointer); RETURN_RESULT_OF(derefStablePointer, pointer);
} }
OBJ_GETTER(AdoptStablePointer, KNativePtr pointer) { RUNTIME_NOTHROW OBJ_GETTER(AdoptStablePointer, KNativePtr pointer) {
RETURN_RESULT_OF(adoptStablePointer, pointer); RETURN_RESULT_OF(adoptStablePointer, pointer);
} }
@@ -114,7 +114,7 @@ extern "C" id Kotlin_ObjCExport_GetAssociatedObject(ObjHeader* obj) {
extern "C" OBJ_GETTER(Kotlin_ObjCExport_AllocInstanceWithAssociatedObject, extern "C" OBJ_GETTER(Kotlin_ObjCExport_AllocInstanceWithAssociatedObject,
const TypeInfo* typeInfo, id associatedObject) RUNTIME_NOTHROW; const TypeInfo* typeInfo, id associatedObject) RUNTIME_NOTHROW;
extern "C" OBJ_GETTER(Kotlin_ObjCExport_AllocInstanceWithAssociatedObject, RUNTIME_NOTHROW extern "C" OBJ_GETTER(Kotlin_ObjCExport_AllocInstanceWithAssociatedObject,
const TypeInfo* typeInfo, id associatedObject) { const TypeInfo* typeInfo, id associatedObject) {
RETURN_RESULT_OF(AllocInstanceWithAssociatedObject, typeInfo, associatedObject); RETURN_RESULT_OF(AllocInstanceWithAssociatedObject, typeInfo, associatedObject);
} }
@@ -59,7 +59,7 @@ void consoleInit() {
#endif #endif
} }
void consoleWriteUtf8(const void* utf8, uint32_t sizeBytes) { void consoleWriteUtf8(const char* utf8, uint32_t sizeBytes) {
#ifdef KONAN_ANDROID #ifdef KONAN_ANDROID
// TODO: use sizeBytes! // TODO: use sizeBytes!
__android_log_print(ANDROID_LOG_INFO, "Konan_main", "%s", utf8); __android_log_print(ANDROID_LOG_INFO, "Konan_main", "%s", utf8);
@@ -68,7 +68,7 @@ void consoleWriteUtf8(const void* utf8, uint32_t sizeBytes) {
#endif #endif
} }
void consoleErrorUtf8(const void* utf8, uint32_t sizeBytes) { void consoleErrorUtf8(const char* utf8, uint32_t sizeBytes) {
#ifdef KONAN_ANDROID #ifdef KONAN_ANDROID
// TODO: use sizeBytes! // TODO: use sizeBytes!
__android_log_print(ANDROID_LOG_ERROR, "Konan_main", "%s", utf8); __android_log_print(ANDROID_LOG_ERROR, "Konan_main", "%s", utf8);
+2 -2
View File
@@ -29,8 +29,8 @@ namespace konan {
void consoleInit(); void consoleInit();
void consolePrintf(const char* format, ...) __attribute__((format(printf, 1, 2))); void consolePrintf(const char* format, ...) __attribute__((format(printf, 1, 2)));
void consoleErrorf(const char* format, ...) __attribute__((format(printf, 1, 2))); void consoleErrorf(const char* format, ...) __attribute__((format(printf, 1, 2)));
void consoleWriteUtf8(const void* utf8, uint32_t sizeBytes); void consoleWriteUtf8(const char* utf8, uint32_t sizeBytes);
void consoleErrorUtf8(const void* utf8, uint32_t sizeBytes); void consoleErrorUtf8(const char* utf8, uint32_t sizeBytes);
// Negative return value denotes that read wasn't successful. // Negative return value denotes that read wasn't successful.
int32_t consoleReadUtf8(void* utf8, uint32_t maxSizeBytes); int32_t consoleReadUtf8(void* utf8, uint32_t maxSizeBytes);
void consoleFlush(); void consoleFlush();
@@ -1450,7 +1450,7 @@ cast(LDOUBLE value)
* comparison (cf. C99: 6.3.1.4, 2). It might then equal the LDOUBLE * comparison (cf. C99: 6.3.1.4, 2). It might then equal the LDOUBLE
* value although converting the latter to UINTMAX_T would overflow. * value although converting the latter to UINTMAX_T would overflow.
*/ */
if (value >= UINTMAX_MAX) if (value >= static_cast<LDOUBLE>(UINTMAX_MAX))
return UINTMAX_MAX; return UINTMAX_MAX;
result = value; result = value;
@@ -11,7 +11,7 @@ extern "C" {
const MemoryModel CurrentMemoryModel = MemoryModel::kRelaxed; const MemoryModel CurrentMemoryModel = MemoryModel::kRelaxed;
OBJ_GETTER(AllocInstance, const TypeInfo* typeInfo) { RUNTIME_NOTHROW OBJ_GETTER(AllocInstance, const TypeInfo* typeInfo) {
RETURN_RESULT_OF(AllocInstanceRelaxed, typeInfo); RETURN_RESULT_OF(AllocInstanceRelaxed, typeInfo);
} }
@@ -11,7 +11,7 @@ extern "C" {
const MemoryModel CurrentMemoryModel = MemoryModel::kStrict; const MemoryModel CurrentMemoryModel = MemoryModel::kStrict;
OBJ_GETTER(AllocInstance, const TypeInfo* typeInfo) { RUNTIME_NOTHROW OBJ_GETTER(AllocInstance, const TypeInfo* typeInfo) {
RETURN_RESULT_OF(AllocInstanceStrict, typeInfo); RETURN_RESULT_OF(AllocInstanceStrict, typeInfo);
} }