> On May 2, 2017, at 9:36 AM, John McCall <rjmcc...@apple.com> wrote:
> 
>> On May 2, 2017, at 12:02 PM, Joe Groff via swift-dev <swift-dev@swift.org> 
>> wrote:
>> After updating clang recently, I'm seeing these warnings:
>> 
>> /Users/jgroff/src/s/swift/stdlib/public/stubs/GlobalObjects.cpp:40:39: 
>> warning: declaration requires a global constructor [-Wglobal-constructors]
>> swift::_SwiftEmptyArrayStorage swift::_swiftEmptyArrayStorage = {
>>                                     ^                         ~
>> /Users/jgroff/src/s/swift/stdlib/public/stubs/GlobalObjects.cpp:55:44: 
>> warning: declaration requires a global constructor [-Wglobal-constructors]
>> swift::_SwiftEmptyDictionaryStorage swift::_swiftEmptyDictionaryStorage = {
>>                                          ^                              ~
>> /Users/jgroff/src/s/swift/stdlib/public/stubs/GlobalObjects.cpp:83:37: 
>> warning: declaration requires a global constructor [-Wglobal-constructors]
>> swift::_SwiftEmptySetStorage swift::_swiftEmptySetStorage = {
>>                                   ^                       ~
>> 
>> Looking at the definitions of those objects, it isn't clear to me why they 
>> would require global constructors. The types are POD, and their initializers 
>> only contain pointers to other globals, which ought to be resolvable by the 
>> linker. I also didn't see any recent change to the runtime that seems like 
>> it would trigger a change here. Is this a clang bug?
> 
> Can you tell from the object file whether a global constructor is needed?

There is a global constructor, but it appears to be for another definition in 
the same file (and which legitimately needs the global ctor).

-Joe
_______________________________________________
swift-dev mailing list
swift-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-dev

Reply via email to