Skip to content

Commit 198d091

Browse files
committed
build: avoid redundant flag specification
Remove the flag being specified in multiple locations unnecessarily. The flags flow downwards to all the subdirectories. Use that to apply the C/C++ flags from the root of the runtime repository.
1 parent 9f18130 commit 198d091

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
@@ -1147,14 +1147,6 @@ function(_add_swift_target_library_single target name)
11471147
MACCATALYST_BUILD_FLAVOR "${SWIFTLIB_SINGLE_MACCATALYST_BUILD_FLAVOR}"
11481148
)
11491149

1150-
if(SWIFTLIB_IS_STDLIB)
1151-
# We don't ever want to link against the ABI-breakage checking symbols
1152-
# in the standard library, runtime, or overlays because they only rely
1153-
# on the header parts of LLVM's ADT.
1154-
list(APPEND c_compile_flags
1155-
"-DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING=1")
1156-
endif()
1157-
11581150
if(SWIFTLIB_SINGLE_SDK STREQUAL WINDOWS)
11591151
if(libkind STREQUAL SHARED)
11601152
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)