Skip to content

Commit 2f91751

Browse files
authored
[scudo] Avoid deprecated-volatile warning in HybridMutex::delayLoop (llvm#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]
1 parent 55ec9db commit 2f91751

File tree

1 file changed

+4
-2
lines changed
  • compiler-rt/lib/scudo/standalone

1 file changed

+4
-2
lines changed

compiler-rt/lib/scudo/standalone/mutex.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,10 @@ class CAPABILITY("mutex") HybridMutex {
5959
// fast operations.
6060
constexpr u32 SpinTimes = 16;
6161
volatile u32 V = 0;
62-
for (u32 I = 0; I < SpinTimes; ++I)
63-
++V;
62+
for (u32 I = 0; I < SpinTimes; ++I) {
63+
u32 Tmp = V + 1;
64+
V = Tmp;
65+
}
6466
}
6567

6668
void assertHeldImpl();

0 commit comments

Comments
 (0)