Add MSVC support to futures/Deprecated.h
authorOrvid King <blah38621@gmail.com>
Mon, 3 Aug 2015 19:36:24 +0000 (12:36 -0700)
committerfacebook-github-bot-4 <folly-bot@fb.com>
Mon, 3 Aug 2015 20:22:13 +0000 (13:22 -0700)
Summary: It was originally unconditionally useing `__attribute__` syntax, so this makes it conditionally use the `__declspec` syntax.
Closes #268

Reviewed By: @yfeldblum

Differential Revision: D2283909

Pulled By: @sgolemon

folly/Makefile.am
folly/Portability.h
folly/futures/Deprecated.h [deleted file]
folly/futures/Future.h
folly/futures/Promise.h
folly/futures/SharedPromise.h
folly/futures/Try.h
folly/futures/helpers.h

index bf79eee..ce4319a 100644 (file)
@@ -131,7 +131,6 @@ nobase_follyinclude_HEADERS = \
        Format.h \
        Format-inl.h \
        futures/Barrier.h \
-       futures/Deprecated.h \
        futures/ThreadedExecutor.h \
        futures/DrivableExecutor.h \
        futures/Future-pre.h \
index 252362a..fad35b1 100644 (file)
@@ -94,7 +94,7 @@ struct MaxAlign { char c; } __attribute__((__aligned__));
 #elif defined(_MSC_VER)
 # define FOLLY_DEPRECATED(msg) __declspec(deprecated(msg))
 #else
-# define FOLLY_DEPRECATED
+# define FOLLY_DEPRECATED(msg)
 #endif
 
 // noreturn
diff --git a/folly/futures/Deprecated.h b/folly/futures/Deprecated.h
deleted file mode 100644 (file)
index 1e02f8c..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- * Copyright 2015 Facebook, Inc.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#pragma once
-#define DEPRECATED __attribute__((__deprecated__))
index 44983e7..0235c77 100644 (file)
@@ -24,8 +24,8 @@
 #include <vector>
 
 #include <folly/Optional.h>
+#include <folly/Portability.h>
 #include <folly/MoveWrapper.h>
-#include <folly/futures/Deprecated.h>
 #include <folly/futures/DrivableExecutor.h>
 #include <folly/futures/Promise.h>
 #include <folly/futures/Try.h>
@@ -287,19 +287,19 @@ class Future {
   /// by then), and it is active (active by default).
   ///
   /// Inactive Futures will activate upon destruction.
-  DEPRECATED Future<T>& activate() & {
+  FOLLY_DEPRECATED("do not use") Future<T>& activate() & {
     core_->activate();
     return *this;
   }
-  DEPRECATED Future<T>& deactivate() & {
+  FOLLY_DEPRECATED("do not use") Future<T>& deactivate() & {
     core_->deactivate();
     return *this;
   }
-  DEPRECATED Future<T> activate() && {
+  FOLLY_DEPRECATED("do not use") Future<T> activate() && {
     core_->activate();
     return std::move(*this);
   }
-  DEPRECATED Future<T> deactivate() && {
+  FOLLY_DEPRECATED("do not use") Future<T> deactivate() && {
     core_->deactivate();
     return std::move(*this);
   }
index 9d6be3c..eb67375 100644 (file)
@@ -16,7 +16,7 @@
 
 #pragma once
 
-#include <folly/futures/Deprecated.h>
+#include <folly/Portability.h>
 #include <folly/futures/Try.h>
 #include <functional>
 
@@ -53,7 +53,8 @@ public:
       p.setException(std::current_exception());
     }
     */
-  DEPRECATED void setException(std::exception_ptr const&);
+  FOLLY_DEPRECATED("use setException(exception_wrapper)")
+  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
index 5fecffc..dc37e00 100644 (file)
@@ -17,6 +17,7 @@
 #pragma once
 
 #include <folly/futures/Promise.h>
+#include <folly/Portability.h>
 
 namespace folly {
 
@@ -64,7 +65,8 @@ public:
       p.setException(std::current_exception());
     }
     */
-  DEPRECATED void setException(std::exception_ptr const&);
+  FOLLY_DEPRECATED("use setException(exception_wrapper)")
+  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
index 79c2216..e5e38af 100644 (file)
@@ -22,7 +22,7 @@
 #include <folly/ExceptionWrapper.h>
 #include <folly/Likely.h>
 #include <folly/Memory.h>
-#include <folly/futures/Deprecated.h>
+#include <folly/Portability.h>
 #include <folly/futures/FutureException.h>
 #include <folly/futures/Unit.h>
 
@@ -94,7 +94,8 @@ class Try {
    *
    * @param ep The exception_pointer. Will be rethrown.
    */
-  DEPRECATED explicit Try(std::exception_ptr ep)
+  FOLLY_DEPRECATED("use Try(exception_wrapper)")
+  explicit Try(std::exception_ptr ep)
     : contains_(Contains::EXCEPTION) {
     try {
       std::rethrow_exception(ep);
@@ -254,7 +255,8 @@ class Try<void> {
    *
    * @param ep The exception_pointer. Will be rethrown.
    */
-  DEPRECATED explicit Try(std::exception_ptr ep) : hasValue_(false) {
+  FOLLY_DEPRECATED("use Try(exception_wrapper)")
+  explicit Try(std::exception_ptr ep) : hasValue_(false) {
     try {
       std::rethrow_exception(ep);
     } catch (const std::exception& e) {
index ea1dc70..30e657c 100644 (file)
@@ -16,6 +16,7 @@
 #pragma once
 
 #include <folly/futures/Future.h>
+#include <folly/Portability.h>
 
 namespace folly {
 
@@ -85,7 +86,8 @@ auto makeFutureWith(F&& func)
 ///
 ///   auto f = makeFuture<string>(std::current_exception());
 template <class T>
-DEPRECATED Future<T> makeFuture(std::exception_ptr const& e);
+FOLLY_DEPRECATED("use makeFuture(exception_wrapper)")
+Future<T> makeFuture(std::exception_ptr const& e);
 
 /// Make a failed Future from an exception_wrapper.
 template <class T>