From 6646f7f214504389cdd76147d415c24d0ee45b0f Mon Sep 17 00:00:00 2001 From: Orvid King Date: Tue, 28 Jul 2015 15:59:31 -0700 Subject: [PATCH] Move various attributes before the declaration to be compatible with MSVC Summary: MSVC will just produce syntax errors if these are left where they currently are. GCC and LLVM support them in either location with the same meaning. Closes #267 Reviewed By: @yfeldblum Differential Revision: D2283889 Pulled By: @sgolemon --- folly/IndexedMemPool.h | 4 ++-- folly/LifoSem.h | 4 ++-- folly/SharedMutex.h | 4 ++-- folly/futures/Future.h | 8 ++++---- folly/futures/Promise.h | 2 +- folly/futures/SharedPromise.h | 2 +- folly/futures/Try.h | 4 ++-- folly/futures/helpers.h | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/folly/IndexedMemPool.h b/folly/IndexedMemPool.h index 437685a2..23b42acf 100644 --- a/folly/IndexedMemPool.h +++ b/folly/IndexedMemPool.h @@ -310,7 +310,7 @@ struct IndexedMemPool : boost::noncopyable { /// raw storage, only 1..min(size_,actualCapacity_) (inclusive) are /// actually constructed. Note that slots_[0] is not constructed or used - Slot* FOLLY_ALIGN_TO_AVOID_FALSE_SHARING slots_; + FOLLY_ALIGN_TO_AVOID_FALSE_SHARING Slot* slots_; /// use AccessSpreader to find your list. We use stripes instead of /// thread-local to avoid the need to grow or shrink on thread start @@ -319,7 +319,7 @@ struct IndexedMemPool : boost::noncopyable { /// this is the head of a list of node chained by globalNext, that are /// themselves each the head of a list chained by localNext - AtomicStruct FOLLY_ALIGN_TO_AVOID_FALSE_SHARING globalHead_; + FOLLY_ALIGN_TO_AVOID_FALSE_SHARING AtomicStruct globalHead_; ///////////// private methods diff --git a/folly/LifoSem.h b/folly/LifoSem.h index 0670263c..24b37c8f 100644 --- a/folly/LifoSem.h +++ b/folly/LifoSem.h @@ -504,8 +504,8 @@ struct LifoSemBase : boost::noncopyable { private: - folly::AtomicStruct head_ - FOLLY_ALIGN_TO_AVOID_FALSE_SHARING; + FOLLY_ALIGN_TO_AVOID_FALSE_SHARING + folly::AtomicStruct head_; char padding_[folly::detail::CacheLocality::kFalseSharingRange - sizeof(LifoSemHead)]; diff --git a/folly/SharedMutex.h b/folly/SharedMutex.h index 37b39765..196df928 100644 --- a/folly/SharedMutex.h +++ b/folly/SharedMutex.h @@ -711,9 +711,9 @@ class SharedMutexImpl { // should be considered that there is a shared lock on that instance. // See kTokenless. typedef Atom DeferredReaderSlot; - static DeferredReaderSlot deferredReaders + FOLLY_ALIGN_TO_AVOID_FALSE_SHARING static DeferredReaderSlot deferredReaders [kMaxDeferredReaders * - kDeferredSeparationFactor] FOLLY_ALIGN_TO_AVOID_FALSE_SHARING; + kDeferredSeparationFactor]; // Performs an exclusive lock, waiting for state_ & waitMask to be // zero first diff --git a/folly/futures/Future.h b/folly/futures/Future.h index a1f78262..44983e71 100644 --- a/folly/futures/Future.h +++ b/folly/futures/Future.h @@ -287,19 +287,19 @@ class Future { /// by then), and it is active (active by default). /// /// Inactive Futures will activate upon destruction. - Future& activate() & DEPRECATED { + DEPRECATED Future& activate() & { core_->activate(); return *this; } - Future& deactivate() & DEPRECATED { + DEPRECATED Future& deactivate() & { core_->deactivate(); return *this; } - Future activate() && DEPRECATED { + DEPRECATED Future activate() && { core_->activate(); return std::move(*this); } - Future deactivate() && DEPRECATED { + DEPRECATED Future deactivate() && { core_->deactivate(); return std::move(*this); } diff --git a/folly/futures/Promise.h b/folly/futures/Promise.h index 88f6631f..9d6be3c3 100644 --- a/folly/futures/Promise.h +++ b/folly/futures/Promise.h @@ -53,7 +53,7 @@ public: p.setException(std::current_exception()); } */ - void setException(std::exception_ptr const&) DEPRECATED; + DEPRECATED void setException(std::exception_ptr const&); /** Fulfill the Promise with an exception type E, which can be passed to std::make_exception_ptr(). Useful for originating exceptions. If you diff --git a/folly/futures/SharedPromise.h b/folly/futures/SharedPromise.h index 1d5670cd..5fecffca 100644 --- a/folly/futures/SharedPromise.h +++ b/folly/futures/SharedPromise.h @@ -64,7 +64,7 @@ public: p.setException(std::current_exception()); } */ - void setException(std::exception_ptr const&) DEPRECATED; + DEPRECATED void setException(std::exception_ptr const&); /** Fulfill the SharedPromise with an exception type E, which can be passed to std::make_exception_ptr(). Useful for originating exceptions. If you diff --git a/folly/futures/Try.h b/folly/futures/Try.h index d06d5b62..79c22163 100644 --- a/folly/futures/Try.h +++ b/folly/futures/Try.h @@ -94,7 +94,7 @@ class Try { * * @param ep The exception_pointer. Will be rethrown. */ - explicit Try(std::exception_ptr ep) DEPRECATED + DEPRECATED explicit Try(std::exception_ptr ep) : contains_(Contains::EXCEPTION) { try { std::rethrow_exception(ep); @@ -254,7 +254,7 @@ class Try { * * @param ep The exception_pointer. Will be rethrown. */ - explicit Try(std::exception_ptr ep) DEPRECATED : hasValue_(false) { + DEPRECATED explicit Try(std::exception_ptr ep) : hasValue_(false) { try { std::rethrow_exception(ep); } catch (const std::exception& e) { diff --git a/folly/futures/helpers.h b/folly/futures/helpers.h index 3b762732..3b0ef299 100644 --- a/folly/futures/helpers.h +++ b/folly/futures/helpers.h @@ -85,7 +85,7 @@ auto makeFutureWith(F&& func) /// /// auto f = makeFuture(std::current_exception()); template -Future makeFuture(std::exception_ptr const& e) DEPRECATED; +DEPRECATED Future makeFuture(std::exception_ptr const& e); /// Make a failed Future from an exception_wrapper. template -- 2.34.1