[libcxx-commits] [libcxx] [libc++][cmath] Adding `[[nodicard]]` (PR #171763)

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Dec 10 21:16:11 PST 2025


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff origin/main HEAD --extensions ,cpp,h -- libcxx/include/__math/error_functions.h libcxx/include/__math/exponential_functions.h libcxx/include/__math/fdim.h libcxx/include/__math/fma.h libcxx/include/__math/gamma.h libcxx/include/__math/hyperbolic_functions.h libcxx/include/__math/hypot.h libcxx/include/__math/inverse_hyperbolic_functions.h libcxx/include/__math/inverse_trigonometric_functions.h libcxx/include/__math/trigonometric_functions.h libcxx/include/cmath libcxx/test/libcxx/diagnostics/cmath.nodiscard.verify.cpp --diff_from_common_commit
``````````

:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/libcxx/include/__math/inverse_hyperbolic_functions.h b/libcxx/include/__math/inverse_hyperbolic_functions.h
index 922a5ea6f..70d54668d 100644
--- a/libcxx/include/__math/inverse_hyperbolic_functions.h
+++ b/libcxx/include/__math/inverse_hyperbolic_functions.h
@@ -30,7 +30,9 @@ template <class = int>
   return __builtin_acosh(__x);
 }
 
-[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double acosh(long double __x) _NOEXCEPT { return __builtin_acoshl(__x); }
+[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double acosh(long double __x) _NOEXCEPT {
+  return __builtin_acoshl(__x);
+}
 
 template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
 [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI double acosh(_A1 __x) _NOEXCEPT {
@@ -46,7 +48,9 @@ template <class = int>
   return __builtin_asinh(__x);
 }
 
-[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double asinh(long double __x) _NOEXCEPT { return __builtin_asinhl(__x); }
+[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double asinh(long double __x) _NOEXCEPT {
+  return __builtin_asinhl(__x);
+}
 
 template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
 [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI double asinh(_A1 __x) _NOEXCEPT {
@@ -62,7 +66,9 @@ template <class = int>
   return __builtin_atanh(__x);
 }
 
-[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double atanh(long double __x) _NOEXCEPT { return __builtin_atanhl(__x); }
+[[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI long double atanh(long double __x) _NOEXCEPT {
+  return __builtin_atanhl(__x);
+}
 
 template <class _A1, __enable_if_t<is_integral<_A1>::value, int> = 0>
 [[__nodiscard__]] inline _LIBCPP_HIDE_FROM_ABI double atanh(_A1 __x) _NOEXCEPT {

``````````

</details>


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


More information about the libcxx-commits mailing list