[compiler-rt] [scudo] Avoid deprecated-volatile warning in HybridMutex::delayLoop (PR #67135)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 22 09:23:06 PDT 2023


================
@@ -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)
----------------
ChiaHungDuan wrote:

Can you do it like,
```
        const u32 Tmp = V + 1;
        V = Tmp;
```
So that we don't the pragma directive. I'll be replacing the use of volatile later

https://github.com/llvm/llvm-project/pull/67135


More information about the llvm-commits mailing list