[libcxx-commits] [libcxx] [libc++][CI] Tests the no RTTI configuration. (PR #65518)
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Sep 10 09:57:10 PDT 2023
https://github.com/mordante updated https://github.com/llvm/llvm-project/pull/65518:
>From 264236cd3289515a32d3e43a13733b1a462258c2 Mon Sep 17 00:00:00 2001
From: Mark de Wever <koraq at xs4all.nl>
Date: Wed, 6 Sep 2023 20:59:55 +0200
Subject: [PATCH] [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.
---
libcxx/CMakeLists.txt | 9 ++++++++-
libcxx/cmake/caches/Generic-no-rtti.cmake | 4 ++++
libcxx/docs/BuildingLibcxx.rst | 1 +
libcxx/include/any | 4 +---
libcxx/utils/ci/buildkite-pipeline.yml | 21 +++++++++++++++++++++
libcxx/utils/ci/run-buildbot | 5 +++++
6 files changed, 40 insertions(+), 4 deletions(-)
create mode 100644 libcxx/cmake/caches/Generic-no-rtti.cmake
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index c729542d8cd370b..7be3b010dd89595 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -279,7 +279,9 @@ endif()
# Feature options -------------------------------------------------------------
option(LIBCXX_ENABLE_EXCEPTIONS "Use exceptions." ON)
-option(LIBCXX_ENABLE_RTTI "Use run time type information." ON)
+option(LIBCXX_ENABLE_RTTI
+ "Use run time type information.
+ This option may only be set to OFF when LIBCXX_ENABLE_EXCEPTIONS=OFF." ON)
option(LIBCXX_ENABLE_THREADS "Build libc++ with support for threads." ON)
option(LIBCXX_ENABLE_MONOTONIC_CLOCK
"Build libc++ with support for a monotonic clock.
@@ -370,6 +372,11 @@ if (LIBCXX_HAS_PTHREAD_API)
endif()
endif()
+if (NOT LIBCXX_ENABLE_RTTI AND LIBCXX_ENABLE_EXCEPTIONS)
+ message(FATAL_ERROR "The option LIBCXX_ENABLE_RTTI can not be turned off"
+ " when LIBCXX_ENABLE_EXCEPTIONS is turned on.")
+endif()
+
# Ensure LLVM_USE_SANITIZER is not specified when LIBCXX_GENERATE_COVERAGE
# is ON.
if (LLVM_USE_SANITIZER AND LIBCXX_GENERATE_COVERAGE)
diff --git a/libcxx/cmake/caches/Generic-no-rtti.cmake b/libcxx/cmake/caches/Generic-no-rtti.cmake
new file mode 100644
index 000000000000000..c62ddcec90149b4
--- /dev/null
+++ b/libcxx/cmake/caches/Generic-no-rtti.cmake
@@ -0,0 +1,4 @@
+set(LIBCXX_ENABLE_RTTI OFF CACHE BOOL "")
+set(LIBCXX_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
+set(LIBCXXABI_ENABLE_RTTI OFF CACHE BOOL "")
+set(LIBCXXABI_ENABLE_EXCEPTIONS OFF CACHE BOOL "")
diff --git a/libcxx/docs/BuildingLibcxx.rst b/libcxx/docs/BuildingLibcxx.rst
index e919e1e6f32bfc3..bcc29f55aa0500b 100644
--- a/libcxx/docs/BuildingLibcxx.rst
+++ b/libcxx/docs/BuildingLibcxx.rst
@@ -378,6 +378,7 @@ libc++ Feature Options
**Default**: ``ON``
Build libc++ with run time type information.
+ This option may only be set to OFF when LIBCXX_ENABLE_EXCEPTIONS=OFF.
.. option:: LIBCXX_INCLUDE_TESTS:BOOL
diff --git a/libcxx/include/any b/libcxx/include/any
index b3ac5871c42fc2c..ce5437ec32fcac1 100644
--- a/libcxx/include/any
+++ b/libcxx/include/any
@@ -196,9 +196,7 @@ namespace __any_imp
if (__id && *__id == typeid(_Tp))
return true;
#endif
- if (!__id && __fallback_id == __any_imp::__get_fallback_typeid<_Tp>())
- return true;
- return false;
+ return !__id && __fallback_id == __any_imp::__get_fallback_typeid<_Tp>();
}
template <class _Tp>
diff --git a/libcxx/utils/ci/buildkite-pipeline.yml b/libcxx/utils/ci/buildkite-pipeline.yml
index a08e85b67256232..1772f9f9f3ce3ce 100644
--- a/libcxx/utils/ci/buildkite-pipeline.yml
+++ b/libcxx/utils/ci/buildkite-pipeline.yml
@@ -741,6 +741,27 @@ steps:
limit: 2
timeout_in_minutes: 120
+ - label: "No RTTI"
+ command: "libcxx/utils/ci/run-buildbot generic-no-rtti"
+ artifact_paths:
+ - "**/test-results.xml"
+ - "**/*.abilist"
+ env:
+ # Note: Modules require and absolute path for clang-scan-deps
+ # https://github.com/llvm/llvm-project/issues/61006
+ CC: "/usr/lib/llvm-${LLVM_HEAD_VERSION}/bin/clang"
+ CXX: "/usr/lib/llvm-${LLVM_HEAD_VERSION}/bin/clang++"
+ CMAKE: "/opt/bin/cmake"
+ ENABLE_CLANG_TIDY: "On"
+ agents:
+ queue: "libcxx-builders"
+ os: "linux"
+ retry:
+ automatic:
+ - exit_status: -1 # Agent was lost
+ limit: 2
+ timeout_in_minutes: 120
+
- label: "Unstable ABI"
command: "libcxx/utils/ci/run-buildbot generic-abi-unstable"
artifact_paths:
diff --git a/libcxx/utils/ci/run-buildbot b/libcxx/utils/ci/run-buildbot
index db9efe3bf480ce7..c7330a4b5f5f4c2 100755
--- a/libcxx/utils/ci/run-buildbot
+++ b/libcxx/utils/ci/run-buildbot
@@ -476,6 +476,11 @@ generic-no-exceptions)
check-runtimes
check-abi-list
;;
+generic-no-rtti)
+ clean
+ generate-cmake -C "${MONOREPO_ROOT}/libcxx/cmake/caches/Generic-no-rtti.cmake"
+ check-runtimes
+;;
#
# Other miscellaneous jobs
#
More information about the libcxx-commits
mailing list