Commit cbaaa2db authored by Orvid King's avatar Orvid King Committed by facebook-github-bot-4

Add MSVC support to futures/Deprecated.h

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
parent b5338e82
......@@ -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 \
......
......@@ -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
......
/*
* 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__))
......@@ -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);
}
......
......@@ -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
......
......@@ -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
......
......@@ -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) {
......
......@@ -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>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment