[libcxx-commits] [libcxx] [libcxx] atomic min/max (PR #186694)
via libcxx-commits
libcxx-commits at lists.llvm.org
Sun Mar 15 11:53:42 PDT 2026
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,inc,h -- libcxx/test/std/atomics/atomics.ref/fetch_max.pass.cpp libcxx/test/std/atomics/atomics.ref/fetch_min.pass.cpp libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_max.pass.cpp libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_max_explicit.pass.cpp libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_max_helper.h libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_min.pass.cpp libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_min_explicit.pass.cpp libcxx/test/std/atomics/atomics.types.operations/atomics.types.operations.req/atomic_fetch_min_helper.h libcxx/include/__atomic/atomic.h libcxx/include/__atomic/atomic_ref.h libcxx/include/__atomic/support/c11.h libcxx/include/__atomic/support/gcc.h libcxx/include/version libcxx/modules/std/atomic.inc libcxx/test/std/language.support/support.limits/support.limits.general/version.version.compile.pass.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/__atomic/atomic_ref.h b/libcxx/include/__atomic/atomic_ref.h
index df41b9825..984c8594f 100644
--- a/libcxx/include/__atomic/atomic_ref.h
+++ b/libcxx/include/__atomic/atomic_ref.h
@@ -301,7 +301,7 @@ struct atomic_ref<_Tp> : public __atomic_ref_base<_Tp> {
return __atomic_fetch_xor(this->__ptr_, __arg, std::__to_gcc_order(__order));
}
-#if _LIBCPP_STD_VER >= 26
+# if _LIBCPP_STD_VER >= 26
_LIBCPP_HIDE_FROM_ABI _Tp fetch_min(_Tp __arg, memory_order __order = memory_order_seq_cst) const noexcept {
_Tp __old = this->load(memory_order_relaxed);
_Tp __new;
@@ -318,7 +318,7 @@ struct atomic_ref<_Tp> : public __atomic_ref_base<_Tp> {
} while (!this->compare_exchange_weak(__old, __new, __order, memory_order_relaxed));
return __old;
}
-#endif // _LIBCPP_STD_VER >= 26
+# endif // _LIBCPP_STD_VER >= 26
_LIBCPP_HIDE_FROM_ABI _Tp operator++(int) const noexcept { return fetch_add(_Tp(1)); }
_LIBCPP_HIDE_FROM_ABI _Tp operator--(int) const noexcept { return fetch_sub(_Tp(1)); }
@@ -398,7 +398,7 @@ struct atomic_ref<_Tp*> : public __atomic_ref_base<_Tp*> {
return __atomic_fetch_sub(this->__ptr_, __arg * sizeof(_Tp), std::__to_gcc_order(__order));
}
-#if _LIBCPP_STD_VER >= 26
+# if _LIBCPP_STD_VER >= 26
_LIBCPP_HIDE_FROM_ABI _Tp* fetch_min(_Tp* __arg, memory_order __order = memory_order_seq_cst) const noexcept {
_Tp* __old = this->load(memory_order_relaxed);
_Tp* __new;
@@ -415,7 +415,7 @@ struct atomic_ref<_Tp*> : public __atomic_ref_base<_Tp*> {
} while (!this->compare_exchange_weak(__old, __new, __order, memory_order_relaxed));
return __old;
}
-#endif // _LIBCPP_STD_VER >= 26
+# endif // _LIBCPP_STD_VER >= 26
_LIBCPP_HIDE_FROM_ABI _Tp* operator++(int) const noexcept { return fetch_add(1); }
_LIBCPP_HIDE_FROM_ABI _Tp* operator--(int) const noexcept { return fetch_sub(1); }
``````````
</details>
https://github.com/llvm/llvm-project/pull/186694
More information about the libcxx-commits
mailing list