Skip to content

Commit ed3e635

Browse files
authored
Merge pull request #80243 from mikeash/ignore-constructor-warnings
[Runtime] Ignore some global constructor warnings.
2 parents d23adf4 + 6a383b2 commit ed3e635

File tree

4 files changed

+8
-0
lines changed

4 files changed

+8
-0
lines changed

stdlib/public/Concurrency/Setup.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ bool _swift_task_isCurrentGlobalActor(
4141
// Register our type descriptors with standard manglings when the concurrency
4242
// runtime is loaded. This allows the runtime to quickly resolve those standard
4343
// manglings.
44+
SWIFT_ALLOWED_RUNTIME_GLOBAL_CTOR_BEGIN
4445
__attribute__((constructor)) static void setupStandardConcurrencyDescriptors() {
4546
static const swift::ConcurrencyStandardTypeDescriptors descriptors = {
4647
#define STANDARD_TYPE(KIND, MANGLING, TYPENAME)
@@ -52,3 +53,4 @@ __attribute__((constructor)) static void setupStandardConcurrencyDescriptors() {
5253
&descriptors,
5354
&_swift_task_isCurrentGlobalActor);
5455
}
56+
SWIFT_ALLOWED_RUNTIME_GLOBAL_CTOR_END

stdlib/public/runtime/Metadata.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3549,10 +3549,12 @@ static bool installLazyClassNameHook() {
35493549
return false;
35503550
}
35513551

3552+
SWIFT_ALLOWED_RUNTIME_GLOBAL_CTOR_BEGIN
35523553
__attribute__((constructor)) SWIFT_RUNTIME_ATTRIBUTE_ALWAYS_INLINE static bool
35533554
supportsLazyObjcClassNames() {
35543555
return SWIFT_LAZY_CONSTANT(installLazyClassNameHook());
35553556
}
3557+
SWIFT_ALLOWED_RUNTIME_GLOBAL_CTOR_END
35563558

35573559
static void setUpGenericClassObjCName(ClassMetadata *theClass) {
35583560
if (supportsLazyObjcClassNames()) {

stdlib/public/runtime/MetadataLookup.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3282,12 +3282,14 @@ getObjCClassByMangledName(const char * _Nonnull typeName,
32823282
return OldGetClassHook(typeName, outClass);
32833283
}
32843284

3285+
SWIFT_ALLOWED_RUNTIME_GLOBAL_CTOR_BEGIN
32853286
__attribute__((constructor))
32863287
static void installGetClassHook() {
32873288
if (SWIFT_RUNTIME_WEAK_CHECK(objc_setHook_getClass)) {
32883289
SWIFT_RUNTIME_WEAK_USE(objc_setHook_getClass(getObjCClassByMangledName, &OldGetClassHook));
32893290
}
32903291
}
3292+
SWIFT_ALLOWED_RUNTIME_GLOBAL_CTOR_END
32913293

32923294
#endif
32933295

stdlib/toolchain/Compatibility50/Overrides.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ using mach_header_platform = mach_header_64;
8787
using mach_header_platform = mach_header;
8888
#endif
8989

90+
SWIFT_ALLOWED_RUNTIME_GLOBAL_CTOR_BEGIN
9091
__attribute__((constructor))
9192
static void installGetClassHook_untrusted() {
9293
extern char __dso_handle[];
@@ -118,3 +119,4 @@ static void installGetClassHook_untrusted() {
118119
}
119120
#pragma clang diagnostic pop
120121
}
122+
SWIFT_ALLOWED_RUNTIME_GLOBAL_CTOR_END

0 commit comments

Comments
 (0)