Skip to content
Open
Show file tree
Hide file tree
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
5 changes: 4 additions & 1 deletion libcxx/include/atomic
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,10 @@ template <class T>
# define _LIBCPP_STDATOMIC_H_HAS_DEFINITELY_BEEN_INCLUDED 0
# endif

# if _LIBCPP_STD_VER < 23 && _LIBCPP_STDATOMIC_H_HAS_DEFINITELY_BEEN_INCLUDED
// The Android LLVM toolchain has historically allowed combining the <atomic>
// and <stdatomic.h> headers in dialects before C++23, so for backwards
// compatibility, preserve that ability when targeting Android.
# if _LIBCPP_STD_VER < 23 && !defined(__ANDROID__) && _LIBCPP_STDATOMIC_H_HAS_DEFINITELY_BEEN_INCLUDED
# error <atomic> is incompatible with <stdatomic.h> before C++23. Please compile with -std=c++23.
# endif

Expand Down
5 changes: 4 additions & 1 deletion libcxx/include/stdatomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,10 @@ using std::atomic_signal_fence // see below
# pragma GCC system_header
# endif

# if defined(__cplusplus) && _LIBCPP_STD_VER >= 23
// The Android LLVM toolchain has historically allowed combining the <atomic>
// and <stdatomic.h> headers in dialects before C++23, so for backwards
// compatibility, preserve that ability when targeting Android.
# if defined(__cplusplus) && (_LIBCPP_STD_VER >= 23 || defined(__ANDROID__))

# include <atomic>
# include <version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
//===----------------------------------------------------------------------===//

// UNSUPPORTED: no-threads
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20

// On Android, libc++'s <stdatomic.h> header always redirects to <atomic>, even before C++23.
// UNSUPPORTED: (c++03 || c++11 || c++14 || c++17 || c++20) && !android

// This test verifies that <stdatomic.h> redirects to <atomic>.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
// UNSUPPORTED: no-threads
// REQUIRES: c++03 || c++11 || c++14 || c++17 || c++20

// On Android, libc++'s <stdatomic.h> header always redirects to <atomic>, even before C++23.
// XFAIL: android

// No diagnostic gets emitted when we build with modules.
// XFAIL: clang-modules-build

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
// doesn't work at all if we don't use the <stdatomic.h> provided by libc++ in C++23 and above.
// XFAIL: (c++11 || c++14 || c++17 || c++20) && gcc

// On Android, libc++'s <stdatomic.h> header always redirects to <atomic>, even before C++23.
// XFAIL: android

#include <atomic>
#include <stdatomic.h>
#include <type_traits>
Expand Down
Loading