Skip to content

[NFC] Fix new warnings in the headers #78495

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions include/swift/Basic/HeaderFooterLayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ class size_without_trailing_padding {
struct ExtraByte { char _size_without_trailing_padding_probe; };
struct Probe: T, ExtraByte {};
public:
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
enum { value = offsetof(Probe, _size_without_trailing_padding_probe) };
#pragma clang diagnostic pop
};

namespace detail {
Expand Down
2 changes: 1 addition & 1 deletion include/swift/SIL/InstWrappers.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ struct LoadOperation {
/// TODO: Rather than use an optional here, we should include an invalid
/// representation in LoadOwnershipQualifier.
std::optional<LoadOwnershipQualifier> getOwnershipQualifier() const {
if (auto *lbi = value.dyn_cast<LoadBorrowInst *>()) {
if (value.dyn_cast<LoadBorrowInst *>()) {
return std::nullopt;
}

Expand Down
3 changes: 3 additions & 0 deletions include/swift/SIL/SILInstruction.h
Original file line number Diff line number Diff line change
Expand Up @@ -1195,9 +1195,12 @@ class SingleValueInstruction : public SILInstruction, public ValueBase {
};

struct SILNodeOffsetChecker {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Winvalid-offsetof"
static_assert(offsetof(SingleValueInstruction, kind) ==
offsetof(NonSingleValueInstruction, kind),
"wrong SILNode layout in SILInstruction");
#pragma clang diagnostic pop
};

inline SILNodePointer::SILNodePointer(const SingleValueInstruction *svi) :
Expand Down