Skip to content

Commit 1ee4924

Browse files
committed
Concurrency: Suppress -Wcast-function-type-mismatch warnings.
1 parent 806c600 commit 1ee4924

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

stdlib/public/Concurrency/Task.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -583,8 +583,11 @@ SWIFT_CC(swiftasync)
583583
static void task_wait_throwing_resume_adapter(SWIFT_ASYNC_CONTEXT AsyncContext *_context) {
584584

585585
auto context = static_cast<TaskFutureWaitAsyncContext *>(_context);
586+
#pragma clang diagnostic push
587+
#pragma clang diagnostic ignored "-Wcast-function-type-mismatch"
586588
auto resumeWithError =
587589
reinterpret_cast<AsyncVoidClosureEntryPoint *>(context->ResumeParent);
590+
#pragma clang diagnostic pop
588591
return resumeWithError(context->Parent, context->errorResult);
589592
}
590593

@@ -959,17 +962,23 @@ swift_task_create_commonImpl(size_t rawTaskCreateFlags,
959962
auto asyncContextPrefix = reinterpret_cast<AsyncContextPrefix *>(
960963
reinterpret_cast<char *>(allocation) + headerSize -
961964
sizeof(AsyncContextPrefix));
965+
#pragma clang diagnostic push
966+
#pragma clang diagnostic ignored "-Wcast-function-type-mismatch"
962967
asyncContextPrefix->asyncEntryPoint =
963968
reinterpret_cast<AsyncVoidClosureEntryPoint *>(function);
969+
#pragma clang diagnostic pop
964970
asyncContextPrefix->closureContext = closureContext;
965971
function = non_future_adapter;
966972
assert(sizeof(AsyncContextPrefix) == 3 * sizeof(void *));
967973
} else {
968974
auto asyncContextPrefix = reinterpret_cast<FutureAsyncContextPrefix *>(
969975
reinterpret_cast<char *>(allocation) + headerSize -
970976
sizeof(FutureAsyncContextPrefix));
977+
#pragma clang diagnostic push
978+
#pragma clang diagnostic ignored "-Wcast-function-type-mismatch"
971979
asyncContextPrefix->asyncEntryPoint =
972980
reinterpret_cast<AsyncGenericClosureEntryPoint *>(function);
981+
#pragma clang diagnostic pop
973982
function = future_adapter;
974983
asyncContextPrefix->closureContext = closureContext;
975984
assert(sizeof(FutureAsyncContextPrefix) == 4 * sizeof(void *));
@@ -1035,13 +1044,16 @@ swift_task_create_commonImpl(size_t rawTaskCreateFlags,
10351044
" with parent %p at base pri %zu",
10361045
task, task->getTaskId(), parent, basePriority);
10371046

1047+
#pragma clang diagnostic push
1048+
#pragma clang diagnostic ignored "-Wcast-function-type-mismatch"
10381049
// Initialize the task-local allocator.
10391050
initialContext->ResumeParent =
10401051
runInlineOption ? &completeInlineTask
10411052
: reinterpret_cast<TaskContinuationFunction *>(
10421053
asyncLet ? &completeTask
10431054
: closureContext ? &completeTaskWithClosure
10441055
: &completeTaskAndRelease);
1056+
#pragma clang diagnostic pop
10451057
if ((asyncLet || (runInlineOption && runInlineOption->getAllocation())) &&
10461058
initialSlabSize > 0) {
10471059
assert(parent || (runInlineOption && runInlineOption->getAllocation()));
@@ -1260,10 +1272,13 @@ AsyncTaskAndContext swift::swift_task_create(
12601272
FutureAsyncSignature,
12611273
SpecialPointerAuthDiscriminators::AsyncFutureFunction>(closureEntry);
12621274

1275+
#pragma clang diagnostic push
1276+
#pragma clang diagnostic ignored "-Wcast-function-type-mismatch"
12631277
return swift_task_create_common(
12641278
rawTaskCreateFlags, options, futureResultType,
12651279
reinterpret_cast<TaskContinuationFunction *>(taskEntry), closureContext,
12661280
initialContextSize);
1281+
#pragma clang diagnostic pop
12671282
}
12681283
}
12691284

@@ -1348,7 +1363,10 @@ void swift_task_future_wait_throwingImpl(
13481363
waitingTask->ResumeTask = task_wait_throwing_resume_adapter;
13491364
waitingTask->ResumeContext = callContext;
13501365

1366+
#pragma clang diagnostic push
1367+
#pragma clang diagnostic ignored "-Wcast-function-type-mismatch"
13511368
auto resumeFn = reinterpret_cast<TaskContinuationFunction *>(resumeFunction);
1369+
#pragma clang diagnostic pop
13521370

13531371
// Wait on the future.
13541372
assert(task->isFuture());

0 commit comments

Comments
 (0)