Skip to content

Commit 264236c

Browse files
committed
[libc++][CI] Tests the no RTTI configuration.
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 2a0f2fa commit 264236c

File tree

6 files changed

+40
-4
lines changed

6 files changed

+40
-4
lines changed

libcxx/CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,9 @@ endif()
279279

280280
# Feature options -------------------------------------------------------------
281281
option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON)
282-
option(LIBCXX_ENABLE_RTTI "Use run time type information." ON)
282+
option(LIBCXX_ENABLE_RTTI
283+
"Use run time type information.
284+
This option may only be set to OFF when LIBCXX_ENABLE_EXCEPTIONS=OFF." ON)
283285
option(LIBCXX_ENABLE_THREADS "Build libc++ with support for threads." ON)
284286
option(LIBCXX_ENABLE_MONOTONIC_CLOCK
285287
"Build libc++ with support for a monotonic clock.
@@ -370,6 +372,11 @@ if (LIBCXX_HAS_PTHREAD_API)
370372
endif()
371373
endif()
372374

375+
if (NOT LIBCXX_ENABLE_RTTI AND LIBCXX_ENABLE_EXCEPTIONS)
376+
message(FATAL_ERROR "The option LIBCXX_ENABLE_RTTI can not be turned off"
377+
" when LIBCXX_ENABLE_EXCEPTIONS is turned on.")
378+
endif()
379+
373380
# Ensure LLVM_USE_SANITIZER is not specified when LIBCXX_GENERATE_COVERAGE
374381
# is ON.
375382
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
@@ -378,6 +378,7 @@ libc++ Feature Options
378378
**Default**: ``ON``
379379

380380
Build libc++ with run time type information.
381+
This option may only be set to OFF when LIBCXX_ENABLE_EXCEPTIONS=OFF.
381382

382383
.. option:: LIBCXX_INCLUDE_TESTS:BOOL
383384

libcxx/include/any

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,7 @@ namespace __any_imp
196196
if (__id && *__id == typeid(_Tp))
197197
return true;
198198
#endif
199-
if (!__id && __fallback_id == __any_imp::__get_fallback_typeid<_Tp>())
200-
return true;
201-
return false;
199+
return !__id && __fallback_id == __any_imp::__get_fallback_typeid<_Tp>();
202200
}
203201

204202
template <class _Tp>

libcxx/utils/ci/buildkite-pipeline.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -741,6 +741,27 @@ steps:
741741
limit: 2
742742
timeout_in_minutes: 120
743743

744+
- label: "No RTTI"
745+
command: "libcxx/utils/ci/run-buildbot generic-no-rtti"
746+
artifact_paths:
747+
- "**/test-results.xml"
748+
- "**/*.abilist"
749+
env:
750+
# Note: Modules require and absolute path for clang-scan-deps
751+
# https://github.com/llvm/llvm-project/issues/61006
752+
CC: "/usr/lib/llvm-${LLVM_HEAD_VERSION}/bin/clang"
753+
CXX: "/usr/lib/llvm-${LLVM_HEAD_VERSION}/bin/clang++"
754+
CMAKE: "/opt/bin/cmake"
755+
ENABLE_CLANG_TIDY: "On"
756+
agents:
757+
queue: "libcxx-builders"
758+
os: "linux"
759+
retry:
760+
automatic:
761+
- exit_status: -1 # Agent was lost
762+
limit: 2
763+
timeout_in_minutes: 120
764+
744765
- label: "Unstable ABI"
745766
command: "libcxx/utils/ci/run-buildbot generic-abi-unstable"
746767
artifact_paths:

libcxx/utils/ci/run-buildbot

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -476,6 +476,11 @@ generic-no-exceptions)
476476
check-runtimes
477477
check-abi-list
478478
;;
479+
generic-no-rtti)
480+
clean
481+
generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-rtti.cmake"
482+
check-runtimes
483+
;;
479484
#
480485
# Other miscellaneous jobs
481486
#

0 commit comments

Comments
 (0)