[libcxx-commits] [PATCH] D155038: [libc++][hardening][NFC] Remove the `LIBCXX_DEBUG_BUILD` CMake variable.

Konstantin Varlamov via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 11 20:19:44 PDT 2023


var-const created this revision.
Herald added a project: All.
var-const requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.

It's no longer necessary to define `_DEBUG` because we use our own
internal assertion mechanism in libc++.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D155038

Files:
  libcxx/CMakeLists.txt


Index: libcxx/CMakeLists.txt
===================================================================
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -471,11 +471,6 @@
 endif()
 
 string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
-if (uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
-  set(LIBCXX_DEBUG_BUILD ON)
-else()
-  set(LIBCXX_DEBUG_BUILD OFF)
-endif()
 
 #===============================================================================
 # Setup Compiler Flags
@@ -585,13 +580,6 @@
   endif()
 endif()
 
-# Assertion flags =============================================================
-define_if(LIBCXX_DEBUG_BUILD -D_DEBUG)
-if (LIBCXX_ENABLE_ASSERTIONS AND NOT LIBCXX_DEBUG_BUILD)
-  # MSVC doesn't like _DEBUG on release builds. See PR 4379.
-  define_if_not(MSVC -D_DEBUG)
-endif()
-
 # Modules flags ===============================================================
 # FIXME The libc++ sources are fundamentally non-modular. They need special
 # versions of the headers in order to provide C++03 and legacy ABI definitions.
@@ -711,7 +699,7 @@
   endif()
 
   if (MSVC)
-    if (LIBCXX_DEBUG_BUILD)
+    if (uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
       set(LIB_SUFFIX "d")
     else()
       set(LIB_SUFFIX "")


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D155038.539361.patch
Type: text/x-patch
Size: 1243 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20230712/27dfd289/attachment.bin>


More information about the libcxx-commits mailing list