Skip to content

Commit e4add55

Browse files
committed
[CMake] Pass -no_warn_inits to the linker on Apple platforms to silence warnings about global initializers.
We already get warnings from clang at compile time. For cases where we silence those, with SWIFT_ALLOWED_RUNTIME_GLOBAL_CTOR_BEGIN, these warnings are just noise. rdar://problem/70445131
1 parent 56928ba commit e4add55

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

stdlib/cmake/modules/AddSwiftStdlib.cmake

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1291,6 +1291,10 @@ function(_add_swift_target_library_single target name)
12911291
endif()
12921292
endif()
12931293
endif()
1294+
1295+
# Silence warnings about global initializers. We already have clang
1296+
# emitting warnings about global initializers when it compiles the code.
1297+
list(APPEND swiftlib_link_flags_all "-Xlinker -no_warn_inits")
12941298
endif()
12951299
target_link_libraries(${target} PRIVATE
12961300
${link_libraries})

0 commit comments

Comments
 (0)