Skip to content

Commit 923def2

Browse files
authored
Merge pull request #31544 from compnerd/runtime-defines
build: avoid redundant flag specification
2 parents b6988ff + 198d091 commit 923def2

File tree

3 files changed

+1
-25
lines changed

3 files changed

+1
-25
lines changed

stdlib/CMakeLists.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,7 @@ endif()
6161
# on the presence of symbols in libSupport to identify how the code was
6262
# built and cause link failures for mismatches. Without linking that library,
6363
# we get link failures regardless, so instead, this just disables the checks.
64-
if(CMAKE_VERSION VERSION_LESS 3.12)
65-
append("-DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
66-
else()
67-
add_compile_definitions(LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1)
68-
endif()
64+
add_compile_definitions($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1>)
6965

7066
set(SWIFT_STDLIB_LIBRARY_BUILD_TYPES)
7167
if(SWIFT_BUILD_DYNAMIC_STDLIB)

stdlib/cmake/modules/AddSwiftStdlib.cmake

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1137,14 +1137,6 @@ function(_add_swift_target_library_single target name)
11371137
MACCATALYST_BUILD_FLAVOR "${SWIFTLIB_SINGLE_MACCATALYST_BUILD_FLAVOR}"
11381138
)
11391139

1140-
if(SWIFTLIB_IS_STDLIB)
1141-
# We don't ever want to link against the ABI-breakage checking symbols
1142-
# in the standard library, runtime, or overlays because they only rely
1143-
# on the header parts of LLVM's ADT.
1144-
list(APPEND c_compile_flags
1145-
"-DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1")
1146-
endif()
1147-
11481140
if(SWIFTLIB_SINGLE_SDK STREQUAL WINDOWS)
11491141
if(libkind STREQUAL SHARED)
11501142
list(APPEND c_compile_flags -D_WINDLL)

stdlib/toolchain/CMakeLists.txt

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -44,18 +44,6 @@ if("Thread" IN_LIST SWIFT_RUNTIME_USE_SANITIZERS)
4444
list(APPEND CXX_LINK_FLAGS "-fsanitize=thread")
4545
endif()
4646

47-
# Do not enforce checks for LLVM's ABI-breaking build settings.
48-
# The Swift runtime uses some header-only code from LLVM's ADT classes,
49-
# but we do not want to link libSupport into the runtime. These checks rely
50-
# on the presence of symbols in libSupport to identify how the code was
51-
# built and cause link failures for mismatches. Without linking that library,
52-
# we get link failures regardless, so instead, this just disables the checks.
53-
if(CMAKE_VERSION VERSION_LESS 3.12)
54-
append("-DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1" CMAKE_C_FLAGS CMAKE_CXX_FLAGS)
55-
else()
56-
add_compile_definitions(LLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1)
57-
endif()
58-
5947
# Compatibility libraries build in a special alternate universe that can't
6048
# directly link to most OS runtime libraries, and have to access the
6149
# runtime being patched only through public ABI.

0 commit comments

Comments
 (0)