-
Notifications
You must be signed in to change notification settings - Fork 15.4k
[TSan] Fix warning when compiling with -Wmissing-designated-field-initializers #163401
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[TSan] Fix warning when compiling with -Wmissing-designated-field-initializers #163401
Conversation
…tializers
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.
|
@llvm/pr-subscribers-compiler-rt-sanitizer Author: Dan Blackwell (DanBlackwell) ChangesCurrently we receive a warning when initializing a ThreadEventCallbacks when compiling with this flag: 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:
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
|
| .create = ThreadCreateCallback, | ||
| .start = nullptr, | ||
| .terminate = ThreadTerminateCallback, | ||
| .destroy = nullptr, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was picked up by someone building https://github.com/swiftlang/swift (which depends on llvm-project). It seems that they are setting -Wmissing-designated-field-initializers somehow. I rebuilt compiler-rt with the flag and this was the only warning I got, so I figured it's easy enough to clean up. I don't think that the standard llvm CMake build will hit this error, I had to add the flag to my CMAKE_CXX_FLAGS to trigger this.
I agree that this warning feels pedantic.
…tializers (llvm#163401) 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
…tializers (llvm#163401) 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
…tializers (llvm#163401) 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
Currently we receive a warning when initializing a ThreadEventCallbacks when compiling with this flag:
This patch explicitly initializes the missing fields to null, fixing the warning.
rdar://162074310