Skip to content

Commit 06c0efb

Browse files
committed
[stdlib] Reinstate AllowUnsafeAttribute experimental feature on libraries
We need this so that older compilers can handle the .swiftinterface files we generate. It's unnecessary for newer compilers and can be removed later. Fixes rdar://148529962. (cherry picked from commit 0100104)
1 parent 50cb6ad commit 06c0efb

File tree

7 files changed

+7
-1
lines changed

7 files changed

+7
-1
lines changed

Runtimes/Core/cmake/modules/ExperimentalFeatures.cmake

+1
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ add_compile_options(
1010
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature FreestandingMacros>"
1111
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature BitwiseCopyable>"
1212
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature Extern>"
13+
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature AllowUnsafeAttribute>"
1314
"$<$<COMPILE_LANGUAGE:Swift>:SHELL:-enable-experimental-feature ValueGenerics>")

stdlib/public/Concurrency/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ list(APPEND SWIFT_RUNTIME_CONCURRENCY_SWIFT_FLAGS
6666
)
6767

6868
list(APPEND SWIFT_RUNTIME_CONCURRENCY_SWIFT_FLAGS "-strict-memory-safety")
69+
list(APPEND SWIFT_RUNTIME_CONCURRENCY_SWIFT_FLAGS "-enable-experimental-feature" "AllowUnsafeAttribute")
6970

7071
list(APPEND SWIFT_RUNTIME_CONCURRENCY_C_FLAGS
7172
"-D__STDC_WANT_LIB_EXT1__=1")

stdlib/public/Cxx/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ add_swift_target_library(swiftCxx STATIC NO_LINK_NAME IS_STDLIB IS_SWIFT_ONLY
2323
-cxx-interoperability-mode=default
2424
-enable-experimental-feature Span
2525
-enable-experimental-feature BuiltinModule
26+
-enable-experimental-feature AllowUnsafeAttribute
2627
-strict-memory-safety
2728
# This module should not pull in the C++ standard library, so we disable it explicitly.
2829
# For functionality that depends on the C++ stdlib, use C++ stdlib overlay (`swiftstd` module).

stdlib/public/Cxx/std/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ add_swift_target_library(swiftCxxStdlib STATIC NO_LINK_NAME IS_STDLIB IS_SWIFT_O
6060
# using C++ symbols in resilient overlays (see f4204568).
6161
-enable-experimental-feature AssumeResilientCxxTypes
6262

63+
-enable-experimental-feature AllowUnsafeAttribute
6364
-strict-memory-safety
6465

6566
# The varying modularization of the C++ standard library on different

stdlib/public/Distributed/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ add_swift_target_library(swiftDistributed ${SWIFT_STDLIB_LIBRARY_BUILD_TYPES} IS
5252
SWIFT_COMPILE_FLAGS
5353
${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}
5454
-parse-stdlib
55+
-enable-experimental-feature AllowUnsafeAttribute
5556
-strict-memory-safety
5657

5758
LINK_FLAGS

stdlib/public/SwiftOnoneSupport/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set(swiftOnoneSupport_common_options
77

88
"${SWIFT_SOURCE_DIR}/stdlib/linker-support/magic-symbols-for-install-name.c"
99

10-
SWIFT_COMPILE_FLAGS "-parse-stdlib" "-Xllvm" "-sil-inline-generics=false" "-Xfrontend" "-validate-tbd-against-ir=none" "-Xfrontend" "-check-onone-completeness" "-Xfrontend" "-disable-access-control" "-strict-memory-safety" "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}" "${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}"
10+
SWIFT_COMPILE_FLAGS "-parse-stdlib" "-Xllvm" "-sil-inline-generics=false" "-Xfrontend" "-validate-tbd-against-ir=none" "-Xfrontend" "-check-onone-completeness" "-Xfrontend" "-disable-access-control" "-strict-memory-safety" "-enable-experimental-feature" "AllowUnsafeAttribute" "${SWIFT_RUNTIME_SWIFT_COMPILE_FLAGS}" "${SWIFT_STANDARD_LIBRARY_SWIFT_FLAGS}"
1111
LINK_FLAGS "${SWIFT_RUNTIME_SWIFT_LINK_FLAGS}")
1212

1313
if(CMAKE_BUILD_TYPE STREQUAL "Debug" AND BOOTSTRAPPING_MODE STREQUAL "BOOTSTRAPPING")

stdlib/public/core/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -326,6 +326,7 @@ list(APPEND swift_stdlib_compile_flags "-enable-experimental-feature" "BitwiseCo
326326
list(APPEND swift_stdlib_compile_flags "-enable-experimental-feature" "ValueGenerics")
327327
list(APPEND swift_stdlib_compile_flags "-enable-experimental-feature" "AddressableParameters")
328328
list(APPEND swift_stdlib_compile_flags "-enable-experimental-feature" "AddressableTypes")
329+
list(APPEND swift_stdlib_compile_flags "-enable-experimental-feature" "AllowUnsafeAttribute")
329330
list(APPEND swift_stdlib_compile_flags "-strict-memory-safety")
330331

331332
if("${SWIFT_NATIVE_SWIFT_TOOLS_PATH}" STREQUAL "")

0 commit comments

Comments
 (0)