Skip to content

Commit 8127c83

Browse files
authored
Merge pull request swiftlang#79099 from tshortli/fix-warnings
Gardening: Fix various recently introduced warnings
2 parents a8fa4fb + 4799f1e commit 8127c83

File tree

9 files changed

+35
-7
lines changed

9 files changed

+35
-7
lines changed

lib/Frontend/ModuleInterfaceLoader.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2250,9 +2250,6 @@ InterfaceSubContextDelegateImpl::runInSubCompilerInstance(StringRef moduleName,
22502250

22512251
info.BuildArguments = BuildArgs;
22522252
info.Hash = CacheHash;
2253-
auto target = *(std::find(BuildArgs.rbegin(), BuildArgs.rend(), "-target") - 1);
2254-
auto langVersion = *(std::find(BuildArgs.rbegin(), BuildArgs.rend(),
2255-
"-swift-version") - 1);
22562253

22572254
// Run the action under the sub compiler instance.
22582255
return action(info);

lib/Macros/Sources/ObservationMacros/ObservableMacro.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ public struct ObservationTrackedMacro: AccessorMacro {
338338
return []
339339
}
340340

341-
guard let container = context.lexicalContext[0].as(ClassDeclSyntax.self) else {
341+
guard context.lexicalContext[0].as(ClassDeclSyntax.self) != nil else {
342342
return []
343343
}
344344

@@ -406,11 +406,11 @@ extension ObservationTrackedMacro: PeerMacro {
406406
) throws -> [DeclSyntax] {
407407
guard let property = declaration.as(VariableDeclSyntax.self),
408408
property.isValidForObservation,
409-
let identifier = property.identifier?.trimmed else {
409+
property.identifier?.trimmed != nil else {
410410
return []
411411
}
412412

413-
guard let container = context.lexicalContext[0].as(ClassDeclSyntax.self) else {
413+
guard context.lexicalContext[0].as(ClassDeclSyntax.self) != nil else {
414414
return []
415415
}
416416

stdlib/public/Concurrency/Actor.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,13 @@ void swift::swift_task_reportUnexpectedExecutor(
653653
.errorType = "actor-isolation-violation",
654654
.currentStackDescription = "Actor-isolated function called from another thread",
655655
.framesToSkip = 1,
656+
.memoryAddress = nullptr,
657+
.numExtraThreads = 0,
658+
.threads = nullptr,
659+
.numFixIts = 0,
660+
.fixIts = nullptr,
661+
.numNotes = 0,
662+
.notes = nullptr,
656663
};
657664
_swift_reportToDebugger(
658665
isFatalError ? RuntimeErrorFlagFatal : RuntimeErrorFlagNone, message,

stdlib/public/Concurrency/DispatchGlobalExecutor.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ struct MinimalDispatchObjectHeader {
6969

7070
#pragma clang diagnostic push
7171
#pragma clang diagnostic ignored "-Wgnu-offsetof-extensions"
72+
#pragma clang diagnostic push
73+
#pragma clang diagnostic ignored "-Winvalid-offsetof"
7274
static_assert(
7375
offsetof(Job, metadata) == offsetof(MinimalDispatchObjectHeader, VTable),
7476
"Job Metadata field must match location of Dispatch VTable field.");
@@ -77,6 +79,7 @@ static_assert(offsetof(Job, SchedulerPrivate[Job::DispatchLinkageIndex]) ==
7779
"Dispatch Linkage field must match Job "
7880
"SchedulerPrivate[DispatchLinkageIndex].");
7981
#pragma clang diagnostic pop
82+
#pragma clang diagnostic pop
8083

8184
/// The function passed to dispatch_async_f to execute a job.
8285
static void __swift_run_job(void *_job) {

stdlib/public/Concurrency/ExecutorChecks.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,8 @@ static_assert((SwiftJobPriority)swift::JobPriority::Background
5151
static_assert((SwiftJobPriority)swift::JobPriority::Unspecified
5252
== SwiftUnspecifiedJobPriority);
5353

54+
#pragma clang diagnostic push
55+
#pragma clang diagnostic ignored "-Winvalid-offsetof"
5456
// Job (has additional fields not exposed via SwiftJob)
5557
static_assert(sizeof(swift::Job) >= sizeof(SwiftJob));
5658
static_assert(offsetof(swift::Job, metadata) == offsetof(SwiftJob, metadata));
@@ -63,6 +65,7 @@ static_assert(offsetof(swift::Job, SchedulerPrivate) == offsetof(SwiftJob, sched
6365
static_assert(offsetof(swift::Job, SchedulerPrivate[0]) == offsetof(SwiftJob, schedulerPrivate[0]));
6466
static_assert(offsetof(swift::Job, SchedulerPrivate[1]) == offsetof(SwiftJob, schedulerPrivate[1]));
6567
static_assert(offsetof(swift::Job, Flags) == offsetof(SwiftJob, flags));
68+
#pragma clang diagnostic pop
6669

6770
// SerialExecutorRef
6871
static_assert(sizeof(swift::SerialExecutorRef) == sizeof(SwiftExecutorRef));

stdlib/public/Concurrency/TaskGroup.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -606,6 +606,13 @@ struct TaskGroupStatus {
606606
.errorType = "task-group-violation",
607607
.currentStackDescription = "TaskGroup exceeded supported pending task count",
608608
.framesToSkip = 1,
609+
.memoryAddress = nullptr,
610+
.numExtraThreads = 0,
611+
.threads = nullptr,
612+
.numFixIts = 0,
613+
.fixIts = nullptr,
614+
.numNotes = 0,
615+
.notes = nullptr,
609616
};
610617
_swift_reportToDebugger(RuntimeErrorFlagFatal, message, &details);
611618
}

stdlib/public/Concurrency/TaskLocal.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,6 +338,13 @@ static void swift_task_reportIllegalTaskLocalBindingWithinWithTaskGroupImpl(
338338
.errorType = "task-local-violation",
339339
.currentStackDescription = "Task-local bound in illegal context",
340340
.framesToSkip = 1,
341+
.memoryAddress = nullptr,
342+
.numExtraThreads = 0,
343+
.threads = nullptr,
344+
.numFixIts = 0,
345+
.fixIts = nullptr,
346+
.numNotes = 0,
347+
.notes = nullptr,
341348
};
342349
_swift_reportToDebugger(RuntimeErrorFlagFatal, message, &details);
343350
}

stdlib/public/RuntimeModule/Backtrace.swift

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,11 @@ extension Backtrace {
428428
return Backtrace(architecture: context.architecture,
429429
frames: unwinder.dropFirst(offset),
430430
images: images)
431+
432+
@unknown default:
433+
// This will never execute but its needed to avoid warnings when
434+
// the Backtrace library is built with library evolution.
435+
fatalError()
431436
}
432437
}
433438
}

stdlib/public/libexec/swift-backtrace/main.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -719,7 +719,6 @@ Generate a backtrace for the parent process.
719719
var mentionedImages = Set<Int>()
720720
let formatter = backtraceFormatter()
721721

722-
let platform = target.images.platform
723722
let architecture: String
724723
switch crashingThread.backtrace {
725724
case let .raw(backtrace):

0 commit comments

Comments
 (0)