Move various attributes before the declaration to be compatible with MSVC
authorOrvid King <blah38621@gmail.com>
Tue, 28 Jul 2015 22:59:31 +0000 (15:59 -0700)
committerfacebook-github-bot-4 <folly-bot@fb.com>
Wed, 29 Jul 2015 00:22:16 +0000 (17:22 -0700)
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
folly/LifoSem.h
folly/SharedMutex.h
folly/futures/Future.h
folly/futures/Promise.h
folly/futures/SharedPromise.h
folly/futures/Try.h
folly/futures/helpers.h

index 437685a23e657349cee5dd9c8e2ce51376242299..23b42acf9aadc6d357c87c3a073f96b356b16b6f 100644 (file)
@@ -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
 
   /// 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
 
   /// 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
 
   /// 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<TaggedPtr,Atom> FOLLY_ALIGN_TO_AVOID_FALSE_SHARING globalHead_;
+  FOLLY_ALIGN_TO_AVOID_FALSE_SHARING AtomicStruct<TaggedPtr,Atom> globalHead_;
 
   ///////////// private methods
 
 
   ///////////// private methods
 
index 0670263c69a66f6e8152bd7cc22df7271b7b769a..24b37c8f411492c5f79b470d4f23ddd54f28499a 100644 (file)
@@ -504,8 +504,8 @@ struct LifoSemBase : boost::noncopyable {
 
  private:
 
 
  private:
 
-  folly::AtomicStruct<LifoSemHead,Atom> head_
-      FOLLY_ALIGN_TO_AVOID_FALSE_SHARING;
+  FOLLY_ALIGN_TO_AVOID_FALSE_SHARING
+  folly::AtomicStruct<LifoSemHead,Atom> head_;
 
   char padding_[folly::detail::CacheLocality::kFalseSharingRange -
       sizeof(LifoSemHead)];
 
   char padding_[folly::detail::CacheLocality::kFalseSharingRange -
       sizeof(LifoSemHead)];
index 37b39765dc1eb1231ce62fbe370da267ecd29b1e..196df92860dcec283d592f942f8909deeb96ca54 100644 (file)
@@ -711,9 +711,9 @@ class SharedMutexImpl {
   // should be considered that there is a shared lock on that instance.
   // See kTokenless.
   typedef Atom<uintptr_t> DeferredReaderSlot;
   // should be considered that there is a shared lock on that instance.
   // See kTokenless.
   typedef Atom<uintptr_t> DeferredReaderSlot;
-  static DeferredReaderSlot deferredReaders
+  FOLLY_ALIGN_TO_AVOID_FALSE_SHARING static DeferredReaderSlot deferredReaders
       [kMaxDeferredReaders *
       [kMaxDeferredReaders *
-       kDeferredSeparationFactor] FOLLY_ALIGN_TO_AVOID_FALSE_SHARING;
+       kDeferredSeparationFactor];
 
   // Performs an exclusive lock, waiting for state_ & waitMask to be
   // zero first
 
   // Performs an exclusive lock, waiting for state_ & waitMask to be
   // zero first
index a1f7826253a53feca4d136b625d757e18df461f8..44983e718ba8a7dfcebbd46d642681d86b4c5ee1 100644 (file)
@@ -287,19 +287,19 @@ class Future {
   /// by then), and it is active (active by default).
   ///
   /// Inactive Futures will activate upon destruction.
   /// by then), and it is active (active by default).
   ///
   /// Inactive Futures will activate upon destruction.
-  Future<T>& activate() & DEPRECATED {
+  DEPRECATED Future<T>& activate() & {
     core_->activate();
     return *this;
   }
     core_->activate();
     return *this;
   }
-  Future<T>& deactivate() & DEPRECATED {
+  DEPRECATED Future<T>& deactivate() & {
     core_->deactivate();
     return *this;
   }
     core_->deactivate();
     return *this;
   }
-  Future<T> activate() && DEPRECATED {
+  DEPRECATED Future<T> activate() && {
     core_->activate();
     return std::move(*this);
   }
     core_->activate();
     return std::move(*this);
   }
-  Future<T> deactivate() && DEPRECATED {
+  DEPRECATED Future<T> deactivate() && {
     core_->deactivate();
     return std::move(*this);
   }
     core_->deactivate();
     return std::move(*this);
   }
index 88f6631f8ed1608bb816b2bd171bbe3131ac50df..9d6be3c34eb54293d9e9f6b4443e9ddeec1065ed 100644 (file)
@@ -53,7 +53,7 @@ public:
       p.setException(std::current_exception());
     }
     */
       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
 
   /** Fulfill the Promise with an exception type E, which can be passed to
     std::make_exception_ptr(). Useful for originating exceptions. If you
index 1d5670cde2efa5f4bc27f4712de08bb159102edb..5fecffca8af4f7fc34f27def8228eb0a670ca49d 100644 (file)
@@ -64,7 +64,7 @@ public:
       p.setException(std::current_exception());
     }
     */
       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
 
   /** Fulfill the SharedPromise with an exception type E, which can be passed to
     std::make_exception_ptr(). Useful for originating exceptions. If you
index d06d5b6225b73e74e696aad711c3614cdf17a4d1..79c221631897b0d5ec708986528fd437d662e45d 100644 (file)
@@ -94,7 +94,7 @@ class Try {
    *
    * @param ep The exception_pointer. Will be rethrown.
    */
    *
    * @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);
     : contains_(Contains::EXCEPTION) {
     try {
       std::rethrow_exception(ep);
@@ -254,7 +254,7 @@ class Try<void> {
    *
    * @param ep The exception_pointer. Will be rethrown.
    */
    *
    * @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) {
     try {
       std::rethrow_exception(ep);
     } catch (const std::exception& e) {
index 3b762732189172297b3c216bf48f91e3beae0052..3b0ef2995767ba05c325e3f2564a07d1d54a5b15 100644 (file)
@@ -85,7 +85,7 @@ auto makeFutureWith(F&& func)
 ///
 ///   auto f = makeFuture<string>(std::current_exception());
 template <class T>
 ///
 ///   auto f = makeFuture<string>(std::current_exception());
 template <class T>
-Future<T> makeFuture(std::exception_ptr const& e) DEPRECATED;
+DEPRECATED Future<T> makeFuture(std::exception_ptr const& e);
 
 /// Make a failed Future from an exception_wrapper.
 template <class T>
 
 /// Make a failed Future from an exception_wrapper.
 template <class T>