[libcxx-commits] [libcxx] [libc++] Add a thread-safe version of std::lgamma in the dylib (PR #153631)

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Wed Oct 8 00:52:31 PDT 2025


================
@@ -0,0 +1,26 @@
+//===----------------------------------------------------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifdef __APPLE__
+#  define _REENTRANT
+#endif
+
+#include <cmath>
+#include <math.h> // for lgamma_r
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+namespace __math {
+
+_LIBCPP_EXPORTED_FROM_ABI __lgamma_result __lgamma_thread_safe_impl(double __d) noexcept {
----------------
philnik777 wrote:

I have to say I completely disagree. IMO this significantly hurts readability. We should instead just have non-_Uglified names for library-internal functions (which itself helps with readability in general). Spotting exported ones is trivial in that case. Removing the attribute here also ensures that the correct declarations are visible at the definition, which helps avoid declaration mismatches.

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


More information about the libcxx-commits mailing list