+++ /dev/null
-// -*- C++ -*-
-//===------------------------ __atomic_support -----------------------------===//
-//
-// The LLVM Compiler Infrastructure
-//
-// This file is dual licensed under the MIT and the University of Illinois Open
-// Source Licenses. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef _LIBCPP___ATOMIC_SUPPORT
-#define _LIBCPP___ATOMIC_SUPPORT
-
-#include <__config>
-
-template<typename T>
-T __libcpp_sync_add_and_fetch(T *ptr, T value) {
- return __sync_add_and_fetch(ptr, value);
-}
-
-template<typename T>
-T __libcpp_sync_fetch_and_add(T *ptr, T value) {
- return __sync_fetch_and_add(ptr, value);
-}
-
-template<typename T>
-T __libcpp_sync_lock_test_and_set(T *ptr, T value) {
- return __sync_lock_test_and_set(ptr, value);
-}
-
-#endif //_LIBCPP___ATOMIC_SUPPORT
#include <stdexcept>
#include <cstddef>
#include <cstring>
-#include <__atomic_support>
#ifdef __APPLE__
#include <dlfcn.h>
#include <mach-o/dyld.h>
: __imp_(s.__imp_)
{
if (__uses_refcount())
- __libcpp_sync_add_and_fetch(&rep_from_data(__imp_)->count, 1);
+ __sync_add_and_fetch(&rep_from_data(__imp_)->count, 1);
}
inline
struct _Rep_base *old_rep = rep_from_data(__imp_);
__imp_ = s.__imp_;
if (__uses_refcount())
- __libcpp_sync_add_and_fetch(&rep_from_data(__imp_)->count, 1);
+ __sync_add_and_fetch(&rep_from_data(__imp_)->count, 1);
if (adjust_old_count)
{
- if (__libcpp_sync_add_and_fetch(&old_rep->count, count_t(-1)) < 0)
+ if (__sync_add_and_fetch(&old_rep->count, count_t(-1)) < 0)
{
::operator delete(old_rep);
}
__libcpp_refstring::~__libcpp_refstring() {
if (__uses_refcount()) {
_Rep_base* rep = rep_from_data(__imp_);
- if (__libcpp_sync_add_and_fetch(&rep->count, count_t(-1)) < 0) {
+ if (__sync_add_and_fetch(&rep->count, count_t(-1)) < 0) {
::operator delete(rep);
}
}
#define _CTYPE_DISABLE_MACROS
#endif
#include "cwctype"
-#include "__atomic_support"
#include "__sso_allocator"
#if defined(_LIBCPP_MSVCRT) || defined(__MINGW32__)
#include "support/win32/locale_win32.h"
void
locale::id::__init()
{
- __id_ = __libcpp_sync_add_and_fetch(&__next_id, 1);
+ __id_ = __sync_add_and_fetch(&__next_id, 1);
}
// template <> class collate_byname<char>
//===----------------------------------------------------------------------===//
#include <cstdio>
-#include <__atomic_support>
namespace std {
unexpected_handler
set_unexpected(unexpected_handler func) _NOEXCEPT
{
- return __libcpp_sync_lock_test_and_set(&__unexpected_handler, func);
+ return __sync_lock_test_and_set(&__unexpected_handler, func);
}
unexpected_handler
get_unexpected() _NOEXCEPT
{
- return __libcpp_sync_fetch_and_add(&__unexpected_handler, (unexpected_handler)0);
+ return __sync_fetch_and_add(&__unexpected_handler, (unexpected_handler)0);
}
terminate_handler
set_terminate(terminate_handler func) _NOEXCEPT
{
- return __libcpp_sync_lock_test_and_set(&__terminate_handler, func);
+ return __sync_lock_test_and_set(&__terminate_handler, func);
}
terminate_handler
get_terminate() _NOEXCEPT
{
- return __libcpp_sync_fetch_and_add(&__terminate_handler, (terminate_handler)0);
+ return __sync_fetch_and_add(&__terminate_handler, (terminate_handler)0);
+
}
#ifndef __EMSCRIPTEN__ // We provide this in JS
//
//===----------------------------------------------------------------------===//
-#include <__atomic_support>
-
namespace std {
_LIBCPP_SAFE_STATIC static std::new_handler __new_handler;
new_handler
set_new_handler(new_handler handler) _NOEXCEPT
{
- return __libcpp_sync_lock_test_and_set(&__new_handler, handler);
+ return __sync_lock_test_and_set(&__new_handler, handler);
}
new_handler
get_new_handler() _NOEXCEPT
{
- return __libcpp_sync_fetch_and_add<new_handler>(&__new_handler, nullptr);
+ return __sync_fetch_and_add(&__new_handler, nullptr);
}
} // namespace std