Skip to content

[libc++] Strictly enforce C++ language requirements. #130501

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mordante
Copy link
Member

@mordante mordante commented Mar 9, 2025

This was disabled for documentation bots. Testing whether that is still required. Compiling the dylib with a language standard before C++23 does not work, so it would be good when this can be enforced by CMake.

This was disabled for documentation bots. Testing whether that is still
required. Compiling the dylib with a language standard before C++23 does
not work, so it would be good when this can be enforced by CMake.
@mordante mordante requested review from a team as code owners March 9, 2025 18:21
@llvmbot llvmbot added libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi. libc++abi libc++abi C++ Runtime Library. Not libc++. labels Mar 9, 2025
@llvmbot
Copy link
Member

llvmbot commented Mar 9, 2025

@llvm/pr-subscribers-libcxxabi

@llvm/pr-subscribers-libcxx

Author: Mark de Wever (mordante)

Changes

This was disabled for documentation bots. Testing whether that is still required. Compiling the dylib with a language standard before C++23 does not work, so it would be good when this can be enforced by CMake.


Full diff: https://github.com/llvm/llvm-project/pull/130501.diff

2 Files Affected:

  • (modified) libcxx/CMakeLists.txt (+1-1)
  • (modified) libcxxabi/src/CMakeLists.txt (+2-2)
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index abe12c2805a7c..d40abaf18dd4a 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -499,7 +499,7 @@ function(cxx_add_basic_build_flags target)
   # Use C++23 for all targets.
   set_target_properties(${target} PROPERTIES
     CXX_STANDARD 23
-    CXX_STANDARD_REQUIRED OFF # TODO: Make this REQUIRED once we don't need to accommodate the LLVM documentation builders using an ancient CMake
+	CXX_STANDARD_REQUIRED ON
     CXX_EXTENSIONS NO)
 
   # When building the dylib, don't warn for unavailable aligned allocation
diff --git a/libcxxabi/src/CMakeLists.txt b/libcxxabi/src/CMakeLists.txt
index 0a6fc892a4f69..256c87427d746 100644
--- a/libcxxabi/src/CMakeLists.txt
+++ b/libcxxabi/src/CMakeLists.txt
@@ -181,7 +181,7 @@ set_target_properties(cxxabi_shared_objects
   PROPERTIES
     CXX_EXTENSIONS OFF
     CXX_STANDARD 23
-    CXX_STANDARD_REQUIRED OFF # TODO: Make this REQUIRED once we don't need to accommodate the LLVM documentation builders using an ancient CMake
+	CXX_STANDARD_REQUIRED ON
     COMPILE_FLAGS "${LIBCXXABI_COMPILE_FLAGS}"
     DEFINE_SYMBOL ""
 )
@@ -280,7 +280,7 @@ set_target_properties(cxxabi_static_objects
   PROPERTIES
     CXX_EXTENSIONS OFF
     CXX_STANDARD 23
-    CXX_STANDARD_REQUIRED OFF # TODO: Make this REQUIRED once we don't need to accommodate the LLVM documentation builders using an ancient CMake
+	CXX_STANDARD_REQUIRED ON
     COMPILE_FLAGS "${LIBCXXABI_COMPILE_FLAGS}"
 )
 target_compile_options(cxxabi_static_objects PRIVATE "${LIBCXXABI_ADDITIONAL_COMPILE_FLAGS}")

@ldionne
Copy link
Member

ldionne commented Mar 18, 2025

I would really like to be able to land this, but I think the bots that actually build and publish the documentation on llvm.org are not in Github actions yet (probably here). I suspect that landing this change might break these builders unless they've been updated to a more recent CMake. FWIW, I'd support landing this to try it out and reverting swiftly if things break. Obviously the better alternative would be to switch the documentation bots into Github actions instead, but that requires more work and I'm not volunteering.

Pinging @tstellar for additional context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
libc++abi libc++abi C++ Runtime Library. Not libc++. libc++ libc++ C++ Standard Library. Not GNU libstdc++. Not libc++abi.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants