Distributed: silence some -Wcast-function-type-mismatch

This silences some of the newer warnings about the casting of function
pointers which is technically not permitted by the standard (function
and data pointers are not guaranteed to be the same).
This commit is contained in:
Saleem Abdulrasool
2025-01-29 15:15:20 -08:00
parent c831aa5153
commit 35cbb211c1

View File

@@ -14,11 +14,12 @@
///
///===----------------------------------------------------------------------===///
#include "swift/ABI/Task.h"
#include "swift/ABI/Actor.h"
#include "swift/ABI/Metadata.h"
#include "swift/ABI/Task.h"
#include "swift/Runtime/AccessibleFunction.h"
#include "swift/Runtime/Concurrency.h"
#include "swift/Runtime/STLCompatibility.h"
using namespace swift;
@@ -102,7 +103,7 @@ static void swift_distributed_execute_target_resume(
SWIFT_CONTEXT SwiftError *error) {
auto parentCtx = context->Parent;
auto resumeInParent =
reinterpret_cast<TargetExecutorSignature::ContinuationType *>(
std::bit_cast<TargetExecutorSignature::ContinuationType *>(
parentCtx->ResumeParent);
swift_task_dealloc(context);
// See `swift_distributed_execute_target` - `parentCtx` in this case
@@ -131,7 +132,7 @@ void swift_distributed_execute_target(
SwiftError *error =
swift_distributed_makeDistributedTargetAccessorNotFoundError();
auto resumeInParent =
reinterpret_cast<TargetExecutorSignature::ContinuationType *>(
std::bit_cast<TargetExecutorSignature::ContinuationType *>(
callerContext->ResumeParent);
resumeInParent(callerContext, error);
return;
@@ -149,8 +150,8 @@ void swift_distributed_execute_target(
swift_task_alloc(asyncFnPtr->ExpectedContextSize));
calleeContext->Parent = callerContext;
calleeContext->ResumeParent = reinterpret_cast<TaskContinuationFunction *>(
swift_distributed_execute_target_resume);
calleeContext->ResumeParent = std::bit_cast<TaskContinuationFunction *>(
&swift_distributed_execute_target_resume);
accessorEntry(calleeContext, argumentDecoder, argumentTypes, resultBuffer,
substitutions, witnessTables, numWitnessTables, actor,