-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Fix warning for uninitialized va_list variable. #17944
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
Fix warning for uninitialized va_list variable. #17944
Conversation
@swift-ci please smoke test |
I'm not sure that's a valid initialization for |
I don't think there is a globally correct initialization. Fortunately, this only matters for Darwin. |
337699d
to
f5255fe
Compare
@swift-ci please smoke test |
1 similar comment
@swift-ci please smoke test |
@swift-ci please test macOS platform |
Build failed |
@swift-ci please smoke test macOS platform |
That error is actually relevant:
If this were a .mm file you'd be okay, but not as a .m. |
I guess this is a good reminder not to just do smoke tests if you're dealing with something that might be platform-specific. |
rdar://problem/40626177
f5255fe
to
fc08a12
Compare
@swift-ci please test |
@swift-ci please test macOS platform |
@swift-ci please test Linux platform |
@swift-ci please smoke test macOS platform |
Build failed |
@swift-ci please smoke test Linux platform |
Build failed |
@swift-ci test Linux platform |
It seems that this works: static va_list x; We can use a static whether or not it gets copied on function calls because in this case we know that the value is not going to be used (and definitely not mutated). |
Clever enough answer. I wish there was something more semantic, but this is probably fine. (Just silencing the warning on that particular line of code using pragmas probably would have been fine too.) |
I was never able to get the warning when building outside of CI. I would like to understand why that is, when I have time to look more closely. |
rdar://problem/40626177
Initializes a va_list variable that is currently not initialized. This is purely to silence a compiler warning because the value will not be used.