Skip to content

Commit

Permalink
[scudo] Avoid deprecated-volatile warning in HybridMutex::delayLoop (…
Browse files Browse the repository at this point in the history
…#67135)

That can prevent compilation with -Werror and -std=c++20:
mutex.h:63:7: error: increment of object of volatile-qualified type 'volatile u32' (aka 'volatile unsigned int') is deprecated [-Werror,-Wdeprecated-volatile]
  • Loading branch information
fabio-d authored Sep 22, 2023
1 parent 55ec9db commit 2f91751
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions compiler-rt/lib/scudo/standalone/mutex.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,10 @@ class CAPABILITY("mutex") HybridMutex {
// fast operations.
constexpr u32 SpinTimes = 16;
volatile u32 V = 0;
for (u32 I = 0; I < SpinTimes; ++I)
++V;
for (u32 I = 0; I < SpinTimes; ++I) {
u32 Tmp = V + 1;
V = Tmp;
}
}

void assertHeldImpl();
Expand Down

0 comments on commit 2f91751

Please sign in to comment.