[libcxx] r245354 - Move atomic_support.h and config_elast.h into src/include
Eric Fiselier via cfe-commits
cfe-commits at lists.llvm.org
Tue Aug 18 14:08:55 PDT 2015
Author: ericwf
Date: Tue Aug 18 16:08:54 2015
New Revision: 245354
URL: http://llvm.org/viewvc/llvm-project?rev=245354&view=rev
Log:
Move atomic_support.h and config_elast.h into src/include
Added:
libcxx/trunk/src/include/
libcxx/trunk/src/include/atomic_support.h
libcxx/trunk/src/include/config_elast.h
Removed:
libcxx/trunk/src/config_elast.h
libcxx/trunk/src/support/atomic_support.h
Modified:
libcxx/trunk/src/ios.cpp
libcxx/trunk/src/memory.cpp
libcxx/trunk/src/mutex.cpp
libcxx/trunk/src/system_error.cpp
Removed: libcxx/trunk/src/config_elast.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/config_elast.h?rev=245353&view=auto
==============================================================================
--- libcxx/trunk/src/config_elast.h (original)
+++ libcxx/trunk/src/config_elast.h (removed)
@@ -1,36 +0,0 @@
-//===----------------------- config_elast.h -------------------------------===//
-//
-// 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_CONFIG_ELAST
-#define _LIBCPP_CONFIG_ELAST
-
-#if defined(_WIN32)
-#include <stdlib.h>
-#else
-#include <errno.h>
-#endif
-
-#if defined(ELAST)
-#define _LIBCPP_ELAST ELAST
-#elif defined(_NEWLIB_VERSION)
-#define _LIBCPP_ELAST __ELASTERROR
-#elif defined(__linux__)
-#define _LIBCPP_ELAST 4095
-#elif defined(__APPLE__)
-// No _LIBCPP_ELAST needed on Apple
-#elif defined(__sun__)
-#define _LIBCPP_ELAST ESTALE
-#elif defined(_WIN32)
-#define _LIBCPP_ELAST _sys_nerr
-#else
-// Warn here so that the person doing the libcxx port has an easier time:
-#warning ELAST for this platform not yet implemented
-#endif
-
-#endif // _LIBCPP_CONFIG_ELAST
Added: libcxx/trunk/src/include/atomic_support.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/include/atomic_support.h?rev=245354&view=auto
==============================================================================
--- libcxx/trunk/src/include/atomic_support.h (added)
+++ libcxx/trunk/src/include/atomic_support.h Tue Aug 18 16:08:54 2015
@@ -0,0 +1,142 @@
+#ifndef ATOMIC_SUPPORT_H
+#define ATOMIC_SUPPORT_H
+
+#include "__config"
+#include "memory" // for __libcpp_relaxed_load
+
+#if defined(__clang__) && __has_builtin(__atomic_load_n) \
+ && __has_builtin(__atomic_store_n) \
+ && __has_builtin(__atomic_add_fetch) \
+ && __has_builtin(__atomic_compare_exchange_n) \
+ && defined(__ATOMIC_RELAXED) \
+ && defined(__ATOMIC_CONSUME) \
+ && defined(__ATOMIC_ACQUIRE) \
+ && defined(__ATOMIC_RELEASE) \
+ && defined(__ATOMIC_ACQ_REL) \
+ && defined(__ATOMIC_SEQ_CST)
+# define _LIBCPP_HAS_ATOMIC_BUILTINS
+#elif !defined(__clang__) && defined(_GNUC_VER) && _GNUC_VER >= 407
+# define _LIBCPP_HAS_ATOMIC_BUILTINS
+#endif
+
+#if !defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && !defined(_LIBCPP_HAS_NO_THREADS)
+# if defined(_MSC_VER) && !defined(__clang__)
+ _LIBCPP_WARNING("Building libc++ without __atomic builtins is unsupported")
+# else
+# warning Building libc++ without __atomic builtins is unsupported
+# endif
+#endif
+
+_LIBCPP_BEGIN_NAMESPACE_STD
+
+namespace {
+
+#if defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && !defined(_LIBCPP_HAS_NO_THREADS)
+
+enum __libcpp_atomic_order {
+ _AO_Relaxed = __ATOMIC_RELAXED,
+ _AO_Consume = __ATOMIC_CONSUME,
+ _AO_Aquire = __ATOMIC_ACQUIRE,
+ _AO_Release = __ATOMIC_RELEASE,
+ _AO_Acq_Rel = __ATOMIC_ACQ_REL,
+ _AO_Seq = __ATOMIC_SEQ_CST
+};
+
+template <class _ValueType, class _FromType>
+inline _LIBCPP_INLINE_VISIBILITY
+void __libcpp_atomic_store(_ValueType* __dest, _FromType __val,
+ int __order = _AO_Seq)
+{
+ __atomic_store_n(__dest, __val, __order);
+}
+
+template <class _ValueType, class _FromType>
+inline _LIBCPP_INLINE_VISIBILITY
+void __libcpp_relaxed_store(_ValueType* __dest, _FromType __val)
+{
+ __atomic_store_n(__dest, __val, _AO_Relaxed);
+}
+
+template <class _ValueType>
+inline _LIBCPP_INLINE_VISIBILITY
+_ValueType __libcpp_atomic_load(_ValueType const* __val,
+ int __order = _AO_Seq)
+{
+ return __atomic_load_n(__val, __order);
+}
+
+template <class _ValueType, class _AddType>
+inline _LIBCPP_INLINE_VISIBILITY
+_ValueType __libcpp_atomic_add(_ValueType* __val, _AddType __a,
+ int __order = _AO_Seq)
+{
+ return __atomic_add_fetch(__val, __a, __order);
+}
+
+template <class _ValueType>
+inline _LIBCPP_INLINE_VISIBILITY
+bool __libcpp_atomic_compare_exchange(_ValueType* __val,
+ _ValueType* __expected, _ValueType __after,
+ int __success_order = _AO_Seq,
+ int __fail_order = _AO_Seq)
+{
+ return __atomic_compare_exchange_n(__val, __expected, __after, true,
+ __success_order, __fail_order);
+}
+
+#else // _LIBCPP_HAS_NO_THREADS
+
+enum __libcpp_atomic_order {
+ _AO_Relaxed,
+ _AO_Consume,
+ _AO_Acquire,
+ _AO_Release,
+ _AO_Acq_Rel,
+ _AO_Seq
+};
+
+template <class _ValueType, class _FromType>
+inline _LIBCPP_INLINE_VISIBILITY
+void __libcpp_atomic_store(_ValueType* __dest, _FromType __val,
+ int = 0)
+{
+ *__dest = __val;
+}
+
+template <class _ValueType>
+inline _LIBCPP_INLINE_VISIBILITY
+_ValueType __libcpp_atomic_load(_ValueType const* __val,
+ int = 0)
+{
+ return *__val;
+}
+
+template <class _ValueType, class _AddType>
+inline _LIBCPP_INLINE_VISIBILITY
+_ValueType __libcpp_atomic_add(_ValueType* __val, _AddType __a,
+ int = 0)
+{
+ return *__val += __a;
+}
+
+template <class _ValueType>
+inline _LIBCPP_INLINE_VISIBILITY
+bool __libcpp_atomic_compare_exchange(_ValueType* __val,
+ _ValueType* __expected, _ValueType __after,
+ int = 0, int = 0)
+{
+ if (*__val == *__expected) {
+ *__val = __after;
+ return true;
+ }
+ *__expected = *__val;
+ return false;
+}
+
+#endif // _LIBCPP_HAS_NO_THREADS
+
+} // end namespace
+
+_LIBCPP_END_NAMESPACE_STD
+
+#endif // ATOMIC_SUPPORT_H
Added: libcxx/trunk/src/include/config_elast.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/include/config_elast.h?rev=245354&view=auto
==============================================================================
--- libcxx/trunk/src/include/config_elast.h (added)
+++ libcxx/trunk/src/include/config_elast.h Tue Aug 18 16:08:54 2015
@@ -0,0 +1,36 @@
+//===----------------------- config_elast.h -------------------------------===//
+//
+// 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_CONFIG_ELAST
+#define _LIBCPP_CONFIG_ELAST
+
+#if defined(_WIN32)
+#include <stdlib.h>
+#else
+#include <errno.h>
+#endif
+
+#if defined(ELAST)
+#define _LIBCPP_ELAST ELAST
+#elif defined(_NEWLIB_VERSION)
+#define _LIBCPP_ELAST __ELASTERROR
+#elif defined(__linux__)
+#define _LIBCPP_ELAST 4095
+#elif defined(__APPLE__)
+// No _LIBCPP_ELAST needed on Apple
+#elif defined(__sun__)
+#define _LIBCPP_ELAST ESTALE
+#elif defined(_WIN32)
+#define _LIBCPP_ELAST _sys_nerr
+#else
+// Warn here so that the person doing the libcxx port has an easier time:
+#warning ELAST for this platform not yet implemented
+#endif
+
+#endif // _LIBCPP_CONFIG_ELAST
Modified: libcxx/trunk/src/ios.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/ios.cpp?rev=245354&r1=245353&r2=245354&view=diff
==============================================================================
--- libcxx/trunk/src/ios.cpp (original)
+++ libcxx/trunk/src/ios.cpp Tue Aug 18 16:08:54 2015
@@ -15,7 +15,7 @@
#include "__locale"
#include "algorithm"
-#include "config_elast.h"
+#include "include/config_elast.h"
#include "istream"
#include "limits"
#include "memory"
Modified: libcxx/trunk/src/memory.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/memory.cpp?rev=245354&r1=245353&r2=245354&view=diff
==============================================================================
--- libcxx/trunk/src/memory.cpp (original)
+++ libcxx/trunk/src/memory.cpp Tue Aug 18 16:08:54 2015
@@ -13,7 +13,7 @@
#include "mutex"
#include "thread"
#endif
-#include "support/atomic_support.h"
+#include "include/atomic_support.h"
_LIBCPP_BEGIN_NAMESPACE_STD
Modified: libcxx/trunk/src/mutex.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/mutex.cpp?rev=245354&r1=245353&r2=245354&view=diff
==============================================================================
--- libcxx/trunk/src/mutex.cpp (original)
+++ libcxx/trunk/src/mutex.cpp Tue Aug 18 16:08:54 2015
@@ -12,7 +12,7 @@
#include "limits"
#include "system_error"
#include "cassert"
-#include "support/atomic_support.h"
+#include "include/atomic_support.h"
_LIBCPP_BEGIN_NAMESPACE_STD
#ifndef _LIBCPP_HAS_NO_THREADS
Removed: libcxx/trunk/src/support/atomic_support.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/support/atomic_support.h?rev=245353&view=auto
==============================================================================
--- libcxx/trunk/src/support/atomic_support.h (original)
+++ libcxx/trunk/src/support/atomic_support.h (removed)
@@ -1,142 +0,0 @@
-#ifndef ATOMIC_SUPPORT_H
-#define ATOMIC_SUPPORT_H
-
-#include "__config"
-#include "memory" // for __libcpp_relaxed_load
-
-#if defined(__clang__) && __has_builtin(__atomic_load_n) \
- && __has_builtin(__atomic_store_n) \
- && __has_builtin(__atomic_add_fetch) \
- && __has_builtin(__atomic_compare_exchange_n) \
- && defined(__ATOMIC_RELAXED) \
- && defined(__ATOMIC_CONSUME) \
- && defined(__ATOMIC_ACQUIRE) \
- && defined(__ATOMIC_RELEASE) \
- && defined(__ATOMIC_ACQ_REL) \
- && defined(__ATOMIC_SEQ_CST)
-# define _LIBCPP_HAS_ATOMIC_BUILTINS
-#elif !defined(__clang__) && defined(_GNUC_VER) && _GNUC_VER >= 407
-# define _LIBCPP_HAS_ATOMIC_BUILTINS
-#endif
-
-#if !defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && !defined(_LIBCPP_HAS_NO_THREADS)
-# if defined(_MSC_VER) && !defined(__clang__)
- _LIBCPP_WARNING("Building libc++ without __atomic builtins is unsupported")
-# else
-# warning Building libc++ without __atomic builtins is unsupported
-# endif
-#endif
-
-_LIBCPP_BEGIN_NAMESPACE_STD
-
-namespace {
-
-#if defined(_LIBCPP_HAS_ATOMIC_BUILTINS) && !defined(_LIBCPP_HAS_NO_THREADS)
-
-enum __libcpp_atomic_order {
- _AO_Relaxed = __ATOMIC_RELAXED,
- _AO_Consume = __ATOMIC_CONSUME,
- _AO_Aquire = __ATOMIC_ACQUIRE,
- _AO_Release = __ATOMIC_RELEASE,
- _AO_Acq_Rel = __ATOMIC_ACQ_REL,
- _AO_Seq = __ATOMIC_SEQ_CST
-};
-
-template <class _ValueType, class _FromType>
-inline _LIBCPP_INLINE_VISIBILITY
-void __libcpp_atomic_store(_ValueType* __dest, _FromType __val,
- int __order = _AO_Seq)
-{
- __atomic_store_n(__dest, __val, __order);
-}
-
-template <class _ValueType, class _FromType>
-inline _LIBCPP_INLINE_VISIBILITY
-void __libcpp_relaxed_store(_ValueType* __dest, _FromType __val)
-{
- __atomic_store_n(__dest, __val, _AO_Relaxed);
-}
-
-template <class _ValueType>
-inline _LIBCPP_INLINE_VISIBILITY
-_ValueType __libcpp_atomic_load(_ValueType const* __val,
- int __order = _AO_Seq)
-{
- return __atomic_load_n(__val, __order);
-}
-
-template <class _ValueType, class _AddType>
-inline _LIBCPP_INLINE_VISIBILITY
-_ValueType __libcpp_atomic_add(_ValueType* __val, _AddType __a,
- int __order = _AO_Seq)
-{
- return __atomic_add_fetch(__val, __a, __order);
-}
-
-template <class _ValueType>
-inline _LIBCPP_INLINE_VISIBILITY
-bool __libcpp_atomic_compare_exchange(_ValueType* __val,
- _ValueType* __expected, _ValueType __after,
- int __success_order = _AO_Seq,
- int __fail_order = _AO_Seq)
-{
- return __atomic_compare_exchange_n(__val, __expected, __after, true,
- __success_order, __fail_order);
-}
-
-#else // _LIBCPP_HAS_NO_THREADS
-
-enum __libcpp_atomic_order {
- _AO_Relaxed,
- _AO_Consume,
- _AO_Acquire,
- _AO_Release,
- _AO_Acq_Rel,
- _AO_Seq
-};
-
-template <class _ValueType, class _FromType>
-inline _LIBCPP_INLINE_VISIBILITY
-void __libcpp_atomic_store(_ValueType* __dest, _FromType __val,
- int = 0)
-{
- *__dest = __val;
-}
-
-template <class _ValueType>
-inline _LIBCPP_INLINE_VISIBILITY
-_ValueType __libcpp_atomic_load(_ValueType const* __val,
- int = 0)
-{
- return *__val;
-}
-
-template <class _ValueType, class _AddType>
-inline _LIBCPP_INLINE_VISIBILITY
-_ValueType __libcpp_atomic_add(_ValueType* __val, _AddType __a,
- int = 0)
-{
- return *__val += __a;
-}
-
-template <class _ValueType>
-inline _LIBCPP_INLINE_VISIBILITY
-bool __libcpp_atomic_compare_exchange(_ValueType* __val,
- _ValueType* __expected, _ValueType __after,
- int = 0, int = 0)
-{
- if (*__val == *__expected) {
- *__val = __after;
- return true;
- }
- *__expected = *__val;
- return false;
-}
-
-#endif // _LIBCPP_HAS_NO_THREADS
-
-} // end namespace
-
-_LIBCPP_END_NAMESPACE_STD
-
-#endif // ATOMIC_SUPPORT_H
Modified: libcxx/trunk/src/system_error.cpp
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/src/system_error.cpp?rev=245354&r1=245353&r2=245354&view=diff
==============================================================================
--- libcxx/trunk/src/system_error.cpp (original)
+++ libcxx/trunk/src/system_error.cpp Tue Aug 18 16:08:54 2015
@@ -12,7 +12,7 @@
#define _LIBCPP_BUILDING_SYSTEM_ERROR
#include "system_error"
-#include "config_elast.h"
+#include "include/config_elast.h"
#include "cstring"
#include "string"
More information about the cfe-commits
mailing list