Skip to content
Merged
Changes from 1 commit
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
8 changes: 6 additions & 2 deletions compiler-rt/lib/scudo/standalone/mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,13 @@ class CAPABILITY("mutex") HybridMutex {
// are the fastest operations) so that we are unlikely to wait too long for
// fast operations.
constexpr u32 SpinTimes = 16;
volatile u32 V = 0;

#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-but-set-variable"
volatile u32 V;
for (u32 I = 0; I < SpinTimes; ++I)
++V;
V = 0;
Copy link
Contributor

@ChiaHungDuan ChiaHungDuan Sep 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you do it like,

        const u32 Tmp = V + 1;
        V = Tmp;

So that we don't need the pragma directive. I'll be replacing the use of volatile later

#pragma GCC diagnostic pop
}

void assertHeldImpl();
Expand Down