Skip to content

Commit 92a0867

Browse files
authored
Merge pull request #70948 from tshortli/resolve-concurrency-runtime-warnings
Resolve warnings in the Concurrency runtime
2 parents 10ea278 + 8343e7a commit 92a0867

File tree

3 files changed

+12
-5
lines changed

3 files changed

+12
-5
lines changed

stdlib/public/Concurrency/Executor.swift

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -401,11 +401,7 @@ where E: SerialExecutor {
401401
@_silgen_name("_swift_task_enqueueOnTaskExecutor")
402402
internal func _enqueueOnTaskExecutor<E>(job unownedJob: UnownedJob, executor: E) where E: _TaskExecutor {
403403
#if !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
404-
if #available(SwiftStdlib 9999, *) {
405-
executor.enqueue(ExecutorJob(context: unownedJob._context))
406-
} else {
407-
executor.enqueue(unownedJob)
408-
}
404+
executor.enqueue(ExecutorJob(context: unownedJob._context))
409405
#else // SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY
410406
executor.enqueue(unownedJob)
411407
#endif // !SWIFT_STDLIB_TASK_TO_THREAD_MODEL_CONCURRENCY

stdlib/public/Concurrency/GlobalExecutor.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,18 +135,24 @@ void swift::swift_task_enqueueGlobalWithDeadline(
135135
// Implemented in Swift because we need to obtain the user-defined flags on the executor ref.
136136
//
137137
// We could inline this with effort, though.
138+
#pragma clang diagnostic push
139+
#pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
138140
extern "C" SWIFT_CC(swift)
139141
SerialExecutorRef _task_serialExecutor_getExecutorRef(
140142
HeapObject *executor, const Metadata *selfType,
141143
const SerialExecutorWitnessTable *wtable);
144+
#pragma clang diagnostic pop
142145

143146
// Implemented in Swift because we need to obtain the user-defined flags on the executor ref.
144147
//
145148
// We could inline this with effort, though.
149+
#pragma clang diagnostic push
150+
#pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
146151
extern "C" SWIFT_CC(swift)
147152
TaskExecutorRef _task_executor_getTaskExecutorRef(
148153
HeapObject *executor, const Metadata *selfType,
149154
const SerialExecutorWitnessTable *wtable);
155+
#pragma clang diagnostic pop
150156

151157
SWIFT_CC(swift)
152158
static bool swift_task_isOnExecutorImpl(HeapObject *executor,

stdlib/public/Concurrency/TaskGroup.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,12 @@ void DiscardingTaskGroup::offer(AsyncTask *completedTask, AsyncContext *context)
13841384
_swift_taskGroup_detachChild(asAbstract(this), completedTask);
13851385
return unlock();
13861386
}
1387+
#pragma clang diagnostic push
1388+
#pragma clang diagnostic ignored "-Wunreachable-code"
1389+
// This _should_ be statically unreachable, but we leave it in as a
1390+
// safeguard in case the control flow above changes.
13871391
swift_unreachable("expected to early return from when handling offer of last task in group");
1392+
#pragma clang diagnostic pop
13881393
}
13891394

13901395
assert(!hadErrorResult && "only successfully completed tasks can reach here");

0 commit comments

Comments
 (0)