[compiler-rt] [TSan] Fix warning when compiling with -Wmissing-designated-field-initializers (PR #163401)

via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 14 07:11:39 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

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

Author: Dan Blackwell (DanBlackwell)

<details>
<summary>Changes</summary>

Currently we receive a warning when initializing a ThreadEventCallbacks when compiling with this flag:
```
llvm-project/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp:252:3: warning: missing field 'start' initializer [-Wmissing-designated-field-initializers]
  252 |   };
      |   ^
```

This patch explicitly initializes the missing fields to null, fixing the warning.

rdar://162074310

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


1 Files Affected:

- (modified) compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp (+2) 


``````````diff
diff --git a/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp b/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp
index 62ab0554df08e..7fa5e017d3985 100644
--- a/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp
+++ b/compiler-rt/lib/tsan/rtl/tsan_platform_mac.cpp
@@ -259,7 +259,9 @@ void InitializePlatform() {
 
   ThreadEventCallbacks callbacks = {
       .create = ThreadCreateCallback,
+      .start = nullptr,
       .terminate = ThreadTerminateCallback,
+      .destroy = nullptr,
   };
   InstallPthreadIntrospectionHook(callbacks);
 #endif

``````````

</details>


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


More information about the llvm-commits mailing list