Skip to content

Conversation

@cjappl
Copy link
Contributor

@cjappl cjappl commented Sep 24, 2024

Follow on to #109830

There should be no functional change, as enums start at 0 anyway. This just makes the code more readable and prevents any future bugs.

@llvmbot
Copy link
Member

llvmbot commented Sep 24, 2024

@llvm/pr-subscribers-compiler-rt-sanitizer

Author: Chris Apple (cjappl)

Changes

Follow on to #109830

There should be no functional change, as enums start at 0 anyway. This just makes the code more readable and prevents any future bugs.


Full diff: https://github.com/llvm/llvm-project/pull/109856.diff

1 Files Affected:

  • (modified) compiler-rt/lib/rtsan/rtsan.cpp (+2-1)
diff --git a/compiler-rt/lib/rtsan/rtsan.cpp b/compiler-rt/lib/rtsan/rtsan.cpp
index e6d2481b2c2a3d..84e4b8fae1e2fa 100644
--- a/compiler-rt/lib/rtsan/rtsan.cpp
+++ b/compiler-rt/lib/rtsan/rtsan.cpp
@@ -31,7 +31,8 @@ enum class InitializationState : u8 {
 } // namespace
 
 static StaticSpinMutex rtsan_inited_mutex;
-static atomic_uint8_t rtsan_initialized = {0};
+static atomic_uint8_t rtsan_initialized = {
+    static_cast<u8>(InitializationState::Uninitialized)};
 
 static void SetInitializationState(InitializationState state) {
   atomic_store(&rtsan_initialized, static_cast<u8>(state),

@cjappl
Copy link
Contributor Author

cjappl commented Sep 24, 2024

CC @davidtrevelyan

@cjappl cjappl deleted the explicit_unitialized branch September 24, 2024 20:08
Copy link
Contributor

@fmayer fmayer left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants