[libcxx-commits] [libcxx] [libc++] Encode additional ODR-affecting properties in the ABI tag (PR #69669)

Konstantin Varlamov via libcxx-commits libcxx-commits at lists.llvm.org
Thu Oct 19 21:12:42 PDT 2023


================
@@ -734,22 +730,54 @@ typedef __char32_t char32_t;
 #    define _LIBCPP_EXCLUDE_FROM_EXPLICIT_INSTANTIATION _LIBCPP_ALWAYS_INLINE
 #  endif
 
+#  if _LIBCPP_ENABLE_HARDENED_MODE
+#    define _LIBCPP_HARDENING_SIG h
+#  elif _LIBCPP_ENABLE_SAFE_MODE
+#    define _LIBCPP_HARDENING_SIG s
+#  elif _LIBCPP_ENABLE_DEBUG_MODE
+#    define _LIBCPP_HARDENING_SIG d
+#  else
+#    define _LIBCPP_HARDENING_SIG u // for unchecked
+#  endif
+
+#  ifdef _LIBCPP_HAS_NO_EXCEPTIONS
+#    define _LIBCPP_EXCEPTIONS_SIG n
+#  else
+#    define _LIBCPP_EXCEPTIONS_SIG e
+#  endif
+
+#  define _LIBCPP_ODR_SIGNATURE                                                                                        \
+    _LIBCPP_CONCAT(_LIBCPP_CONCAT(_LIBCPP_CONCAT(v, _LIBCPP_VERSION), _LIBCPP_HARDENING_SIG), _LIBCPP_EXCEPTIONS_SIG)
----------------
var-const wrote:

Very optional: perhaps this could be made slightly more readable with some custom aligning? Strawman:
```cpp
 define _LIBCPP_ODR_SIGNATURE  _LIBCPP_CONCAT(_LIBCPP_CONCAT(_LIBCPP_CONCAT(    \
      v, _LIBCPP_VERSION),                                                      \
         _LIBCPP_HARDENING_SIG),                                                \
         _LIBCPP_EXCEPTIONS_SIG)
```

https://github.com/llvm/llvm-project/pull/69669


More information about the libcxx-commits mailing list