[libcxx-commits] [PATCH] D127358: [libc++] Use a different namespace for the debug-mode version of the library

Louis Dionne via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jun 8 15:33:22 PDT 2022


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

This ensures that one can't easily mix the debug version of the library
and the non-debug version of the library by mistake.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127358

Files:
  libcxx/CMakeLists.txt


Index: libcxx/CMakeLists.txt
===================================================================
--- libcxx/CMakeLists.txt
+++ libcxx/CMakeLists.txt
@@ -185,7 +185,15 @@
    For example, -DLIBCXX_LIBRARY_VERSION=x.y will result in the library being named
    libc++.x.y.dylib, along with the usual symlinks pointing to that. On Apple platforms,
    this also controls the linker's 'current_version' property.")
-set(LIBCXX_ABI_NAMESPACE "__${LIBCXX_ABI_VERSION}" CACHE STRING "The inline ABI namespace used by libc++. It defaults to __n where `n` is the current ABI version.")
+
+set(_default_abi_namespace "__${LIBCXX_ABI_VERSION}")
+if (LIBCXX_ENABLE_DEBUG_MODE)
+  set(_default_abi_namespace "${_default_abi_namespace}d")
+endif()
+set(LIBCXX_ABI_NAMESPACE "${_default_abi_namespace}" CACHE STRING
+  "The inline ABI namespace used by libc++. It defaults to __n where `n` is the current ABI version.
+   If the debug mode is enabled, the 'd' suffix is added to the namespace to distinguish it from the
+   non-debug version of the library.")
 if (NOT LIBCXX_ABI_NAMESPACE MATCHES "__.*")
   message(FATAL_ERROR "LIBCXX_ABI_NAMESPACE must be a reserved identifier.")
 endif()


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127358.435363.patch
Type: text/x-patch
Size: 1178 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20220608/d087c875/attachment.bin>


More information about the libcxx-commits mailing list