Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 14 additions & 4 deletions libcxx/include/__random/binomial_distribution.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,23 @@ class binomial_distribution {
}
};

// The LLVM C library provides this with conflicting `noexcept` attributes.
#if !defined(_LIBCPP_MSVCRT_LIKE) && !defined(__LLVM_LIBC__)
extern "C" double lgamma_r(double, int*);
// Some libc declares the math functions to be `noexcept`.
#if defined(_LIBCPP_GLIBC_PREREQ)
# if _LIBCPP_GLIBC_PREREQ(2, 8)
# define _LIBCPP_LGAMMA_R_NOEXCEPT _NOEXCEPT
# endif
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need an #else? Else the macro isn't defined if the inner #if here isn't true, right?

We're getting this on our bots, I'm guessing due to this:

[187/130551] CXX android_clang_arm/obj/third_party/abseil-cpp/absl/strings/cordz_functions/cordz_functions.o
../../third_party/llvm-build/Release+Asserts/bin/clang++ -MMD -MF android_clang_arm/obj/third_party/abseil-cpp/absl/strings/cordz_functions/co...(too long)
In file included from ../../third_party/abseil-cpp/absl/strings/internal/cordz_functions.cc:20:
In file included from ../../third_party/libc++/src/include/random:1685:
../../third_party/libc++/src/include/__random/binomial_distribution.h:112:42: error: expected function body after function declarator
  112 | extern "C" double lgamma_r(double, int*) _LIBCPP_LGAMMA_R_NOEXCEPT;
      |                                          ^
1 error generated.

Copy link
Contributor

@jhuber6 jhuber6 Sep 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same thing I'm seeing

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#157610 added it. Thanks!

#elif defined(__LLVM_LIBC__)
# define _LIBCPP_LGAMMA_R_NOEXCEPT _NOEXCEPT
#else
# define _LIBCPP_LGAMMA_R_NOEXCEPT
#endif

#if !defined(_LIBCPP_MSVCRT_LIKE)
extern "C" double lgamma_r(double, int*) _LIBCPP_LGAMMA_R_NOEXCEPT;
#endif

inline _LIBCPP_HIDE_FROM_ABI double __libcpp_lgamma(double __d) {
#if defined(_LIBCPP_MSVCRT_LIKE) || defined(__LLVM_LIBC__)
#if defined(_LIBCPP_MSVCRT_LIKE)
return lgamma(__d);
#else
int __sign;
Expand Down
Loading