Skip to content

Commit ed210f9

Browse files
authored
[libc++][CI] Tests the no RTTI configuration. (#65518)
There are a few drive-by fixes: - Since the combination RTTI disabled and exceptions enabled do not work, this combination is prohibited. - A small NFC in any fixing clang-tidy. The code in the Buildkite configuration is prepared for using the std module. There are more fixes needed for that configuration which will be done in a separate commit.
1 parent c209d56 commit ed210f9

File tree

5 files changed

+21
-1
lines changed

5 files changed

+21
-1
lines changed

.github/workflows/libcxx-build-and-test.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ jobs:
160160
'generic-no-tzdb',
161161
'generic-no-unicode',
162162
'generic-no-wide-characters',
163+
'generic-no-rtti',
163164
'generic-static',
164165
'generic-with_llvm_unwinder',
165166
# TODO Find a better place for the benchmark and bootstrapping builds to live. They're either very expensive

libcxx/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,9 @@ endif()
284284

285285
# Feature options -------------------------------------------------------------
286286
option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON)
287-
option(LIBCXX_ENABLE_RTTI "Use run time type information." ON)
287+
option(LIBCXX_ENABLE_RTTI
288+
"Use runtime type information.
289+
This option may only be set to OFF when LIBCXX_ENABLE_EXCEPTIONS=OFF." ON)
288290
option(LIBCXX_ENABLE_THREADS "Build libc++ with support for threads." ON)
289291
option(LIBCXX_ENABLE_MONOTONIC_CLOCK
290292
"Build libc++ with support for a monotonic clock.
@@ -374,6 +376,13 @@ if (LIBCXX_HAS_PTHREAD_API)
374376
endif()
375377
endif()
376378

379+
if (NOT LIBCXX_ENABLE_RTTI AND LIBCXX_ENABLE_EXCEPTIONS)
380+
message(FATAL_ERROR "Libc++ cannot be built with exceptions enabled but RTTI"
381+
" disabled, since that configuration is broken. See"
382+
" https://github.com/llvm/llvm-project/issues/66117"
383+
" for details.")
384+
endif()
385+
377386
# Ensure LLVM_USE_SANITIZER is not specified when LIBCXX_GENERATE_COVERAGE
378387
# is ON.
379388
if (LLVM_USE_SANITIZER AND LIBCXX_GENERATE_COVERAGE)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
set(LIBCXX_ENABLE_RTTI OFF CACHE BOOL "")
2+
set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
3+
set(LIBCXXABI_ENABLE_RTTI OFF CACHE BOOL "")
4+
set(LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")

libcxx/docs/BuildingLibcxx.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ libc++ Feature Options
369369
**Default**: ``ON``
370370

371371
Build libc++ with run time type information.
372+
This option may only be set to OFF when LIBCXX_ENABLE_EXCEPTIONS=OFF.
372373

373374
.. option:: LIBCXX_INCLUDE_TESTS:BOOL
374375

libcxx/utils/ci/run-buildbot

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,11 @@ generic-no-exceptions)
472472
check-runtimes
473473
check-abi-list
474474
;;
475+
generic-no-rtti)
476+
clean
477+
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-rtti.cmake"
478+
check-runtimes
479+
;;
475480
#
476481
# Other miscellaneous jobs
477482
#

0 commit comments

Comments
 (0)