Fix warnings (#690)
This commit is contained in:
@@ -131,7 +131,7 @@ inline ObjHeader** asArenaSlot(ObjHeader** slot) {
|
||||
|
||||
inline uint32_t hashOf(ContainerHeader* container) {
|
||||
uintptr_t value = reinterpret_cast<uintptr_t>(container);
|
||||
return static_cast<uint32_t>(value >> 3) ^ static_cast<uint32_t>(value >> 32);
|
||||
return static_cast<uint32_t>(value >> 3) ^ static_cast<uint32_t>(static_cast<uint64_t>(value) >> 32);
|
||||
}
|
||||
|
||||
inline uint32_t freeableSize(MemoryState* state) {
|
||||
|
||||
@@ -9,7 +9,8 @@ internal fun <T> getContinuation(): Continuation<T> = throw AssertionError("Call
|
||||
|
||||
@Intrinsic
|
||||
@PublishedApi
|
||||
internal suspend fun <T> returnIfSuspended(value: Any?): T = throw AssertionError("Call to returnIfSuspended should've been lowered")
|
||||
internal suspend fun <T> returnIfSuspended(@Suppress("UNUSED_PARAMETER") argument: Any?): T
|
||||
= throw AssertionError("Call to returnIfSuspended should've been lowered")
|
||||
|
||||
// Single-threaded continuation.
|
||||
class SafeContinuation<in T>
|
||||
|
||||
@@ -89,21 +89,18 @@ object FloatingPointParser {
|
||||
* taking the positive integer the String represents and multiplying by 10
|
||||
* raised to the power of the exponent.
|
||||
|
||||
* @param s
|
||||
* @param string
|
||||
* * the String that will be parsed to a floating point
|
||||
* *
|
||||
* @param length
|
||||
* * the length of s
|
||||
* *
|
||||
* @return a StringExponentPair with necessary values
|
||||
* *
|
||||
* *
|
||||
* @exception NumberFormatException
|
||||
* * if the String doesn't pass basic tests
|
||||
*/
|
||||
private fun initialParse(s: String, length: Int): StringExponentPair {
|
||||
var s = s
|
||||
var length = length
|
||||
private fun initialParse(string: String): StringExponentPair {
|
||||
var s = string
|
||||
var length = s.length
|
||||
var negative = false
|
||||
var c: Char
|
||||
var start: Int
|
||||
@@ -310,7 +307,7 @@ object FloatingPointParser {
|
||||
/**
|
||||
* Returns the closest double value to the real number in the string.
|
||||
|
||||
* @param s
|
||||
* @param string
|
||||
* * the String that will be parsed to a floating point
|
||||
* *
|
||||
* @return the double closest to the real number
|
||||
@@ -319,8 +316,8 @@ object FloatingPointParser {
|
||||
* @exception NumberFormatException
|
||||
* * if the String doesn't represent a double
|
||||
*/
|
||||
fun parseDouble(s: String): Double {
|
||||
var s = s
|
||||
fun parseDouble(string: String): Double {
|
||||
var s = string
|
||||
s = s.trim { it <= ' ' }
|
||||
val length = s.length
|
||||
|
||||
@@ -339,7 +336,7 @@ object FloatingPointParser {
|
||||
return HexStringParser.parseDouble(s)
|
||||
}
|
||||
|
||||
val info = initialParse(s, length)
|
||||
val info = initialParse(s)
|
||||
|
||||
// Two kinds of situation will directly return 0.0:
|
||||
// 1. info.s is 0;
|
||||
@@ -371,8 +368,8 @@ object FloatingPointParser {
|
||||
* @exception NumberFormatException
|
||||
* * if the String doesn't represent a float
|
||||
*/
|
||||
fun parseFloat(s: String): Float {
|
||||
var s = s
|
||||
fun parseFloat(string: String): Float {
|
||||
var s = string
|
||||
s = s.trim { it <= ' ' }
|
||||
val length = s.length
|
||||
|
||||
@@ -391,7 +388,7 @@ object FloatingPointParser {
|
||||
return HexStringParser.parseFloat(s)
|
||||
}
|
||||
|
||||
val info = initialParse(s, length)
|
||||
val info = initialParse(s)
|
||||
|
||||
// Two kinds of situation will directly return 0.0f.
|
||||
// 1. info.s is 0;
|
||||
|
||||
@@ -78,8 +78,8 @@ internal class HexStringParser(private val EXPONENT_WIDTH: Int, private val MANT
|
||||
/*
|
||||
* Parses the exponent field.
|
||||
*/
|
||||
private fun parseExponent(exponentStr: String) {
|
||||
var exponentStr = exponentStr
|
||||
private fun parseExponent(exponentString: String) {
|
||||
var exponentStr = exponentString
|
||||
val leadingChar = exponentStr[0]
|
||||
val expSign = if (leadingChar == '-') -1 else 1
|
||||
if (!leadingChar.isDigit()) {
|
||||
@@ -247,8 +247,8 @@ internal class HexStringParser(private val EXPONENT_WIDTH: Int, private val MANT
|
||||
* characters "0x1." followed by a lowercase hexadecimal representation of
|
||||
* the rest of the significand as a fraction.
|
||||
*/
|
||||
private fun getOffset(strIntegerPart: String, strDecimalPart: String): Int {
|
||||
var strIntegerPart = strIntegerPart
|
||||
private fun getOffset(strIntegerPartParam: String, strDecimalPart: String): Int {
|
||||
var strIntegerPart = strIntegerPartParam
|
||||
strIntegerPart = strIntegerPart.replaceFirst("^0+".toRegex(), "") //$NON-NLS-1$ //$NON-NLS-2$
|
||||
|
||||
// If the Integer part is a nonzero number.
|
||||
|
||||
@@ -50,11 +50,11 @@ open class KProperty0Impl<out R>(override val name: String, val getter: () -> R)
|
||||
|
||||
@FixmeReflection
|
||||
open class KProperty1Impl<T, out R>(override val name: String, val getter: (T) -> R): KProperty1<T, R> {
|
||||
override fun get(receiver: T): R {
|
||||
return getter(receiver)
|
||||
override fun get(p1: T): R {
|
||||
return getter(p1)
|
||||
}
|
||||
override fun invoke(receiver: T): R {
|
||||
return getter(receiver)
|
||||
override fun invoke(p1: T): R {
|
||||
return getter(p1)
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
@@ -74,11 +74,11 @@ open class KProperty1Impl<T, out R>(override val name: String, val getter: (T) -
|
||||
|
||||
@FixmeReflection
|
||||
open class KProperty2Impl<T1, T2, out R>(override val name: String, val getter: (T1, T2) -> R): KProperty2<T1, T2, R> {
|
||||
override fun get(receiver1: T1, receiver2: T2): R {
|
||||
return getter(receiver1, receiver2)
|
||||
override fun get(p1: T1, p2: T2): R {
|
||||
return getter(p1, p2)
|
||||
}
|
||||
override fun invoke(receiver1: T1, receiver2: T2): R {
|
||||
return getter(receiver1, receiver2)
|
||||
override fun invoke(p1: T1, p2: T2): R {
|
||||
return getter(p1, p2)
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
|
||||
@@ -50,7 +50,7 @@ class NumberConverter {
|
||||
// The value of the 'significand bits' of the inputNumber.
|
||||
var f = inputNumberBits and fMask
|
||||
val mantissaIsZero = f == 0L
|
||||
var pow = 0
|
||||
var pow: Int
|
||||
var numBits = 52
|
||||
|
||||
if (e == 2047)
|
||||
@@ -100,7 +100,7 @@ class NumberConverter {
|
||||
// The value of the 'significand bits' of the inputNumber.
|
||||
var f = inputNumberBits and fMask
|
||||
val mantissaIsZero = f == 0
|
||||
var pow = 0
|
||||
var pow: Int
|
||||
var numBits = 23
|
||||
|
||||
if (e == 255)
|
||||
|
||||
@@ -92,7 +92,7 @@ class Future<T> internal constructor(val id: FutureId) {
|
||||
fun consume(code: (T) -> Unit) {
|
||||
when (state) {
|
||||
FutureState.SCHEDULED, FutureState.COMPUTED -> {
|
||||
val value = consumeFuture(id) as T
|
||||
val value = @Suppress("UNCHECKED_CAST") (consumeFuture(id) as T)
|
||||
code(value)
|
||||
}
|
||||
FutureState.INVALID ->
|
||||
@@ -103,7 +103,7 @@ class Future<T> internal constructor(val id: FutureId) {
|
||||
}
|
||||
|
||||
val state: FutureState
|
||||
get() = FutureState.values()[stateOfFuture(id)]
|
||||
get() = FutureState.values()[stateOfFuture(id)]
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
return (other is Future<*>) && (id == other.id)
|
||||
@@ -136,8 +136,8 @@ class Worker(val id: WorkerId) {
|
||||
* and result of such a execution is being disconnected from worker's object graph. Whoever will consume
|
||||
* the future, can use result of worker's computations.
|
||||
*/
|
||||
fun <T1, T2> schedule(mode: TransferMode, producer: () -> T1,
|
||||
@VolatileLambda job: (T1) -> T2): Future<T2> =
|
||||
@Suppress("UNUSED_PARAMETER")
|
||||
fun <T1, T2> schedule(mode: TransferMode, producer: () -> T1, @VolatileLambda job: (T1) -> T2): Future<T2> =
|
||||
/**
|
||||
* This function is a magical operation, handled by lowering in the compiler, and replaced with call to
|
||||
* scheduleImpl(worker, mode, producer, job)
|
||||
@@ -159,13 +159,13 @@ class Worker(val id: WorkerId) {
|
||||
* Typically new worker may be needed for computations offload to another core, for IO it may be
|
||||
* better to use non-blocking IO combined with more lightweight coroutines.
|
||||
*/
|
||||
fun startWorker() : Worker = Worker(startInternal())
|
||||
fun startWorker(): Worker = Worker(startInternal())
|
||||
|
||||
/**
|
||||
* Wait for availability of futures in the collection. Returns set with all futures which have
|
||||
* value available for the consumption.
|
||||
*/
|
||||
fun <T> Collection<Future<T>>.waitForMultipleFutures(millis: Int) : Set<Future<T>> {
|
||||
fun <T> Collection<Future<T>>.waitForMultipleFutures(millis: Int): Set<Future<T>> {
|
||||
val result = mutableSetOf<Future<T>>()
|
||||
|
||||
while (true) {
|
||||
@@ -192,7 +192,7 @@ fun <T> Collection<Future<T>>.waitForMultipleFutures(millis: Int) : Set<Future<T
|
||||
/**
|
||||
* Creates verbatim *shallow* copy of passed object, use carefully to create disjoint object graph.
|
||||
*/
|
||||
fun <T> T.shallowCopy(): T = shallowCopyInternal(this) as T
|
||||
fun <T> T.shallowCopy(): T = @Suppress("UNCHECKED_CAST") (shallowCopyInternal(this) as T)
|
||||
|
||||
/**
|
||||
* Creates verbatim *deep* copy of passed object's graph, use *VERY* carefully to create disjoint object graph.
|
||||
@@ -203,21 +203,21 @@ fun <T> T.deepCopy(): T = TODO()
|
||||
// Implementation details.
|
||||
@konan.internal.ExportForCompiler
|
||||
internal fun scheduleImpl(worker: Worker, mode: TransferMode, producer: () -> Any?,
|
||||
job: CPointer<CFunction<*>>) : Future<Any?> =
|
||||
job: CPointer<CFunction<*>>): Future<Any?> =
|
||||
Future<Any?>(scheduleInternal(worker.id, mode.value, producer, job))
|
||||
|
||||
@SymbolName("Kotlin_Worker_startInternal")
|
||||
external internal fun startInternal() : WorkerId
|
||||
external internal fun startInternal(): WorkerId
|
||||
|
||||
@SymbolName("Kotlin_Worker_requestTerminationWorkerInternal")
|
||||
external internal fun requestTerminationInternal(id: WorkerId, processScheduledJobs: Boolean): FutureId
|
||||
|
||||
@SymbolName("Kotlin_Worker_scheduleInternal")
|
||||
external internal fun scheduleInternal(
|
||||
id: WorkerId, mode: Int, producer: () -> Any?, job: CPointer<CFunction<*>>) : FutureId
|
||||
id: WorkerId, mode: Int, producer: () -> Any?, job: CPointer<CFunction<*>>): FutureId
|
||||
|
||||
@SymbolName("Kotlin_Worker_shallowCopyInternal")
|
||||
external internal fun shallowCopyInternal(value: Any?) : Any?
|
||||
external internal fun shallowCopyInternal(value: Any?): Any?
|
||||
|
||||
@SymbolName("Kotlin_Worker_stateOfFuture")
|
||||
external internal fun stateOfFuture(id: FutureId): Int
|
||||
|
||||
@@ -95,7 +95,7 @@ internal inline fun processBareContinuationResume(completion: Continuation<*>, b
|
||||
try {
|
||||
val result = block()
|
||||
if (result !== COROUTINE_SUSPENDED) {
|
||||
(completion as Continuation<Any?>).resume(result)
|
||||
@Suppress("UNCHECKED_CAST") (completion as Continuation<Any?>).resume(result)
|
||||
}
|
||||
} catch (t: Throwable) {
|
||||
completion.resumeWithException(t)
|
||||
|
||||
@@ -63,7 +63,7 @@ public fun <T> (suspend () -> T).createCoroutineUnchecked(
|
||||
): Continuation<Unit> =
|
||||
if (this !is CoroutineImpl)
|
||||
buildContinuationByInvokeCall(completion) {
|
||||
(this as Function1<Continuation<T>, Any?>).invoke(completion)
|
||||
@Suppress("UNCHECKED_CAST") (this as Function1<Continuation<T>, Any?>).invoke(completion)
|
||||
}
|
||||
else
|
||||
(this.create(completion) as CoroutineImpl).facade
|
||||
@@ -84,7 +84,7 @@ public fun <R, T> (suspend R.() -> T).createCoroutineUnchecked(
|
||||
): Continuation<Unit> =
|
||||
if (this !is CoroutineImpl)
|
||||
buildContinuationByInvokeCall(completion) {
|
||||
(this as Function2<R, Continuation<T>, Any?>).invoke(receiver, completion)
|
||||
@Suppress("UNCHECKED_CAST") (this as Function2<R, Continuation<T>, Any?>).invoke(receiver, completion)
|
||||
}
|
||||
else
|
||||
(this.create(receiver, completion) as CoroutineImpl).facade
|
||||
|
||||
@@ -81,8 +81,8 @@ public interface KProperty0<out R> : kotlin.reflect.KProperty<R>, () -> R {
|
||||
public interface KProperty1<T, out R> : kotlin.reflect.KProperty<R>, (T) -> R {
|
||||
// public abstract val getter: kotlin.reflect.KProperty1.Getter<T, R>
|
||||
|
||||
public abstract fun get(receiver: T): R
|
||||
public override abstract operator fun invoke(receiver: T): R
|
||||
public abstract fun get(p1: T): R
|
||||
public override abstract operator fun invoke(p1: T): R
|
||||
|
||||
// @kotlin.SinceKotlin public abstract fun getDelegate(receiver: T): kotlin.Any?
|
||||
//
|
||||
@@ -94,8 +94,8 @@ public interface KProperty1<T, out R> : kotlin.reflect.KProperty<R>, (T) -> R {
|
||||
public interface KProperty2<T1, T2, out R> : kotlin.reflect.KProperty<R>, (T1, T2) -> R {
|
||||
// public abstract val getter: kotlin.reflect.KProperty1.Getter<T, R>
|
||||
|
||||
public abstract fun get(receiver1: T1, receiver2: T2): R
|
||||
public override abstract operator fun invoke(receiver1: T1, receiver2: T2): R
|
||||
public abstract fun get(p1: T1, p2: T2): R
|
||||
public override abstract operator fun invoke(p1: T1, p2: T2): R
|
||||
|
||||
// @kotlin.SinceKotlin public abstract fun getDelegate(receiver: T): kotlin.Any?
|
||||
//
|
||||
|
||||
@@ -1089,7 +1089,7 @@ private class DelimitedRangesSequence(private val input: CharSequence, private v
|
||||
private fun CharSequence.rangesDelimitedBy(delimiters: CharArray, startIndex: Int = 0, ignoreCase: Boolean = false, limit: Int = 0): Sequence<IntRange> {
|
||||
require(limit >= 0, { "Limit must be non-negative, but was $limit." })
|
||||
|
||||
return DelimitedRangesSequence(this, startIndex, limit, { startIndex -> findAnyOf(delimiters, startIndex, ignoreCase = ignoreCase, last = false)?.let { it.first to 1 } })
|
||||
return DelimitedRangesSequence(this, startIndex, limit, { index -> findAnyOf(delimiters, index, ignoreCase = ignoreCase, last = false)?.let { it.first to 1 } })
|
||||
}
|
||||
|
||||
|
||||
@@ -1111,7 +1111,7 @@ private fun CharSequence.rangesDelimitedBy(delimiters: Array<out String>, startI
|
||||
require(limit >= 0, { "Limit must be non-negative, but was $limit." } )
|
||||
val delimitersList = delimiters.asList()
|
||||
|
||||
return DelimitedRangesSequence(this, startIndex, limit, { startIndex -> findAnyOf(delimitersList, startIndex, ignoreCase = ignoreCase, last = false)?.let { it.first to it.second.length } })
|
||||
return DelimitedRangesSequence(this, startIndex, limit, { index -> findAnyOf(delimitersList, index, ignoreCase = ignoreCase, last = false)?.let { it.first to it.second.length } })
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -254,7 +254,7 @@ internal class Pattern(val pattern: String, flags: Int = 0) {
|
||||
curSymb = lexemes.currentChar
|
||||
curSymbIndex = curSymb - Lexer.TBase
|
||||
if (curSymbIndex >= 0 && curSymbIndex < Lexer.TCount) {
|
||||
codePointsHangul[readCodePoints++] = curSymb.toChar()
|
||||
codePointsHangul[@Suppress("UNUSED_CHANGED_VALUE")readCodePoints++] = curSymb.toChar()
|
||||
lexemes.next()
|
||||
|
||||
//LVT syllable
|
||||
|
||||
@@ -77,7 +77,7 @@ internal class HangulDecomposedCharSet(
|
||||
* http://www.unicode.org/versions/Unicode4.0.0/ch03.pdf
|
||||
* "3.12 Conjoining Jamo Behavior"
|
||||
*/
|
||||
var LIndex = -1
|
||||
var LIndex: Int
|
||||
var VIndex = -1
|
||||
var TIndex = -1
|
||||
|
||||
@@ -139,7 +139,7 @@ internal class HangulDecomposedCharSet(
|
||||
-1
|
||||
}
|
||||
index++
|
||||
decompSyllable[SyllIndex++] = curSymb.toInt()
|
||||
decompSyllable[@Suppress("UNUSED_CHANGED_VALUE")SyllIndex++] = curSymb.toInt()
|
||||
|
||||
/*
|
||||
* We deal with LVT syllable at testString, so
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
// TODO: androidLauncher.h will become part of the platform library.
|
||||
headers = stdio.h stdlib.h string.h math.h time.h android/log.h androidLauncher.h EGL/egl.h GLES/gl.h
|
||||
excludeDependentModules.osx = true
|
||||
|
||||
---
|
||||
|
||||
static int interop_errno() {
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* Copyright 2010-2017 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#ifndef ANDROID_LAUNCHER_H
|
||||
#define ANDROID_LAUNCHER_H
|
||||
|
||||
#include <unistd.h>
|
||||
|
||||
#include <android/configuration.h>
|
||||
#include <android/looper.h>
|
||||
#include <android/native_activity.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
struct NativeActivityState {
|
||||
struct ANativeActivity* activity;
|
||||
void* savedState;
|
||||
size_t savedStateSize;
|
||||
struct ALooper* looper;
|
||||
};
|
||||
|
||||
void getNativeActivityState(struct NativeActivityState* state);
|
||||
|
||||
void notifySysEventProcessed();
|
||||
|
||||
#define LOOPER_ID_SYS 1
|
||||
|
||||
typedef enum NativeActivityEventKind {
|
||||
UNKNOWN,
|
||||
DESTROY,
|
||||
START,
|
||||
RESUME,
|
||||
SAVE_INSTANCE_STATE,
|
||||
PAUSE,
|
||||
STOP,
|
||||
CONFIGURATION_CHANGED,
|
||||
LOW_MEMORY,
|
||||
WINDOW_GAINED_FOCUS,
|
||||
WINDOW_LOST_FOCUS,
|
||||
NATIVE_WINDOW_CREATED,
|
||||
NATIVE_WINDOW_DESTROYED,
|
||||
INPUT_QUEUE_CREATED,
|
||||
INPUT_QUEUE_DESTROYED
|
||||
} NativeActivityEventKind;
|
||||
|
||||
struct NativeActivityEvent {
|
||||
NativeActivityEventKind eventKind;
|
||||
};
|
||||
|
||||
struct NativeActivitySaveStateEvent {
|
||||
NativeActivityEventKind eventKind;
|
||||
void* savedState;
|
||||
size_t savedStateSize;
|
||||
};
|
||||
|
||||
struct NativeActivityWindowEvent {
|
||||
NativeActivityEventKind eventKind;
|
||||
struct ANativeWindow* window;
|
||||
};
|
||||
|
||||
struct NativeActivityQueueEvent {
|
||||
NativeActivityEventKind eventKind;
|
||||
struct AInputQueue* queue;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // ANDROID_LAUNCHER_H
|
||||
@@ -29,13 +29,15 @@ konanInterop {
|
||||
arm32 {
|
||||
defFile "android.def"
|
||||
pkg "android"
|
||||
includeDirs "../../runtime/src/launcher/cpp"
|
||||
// TODO: launcher header will be part of the platform library.
|
||||
includeDirs "."
|
||||
target "android_arm32"
|
||||
}
|
||||
arm64 {
|
||||
defFile "android.def"
|
||||
pkg "android"
|
||||
includeDirs "../../runtime/src/launcher/cpp"
|
||||
// TODO: launcher header will be part of the platform library.
|
||||
includeDirs "."
|
||||
target "android_arm64"
|
||||
}
|
||||
}
|
||||
@@ -125,4 +127,4 @@ task buildApk(type: DefaultTask) {
|
||||
dependsOn "compileKonanPolyhedronArm64"
|
||||
dependsOn "renameArtifacts"
|
||||
dependsOn "assembleDebug"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user