Skip to content

Commit 5a5f749

Browse files
authored
Merge pull request #79037 from compnerd/distributed-silence
Distributed: silence some `-Wcast-function-type-mismatch`
2 parents 2de333c + 35cbb21 commit 5a5f749

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

stdlib/public/Distributed/DistributedActor.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,12 @@
1414
///
1515
///===----------------------------------------------------------------------===///
1616

17-
#include "swift/ABI/Task.h"
1817
#include "swift/ABI/Actor.h"
1918
#include "swift/ABI/Metadata.h"
19+
#include "swift/ABI/Task.h"
2020
#include "swift/Runtime/AccessibleFunction.h"
2121
#include "swift/Runtime/Concurrency.h"
22+
#include "swift/Runtime/STLCompatibility.h"
2223

2324
using namespace swift;
2425

@@ -102,7 +103,7 @@ static void swift_distributed_execute_target_resume(
102103
SWIFT_CONTEXT SwiftError *error) {
103104
auto parentCtx = context->Parent;
104105
auto resumeInParent =
105-
reinterpret_cast<TargetExecutorSignature::ContinuationType *>(
106+
std::bit_cast<TargetExecutorSignature::ContinuationType *>(
106107
parentCtx->ResumeParent);
107108
swift_task_dealloc(context);
108109
// See `swift_distributed_execute_target` - `parentCtx` in this case
@@ -131,7 +132,7 @@ void swift_distributed_execute_target(
131132
SwiftError *error =
132133
swift_distributed_makeDistributedTargetAccessorNotFoundError();
133134
auto resumeInParent =
134-
reinterpret_cast<TargetExecutorSignature::ContinuationType *>(
135+
std::bit_cast<TargetExecutorSignature::ContinuationType *>(
135136
callerContext->ResumeParent);
136137
resumeInParent(callerContext, error);
137138
return;
@@ -149,8 +150,8 @@ void swift_distributed_execute_target(
149150
swift_task_alloc(asyncFnPtr->ExpectedContextSize));
150151

151152
calleeContext->Parent = callerContext;
152-
calleeContext->ResumeParent = reinterpret_cast<TaskContinuationFunction *>(
153-
swift_distributed_execute_target_resume);
153+
calleeContext->ResumeParent = std::bit_cast<TaskContinuationFunction *>(
154+
&swift_distributed_execute_target_resume);
154155

155156
accessorEntry(calleeContext, argumentDecoder, argumentTypes, resultBuffer,
156157
substitutions, witnessTables, numWitnessTables, actor,

0 commit comments

Comments
 (0)