Enable unused-function warning for runtime (#4628)

This commit is contained in:
Alexander Shabalin
2021-01-11 20:45:02 +03:00
committed by Nikolay Krasko
parent 8bb76c67e3
commit 32e3deace1
6 changed files with 12 additions and 35 deletions
@@ -798,7 +798,6 @@ namespace {
void freeContainer(ContainerHeader* header) NO_INLINE;
#if USE_GC
void garbageCollect(MemoryState* state, bool force) NO_INLINE;
void cyclicGarbageCollect() NO_INLINE;
void rememberNewContainer(ContainerHeader* container);
#endif // USE_GC
@@ -1017,10 +1016,6 @@ inline FrameOverlay* asFrameOverlay(ObjHeader** slot) {
return reinterpret_cast<FrameOverlay*>(slot);
}
inline bool isRefCounted(KConstRef object) {
return isFreeable(containerFor(object));
}
inline void lock(KInt* spinlock) {
while (compareAndSwap(spinlock, 0, 1) != 0) {}
}
@@ -1698,6 +1693,7 @@ void collectWhite(MemoryState* state, ContainerHeader* start) {
}
#endif
#if COLLECT_STATISTIC
inline bool needAtomicAccess(ContainerHeader* container) {
return container->shareable();
}
@@ -1707,6 +1703,7 @@ inline bool canBeCyclic(ContainerHeader* container) {
if (container->color() == CONTAINER_TAG_GC_GREEN) return false;
return true;
}
#endif
inline void addHeapRef(ContainerHeader* container) {
MEMORY_LOG("AddHeapRef %p: rc=%d\n", container, container->refCount())
@@ -1774,6 +1771,11 @@ inline void releaseHeapRef(const ObjHeader* header) {
releaseHeapRef<Strict, CanCollect>(const_cast<ContainerHeader*>(container));
}
// TODO: Consider removing this unused stuff.
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-function"
// We use first slot as place to store frame-local arena container.
// TODO: create ArenaContainer object on the stack, so that we don't
// do two allocations per frame (ArenaContainer + actual container).
@@ -1800,6 +1802,8 @@ inline size_t containerSize(const ContainerHeader* container) {
return result;
}
#pragma clang diagnostic pop
#if USE_GC
void incrementStack(MemoryState* state) {
FrameOverlay* frame = currentFrame;
@@ -107,11 +107,13 @@ _Unwind_Reason_Code unwindCallback(
THREAD_LOCAL_VARIABLE bool disallowSourceInfo = false;
#if !OMIT_BACKTRACE && !USE_GCC_UNWIND
SourceInfo getSourceInfo(KConstRef stackTrace, int index) {
return disallowSourceInfo
? SourceInfo { .fileName = nullptr, .lineNumber = -1, .column = -1 }
: Kotlin_getSourceInfo(*PrimitiveArrayAddressOfElementAt<KNativePtr>(stackTrace->array(), index));
}
#endif
} // namespace
@@ -124,7 +124,6 @@ extern "C" OBJ_GETTER(Kotlin_ObjCExport_AllocInstanceWithAssociatedObject,
}
static Class getOrCreateClass(const TypeInfo* typeInfo);
static void initializeClass(Class clazz);
extern "C" id objc_retainAutoreleaseReturnValue(id self);
@@ -768,16 +767,6 @@ static KStdVector<const TypeInfo*> getProtocolsAsInterfaces(Class clazz) {
return result;
}
static const TypeInfo* getMostSpecificKotlinClass(const TypeInfo* typeInfo) {
const TypeInfo* result = typeInfo;
while (getTypeAdapter(result) == nullptr) {
result = result->superType_;
RuntimeAssert(result != nullptr, "");
}
return result;
}
static int getVtableSize(const TypeInfo* typeInfo) {
for (const TypeInfo* current = typeInfo; current != nullptr; current = current->superType_) {
auto typeAdapter = getTypeAdapter(current);