Bug 932454. Make Atomics.h compilable with clang on Windows. r=nfroyd,jwalden

MSVC is sloppy with typedefs leaking. Clang is more strict.

--HG--
extra : rebase_source : e8000f43391f8a32fbde96d54ff11e09e49345f9
This commit is contained in:
Jeff Muizelaar 2013-10-29 17:55:38 -04:00
parent 90d83b3d32
commit df3077c1c3

View File

@ -703,6 +703,10 @@ struct IntrinsicBase
template<typename T, MemoryOrdering Order>
struct IntrinsicMemoryOps : public IntrinsicBase<T>
{
typedef typename IntrinsicBase<T>::ValueType ValueType;
typedef typename IntrinsicBase<T>::Primitives Primitives;
typedef typename IntrinsicBase<T>::PrimType PrimType;
typedef typename IntrinsicBase<T>::Cast Cast;
static ValueType load(const ValueType& ptr) {
Barrier<Order>::beforeLoad();
ValueType val = ptr;
@ -737,6 +741,9 @@ struct IntrinsicMemoryOps : public IntrinsicBase<T>
template<typename T>
struct IntrinsicApplyHelper : public IntrinsicBase<T>
{
typedef typename IntrinsicBase<T>::ValueType ValueType;
typedef typename IntrinsicBase<T>::PrimType PrimType;
typedef typename IntrinsicBase<T>::Cast Cast;
typedef PrimType (*BinaryOp)(PrimType*, PrimType);
typedef PrimType (*UnaryOp)(PrimType*);
@ -756,6 +763,8 @@ struct IntrinsicApplyHelper : public IntrinsicBase<T>
template<typename T>
struct IntrinsicAddSub : public IntrinsicApplyHelper<T>
{
typedef typename IntrinsicApplyHelper<T>::ValueType ValueType;
typedef typename IntrinsicBase<T>::Primitives Primitives;
static ValueType add(ValueType& ptr, ValueType val) {
return applyBinaryFunction(&Primitives::add, ptr, val);
}
@ -767,6 +776,7 @@ struct IntrinsicAddSub : public IntrinsicApplyHelper<T>
template<typename T>
struct IntrinsicAddSub<T*> : public IntrinsicApplyHelper<T*>
{
typedef typename IntrinsicApplyHelper<T*>::ValueType ValueType;
static ValueType add(ValueType& ptr, ptrdiff_t amount) {
return applyBinaryFunction(&Primitives::add, ptr,
(ValueType)(amount * sizeof(ValueType)));
@ -780,6 +790,7 @@ struct IntrinsicAddSub<T*> : public IntrinsicApplyHelper<T*>
template<typename T>
struct IntrinsicIncDec : public IntrinsicAddSub<T>
{
typedef typename IntrinsicAddSub<T>::ValueType ValueType;
static ValueType inc(ValueType& ptr) { return add(ptr, 1); }
static ValueType dec(ValueType& ptr) { return sub(ptr, 1); }
};
@ -788,6 +799,7 @@ template<typename T, MemoryOrdering Order>
struct AtomicIntrinsics : public IntrinsicMemoryOps<T, Order>,
public IntrinsicIncDec<T>
{
typedef typename IntrinsicIncDec<T>::ValueType ValueType;
static ValueType or_(ValueType& ptr, T val) {
return applyBinaryFunction(&Primitives::or_, ptr, val);
}
@ -803,6 +815,7 @@ template<typename T, MemoryOrdering Order>
struct AtomicIntrinsics<T*, Order> : public IntrinsicMemoryOps<T*, Order>,
public IntrinsicIncDec<T*>
{
typedef typename IntrinsicMemoryOps<T*, Order>::ValueType ValueType;
};
} // namespace detail