[libcxx-commits] [libcxx] [llvm] [libc++][math][c++17] P0226R1 - Mathematical Special Functions: infra + `std::assoc_laguerre` (PR #205649)

via libcxx-commits libcxx-commits at lists.llvm.org
Sat Jun 27 01:06:44 PDT 2026


================
@@ -15,16 +15,49 @@
 #include <__math/traits.h>
 #include <__type_traits/enable_if.h>
 #include <__type_traits/is_integral.h>
+#include <cerrno>
+#include <cfenv>
 #include <limits>
+#include <math.h>
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #  pragma GCC system_header
 #endif
 
 _LIBCPP_BEGIN_NAMESPACE_STD
+_LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS
 
 #if _LIBCPP_STD_VER >= 17
 
+namespace __math {
+template <class _Tp>
+struct __sf_result {
+  bool __domain_error;
+  _Tp __ret;
+
+  operator _Tp() const {
+#  if math_errhandling & MATH_ERRNO
+    if (__domain_error)
+      errno = EDOM;
+#  endif
+
+#  if math_errhandling & MATH_ERREXCEPT
+    if (__domain_error)
+      feraiseexcept(FE_INVALID);
+#  endif
+
+    return __ret;
+  }
+};
+
+_LIBCPP_EXPORTED_FROM_ABI __sf_result<float> __assoc_laguerre(unsigned int, unsigned int, float) noexcept;
+
+} // namespace __math
+
+inline _LIBCPP_HIDE_FROM_ABI float assoc_laguerref(unsigned int __n, unsigned int __m, float __x) noexcept {
----------------
PaulXiCao wrote:

Hi @Zingam . Regarding your comment:
> With these: _LIBCPP_BEGIN_EXPLICIT_ABI_ANNOTATIONS do we still need _LIBCPP_HIDE_FROM_ABI?

Yes. My current understanding of the abi macros is that they are confusingly named: inside the `EXPLICIT_ABI_ANNOTATIONS` scope we need to add `HIDE/EXPORTED_FROM_ABI` which is in contrast to the `NAMESPACE_STD` scope where `HIDE` is auto-applied to functions (thus, writing it is redundant but conventional).

Another look at the current pr would be appreciated.


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


More information about the libcxx-commits mailing list