mirror of
https://github.com/intel/llvm.git
synced 2026-01-18 16:50:51 +08:00
Reinstate libc++ patches now that the lldb formatter has been updated.
"[libc++] Fix <atomic> failures on GCC" "[libc++] Change memory_order to an enum class" "[libc++] decoupling Freestanding atomic<T> from libatomic.a" llvm-svn: 355427
This commit is contained in:
@@ -38,6 +38,10 @@
|
||||
# define _LIBCPP_ABI_VERSION 1
|
||||
#endif
|
||||
|
||||
#ifndef __STDC_HOSTED__
|
||||
# define _LIBCPP_FREESTANDING
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_STD_VER
|
||||
# if __cplusplus <= 201103L
|
||||
# define _LIBCPP_STD_VER 11
|
||||
@@ -1220,9 +1224,18 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_contiguous_container(
|
||||
# define _LIBCPP_HAS_GCC_ATOMIC_IMP
|
||||
#endif
|
||||
|
||||
#if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && !defined(_LIBCPP_HAS_GCC_ATOMIC_IMP)) \
|
||||
#if (!defined(_LIBCPP_HAS_C_ATOMIC_IMP) && \
|
||||
!defined(_LIBCPP_HAS_GCC_ATOMIC_IMP) && \
|
||||
!defined(_LIBCPP_HAS_EXTERNAL_ATOMIC_IMP)) \
|
||||
|| defined(_LIBCPP_HAS_NO_THREADS)
|
||||
#define _LIBCPP_HAS_NO_ATOMIC_HEADER
|
||||
# define _LIBCPP_HAS_NO_ATOMIC_HEADER
|
||||
#else
|
||||
# ifndef _LIBCPP_ATOMIC_FLAG_TYPE
|
||||
# define _LIBCPP_ATOMIC_FLAG_TYPE bool
|
||||
# endif
|
||||
# ifdef _LIBCPP_FREESTANDING
|
||||
# define _LIBCPP_ATOMIC_ONLY_USE_BUILTINS
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#ifndef _LIBCPP_DISABLE_UBSAN_UNSIGNED_INTEGER_CHECK
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -39,8 +39,8 @@ template <bool Disable = NeedWorkaroundForPR31864,
|
||||
class LLong = long long,
|
||||
class ULLong = unsigned long long>
|
||||
void checkLongLongTypes() {
|
||||
static_assert(std::atomic<LLong>::is_always_lock_free == (2 == ATOMIC_LLONG_LOCK_FREE));
|
||||
static_assert(std::atomic<ULLong>::is_always_lock_free == (2 == ATOMIC_LLONG_LOCK_FREE));
|
||||
static_assert(std::atomic<LLong>::is_always_lock_free == (2 == ATOMIC_LLONG_LOCK_FREE), "");
|
||||
static_assert(std::atomic<ULLong>::is_always_lock_free == (2 == ATOMIC_LLONG_LOCK_FREE), "");
|
||||
}
|
||||
|
||||
// Used to make the calls to __atomic_always_lock_free dependent on a template
|
||||
@@ -116,22 +116,22 @@ void run()
|
||||
CHECK_ALWAYS_LOCK_FREE(union IntFloat { int i; float f; });
|
||||
|
||||
// C macro and static constexpr must be consistent.
|
||||
static_assert(std::atomic<bool>::is_always_lock_free == (2 == ATOMIC_BOOL_LOCK_FREE));
|
||||
static_assert(std::atomic<char>::is_always_lock_free == (2 == ATOMIC_CHAR_LOCK_FREE));
|
||||
static_assert(std::atomic<signed char>::is_always_lock_free == (2 == ATOMIC_CHAR_LOCK_FREE));
|
||||
static_assert(std::atomic<unsigned char>::is_always_lock_free == (2 == ATOMIC_CHAR_LOCK_FREE));
|
||||
static_assert(std::atomic<char16_t>::is_always_lock_free == (2 == ATOMIC_CHAR16_T_LOCK_FREE));
|
||||
static_assert(std::atomic<char32_t>::is_always_lock_free == (2 == ATOMIC_CHAR32_T_LOCK_FREE));
|
||||
static_assert(std::atomic<wchar_t>::is_always_lock_free == (2 == ATOMIC_WCHAR_T_LOCK_FREE));
|
||||
static_assert(std::atomic<short>::is_always_lock_free == (2 == ATOMIC_SHORT_LOCK_FREE));
|
||||
static_assert(std::atomic<unsigned short>::is_always_lock_free == (2 == ATOMIC_SHORT_LOCK_FREE));
|
||||
static_assert(std::atomic<int>::is_always_lock_free == (2 == ATOMIC_INT_LOCK_FREE));
|
||||
static_assert(std::atomic<unsigned int>::is_always_lock_free == (2 == ATOMIC_INT_LOCK_FREE));
|
||||
static_assert(std::atomic<long>::is_always_lock_free == (2 == ATOMIC_LONG_LOCK_FREE));
|
||||
static_assert(std::atomic<unsigned long>::is_always_lock_free == (2 == ATOMIC_LONG_LOCK_FREE));
|
||||
static_assert(std::atomic<bool>::is_always_lock_free == (2 == ATOMIC_BOOL_LOCK_FREE), "");
|
||||
static_assert(std::atomic<char>::is_always_lock_free == (2 == ATOMIC_CHAR_LOCK_FREE), "");
|
||||
static_assert(std::atomic<signed char>::is_always_lock_free == (2 == ATOMIC_CHAR_LOCK_FREE), "");
|
||||
static_assert(std::atomic<unsigned char>::is_always_lock_free == (2 == ATOMIC_CHAR_LOCK_FREE), "");
|
||||
static_assert(std::atomic<char16_t>::is_always_lock_free == (2 == ATOMIC_CHAR16_T_LOCK_FREE), "");
|
||||
static_assert(std::atomic<char32_t>::is_always_lock_free == (2 == ATOMIC_CHAR32_T_LOCK_FREE), "");
|
||||
static_assert(std::atomic<wchar_t>::is_always_lock_free == (2 == ATOMIC_WCHAR_T_LOCK_FREE), "");
|
||||
static_assert(std::atomic<short>::is_always_lock_free == (2 == ATOMIC_SHORT_LOCK_FREE), "");
|
||||
static_assert(std::atomic<unsigned short>::is_always_lock_free == (2 == ATOMIC_SHORT_LOCK_FREE), "");
|
||||
static_assert(std::atomic<int>::is_always_lock_free == (2 == ATOMIC_INT_LOCK_FREE), "");
|
||||
static_assert(std::atomic<unsigned int>::is_always_lock_free == (2 == ATOMIC_INT_LOCK_FREE), "");
|
||||
static_assert(std::atomic<long>::is_always_lock_free == (2 == ATOMIC_LONG_LOCK_FREE), "");
|
||||
static_assert(std::atomic<unsigned long>::is_always_lock_free == (2 == ATOMIC_LONG_LOCK_FREE), "");
|
||||
checkLongLongTypes();
|
||||
static_assert(std::atomic<void*>::is_always_lock_free == (2 == ATOMIC_POINTER_LOCK_FREE));
|
||||
static_assert(std::atomic<std::nullptr_t>::is_always_lock_free == (2 == ATOMIC_POINTER_LOCK_FREE));
|
||||
static_assert(std::atomic<void*>::is_always_lock_free == (2 == ATOMIC_POINTER_LOCK_FREE), "");
|
||||
static_assert(std::atomic<std::nullptr_t>::is_always_lock_free == (2 == ATOMIC_POINTER_LOCK_FREE), "");
|
||||
}
|
||||
|
||||
int main(int, char**) { run(); return 0; }
|
||||
|
||||
@@ -21,14 +21,15 @@
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
assert(std::memory_order_relaxed == 0);
|
||||
assert(std::memory_order_consume == 1);
|
||||
assert(std::memory_order_acquire == 2);
|
||||
assert(std::memory_order_release == 3);
|
||||
assert(std::memory_order_acq_rel == 4);
|
||||
assert(std::memory_order_seq_cst == 5);
|
||||
std::memory_order o = std::memory_order_seq_cst;
|
||||
assert(o == 5);
|
||||
assert(static_cast<int>(std::memory_order_relaxed) == 0);
|
||||
assert(static_cast<int>(std::memory_order_consume) == 1);
|
||||
assert(static_cast<int>(std::memory_order_acquire) == 2);
|
||||
assert(static_cast<int>(std::memory_order_release) == 3);
|
||||
assert(static_cast<int>(std::memory_order_acq_rel) == 4);
|
||||
assert(static_cast<int>(std::memory_order_seq_cst) == 5);
|
||||
|
||||
return 0;
|
||||
std::memory_order o = std::memory_order_seq_cst;
|
||||
assert(static_cast<int>(o) == 5);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
|
||||
// See https://llvm.org/LICENSE.txt for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
//
|
||||
//===----------------------------------------------------------------------===//
|
||||
//
|
||||
// UNSUPPORTED: libcpp-has-no-threads, c++98, c++03, c++11, c++14, c++17
|
||||
|
||||
#include <atomic>
|
||||
|
||||
int main(int, char**)
|
||||
{
|
||||
static_assert(std::memory_order_relaxed == std::memory_order::relaxed);
|
||||
static_assert(std::memory_order_consume == std::memory_order::consume);
|
||||
static_assert(std::memory_order_acquire == std::memory_order::acquire);
|
||||
static_assert(std::memory_order_release == std::memory_order::release);
|
||||
static_assert(std::memory_order_acq_rel == std::memory_order::acq_rel);
|
||||
static_assert(std::memory_order_seq_cst == std::memory_order::seq_cst);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -61,7 +61,7 @@
|
||||
<tr><td><a href="https://wg21.link/P0053R7">P0053R7</a></td><td>LWG</td><td>C++ Synchronized Buffered Ostream</td><td>Albuquerque</td><td></td><td></td></tr>
|
||||
<tr><td><a href="https://wg21.link/P0202R3">P0202R3</a></td><td>LWG</td><td>Add constexpr modifiers to functions in <algorithm> and <utility> Headers</td><td>Albuquerque</td><td><I>In Progress</I></td><td>7.0</td></tr>
|
||||
<tr><td><a href="https://wg21.link/P0415R1">P0415R1</a></td><td>LWG</td><td>Constexpr for <tt>std::complex</tt></td><td>Albuquerque</td><td><I>In Progress</I></td><td>7.0</td></tr>
|
||||
<tr><td><a href="https://wg21.link/P0439R0">P0439R0</a></td><td>LWG</td><td>Make <tt>std::memory_order</tt> a scoped enumeration</td><td>Albuquerque</td><td></td><td></td></tr>
|
||||
<tr><td><a href="https://wg21.link/P0439R0">P0439R0</a></td><td>LWG</td><td>Make <tt>std::memory_order</tt> a scoped enumeration</td><td>Albuquerque</td><td>Complete</td><td></td></tr>
|
||||
<tr><td><a href="https://wg21.link/P0457R2">P0457R2</a></td><td>LWG</td><td>String Prefix and Suffix Checking</td><td>Albuquerque</td><td>Complete</td><td>6.0</td></tr>
|
||||
<tr><td><a href="https://wg21.link/P0550R2">P0550R2</a></td><td>LWG</td><td>Transformation Trait <tt>remove_cvref</tt></td><td>Albuquerque</td><td>Complete</td><td>6.0</td></tr>
|
||||
<tr><td><a href="https://wg21.link/P0600R1">P0600R1</a></td><td>LWG</td><td>nodiscard in the Library</td><td>Albuquerque</td><td><I>In Progress</I></td><td>7.0</td></tr>
|
||||
|
||||
Reference in New Issue
Block a user