Skip to content

Commit 12d72be

Browse files
authored
Merge pull request swiftlang#77275 from tshortli/rebranch-warnings
Gardening: Address some new warnings
2 parents 5f5c9dd + 4ab3aae commit 12d72be

File tree

7 files changed

+13
-4
lines changed

7 files changed

+13
-4
lines changed

include/swift/ABI/Task.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,9 +736,12 @@ static_assert(sizeof(AsyncTask) == NumWords_AsyncTask * sizeof(void*),
736736
"AsyncTask size is wrong");
737737
static_assert(alignof(AsyncTask) == 2 * alignof(void*),
738738
"AsyncTask alignment is wrong");
739+
#pragma clang diagnostic push
740+
#pragma clang diagnostic ignored "-Winvalid-offsetof"
739741
// Libc hardcodes this offset to extract the TaskID
740742
static_assert(offsetof(AsyncTask, Id) == 4 * sizeof(void *) + 4,
741743
"AsyncTask::Id offset is wrong");
744+
#pragma clang diagnostic pop
742745

743746
SWIFT_CC(swiftasync)
744747
inline void Job::runInFullyEstablishedContext() {

include/swift/Remote/MetadataReader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1481,7 +1481,7 @@ class MetadataReader {
14811481
return 0;
14821482
};
14831483

1484-
switch (auto kind = flags.getKind()) {
1484+
switch (flags.getKind()) {
14851485
case ContextDescriptorKind::Module:
14861486
baseSize = sizeof(TargetModuleContextDescriptor<Runtime>);
14871487
break;

lib/Demangling/Demangler.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2810,7 +2810,7 @@ NodePointer Demangler::demangleThunkOrSpecialization() {
28102810
switch (char c = nextChar()) {
28112811
// Thunks that are from a thunk inst. We take the TT namespace.
28122812
case 'T': {
2813-
switch (char c = nextChar()) {
2813+
switch (nextChar()) {
28142814
case 'I':
28152815
return createWithChild(Node::Kind::SILThunkIdentity, popNode(isEntity));
28162816
case 'H':

stdlib/public/Concurrency/TaskPrivate.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -865,8 +865,11 @@ struct AsyncTask::PrivateStorage {
865865

866866
// It will be aligned to 2 words on all platforms. On arm64_32, we have an
867867
// additional requirement where it is aligned to 4 words.
868+
#pragma clang diagnostic push
869+
#pragma clang diagnostic ignored "-Winvalid-offsetof"
868870
static_assert(((offsetof(AsyncTask, Private) + offsetof(AsyncTask::PrivateStorage, StatusStorage)) % ACTIVE_TASK_STATUS_SIZE == 0),
869871
"StatusStorage is not aligned in the AsyncTask");
872+
#pragma clang diagnostic pop
870873
static_assert(sizeof(AsyncTask::PrivateStorage) <= sizeof(AsyncTask::OpaquePrivateStorage),
871874
"Task-private storage doesn't fit in reserved space");
872875

stdlib/public/runtime/LibPrespecialized.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -686,7 +686,7 @@ void _swift_validatePrespecializedMetadata() {
686686

687687
auto result = swift_getTypeByMangledName(MetadataState::Complete,
688688
mangledName, nullptr, {}, {});
689-
if (auto *error = result.getError()) {
689+
if (result.getError()) {
690690
fprintf(stderr,
691691
"Prespecializations library validation: unable to build metadata "
692692
"for mangled name '%s'\n",

stdlib/public/runtime/MetadataLookup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ ResolveAsSymbolicReference::operator()(SymbolicReferenceKind kind,
164164
break;
165165

166166
default:
167-
if (auto typeContext = dyn_cast<TypeContextDescriptor>(descriptor)) {
167+
if (isa<TypeContextDescriptor>(descriptor)) {
168168
nodeKind = Node::Kind::TypeSymbolicReference;
169169
isType = true;
170170
break;

stdlib/toolchain/Compatibility56/include/Concurrency/Task.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,9 +605,12 @@ static_assert(sizeof(AsyncTask) == NumWords_AsyncTask * sizeof(void*),
605605
"AsyncTask size is wrong");
606606
static_assert(alignof(AsyncTask) == 2 * alignof(void*),
607607
"AsyncTask alignment is wrong");
608+
#pragma clang diagnostic push
609+
#pragma clang diagnostic ignored "-Winvalid-offsetof"
608610
// Libc hardcodes this offset to extract the TaskID
609611
static_assert(offsetof(AsyncTask, Id) == 4 * sizeof(void *) + 4,
610612
"AsyncTask::Id offset is wrong");
613+
#pragma clang diagnostic pop
611614

612615
SWIFT_CC(swiftasync)
613616
inline void Job::runInFullyEstablishedContext() {

0 commit comments

Comments
 (0)