From: Orvid King Date: Mon, 3 Aug 2015 19:36:24 +0000 (-0700) Subject: Add MSVC support to futures/Deprecated.h X-Git-Tag: v0.53.0~12 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=cbaaa2db9b6b5e4873af7ce67d2a1631c012f08e;p=folly.git 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 --- diff --git a/folly/Makefile.am b/folly/Makefile.am index bf79eee5..ce4319ad 100644 --- a/folly/Makefile.am +++ b/folly/Makefile.am @@ -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 \ diff --git a/folly/Portability.h b/folly/Portability.h index 252362a5..fad35b1d 100644 --- a/folly/Portability.h +++ b/folly/Portability.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 diff --git a/folly/futures/Deprecated.h b/folly/futures/Deprecated.h deleted file mode 100644 index 1e02f8ca..00000000 --- a/folly/futures/Deprecated.h +++ /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__)) diff --git a/folly/futures/Future.h b/folly/futures/Future.h index 44983e71..0235c77a 100644 --- a/folly/futures/Future.h +++ b/folly/futures/Future.h @@ -24,8 +24,8 @@ #include #include +#include #include -#include #include #include #include @@ -287,19 +287,19 @@ class Future { /// by then), and it is active (active by default). /// /// Inactive Futures will activate upon destruction. - DEPRECATED Future& activate() & { + FOLLY_DEPRECATED("do not use") Future& activate() & { core_->activate(); return *this; } - DEPRECATED Future& deactivate() & { + FOLLY_DEPRECATED("do not use") Future& deactivate() & { core_->deactivate(); return *this; } - DEPRECATED Future activate() && { + FOLLY_DEPRECATED("do not use") Future activate() && { core_->activate(); return std::move(*this); } - DEPRECATED Future deactivate() && { + FOLLY_DEPRECATED("do not use") Future deactivate() && { core_->deactivate(); return std::move(*this); } diff --git a/folly/futures/Promise.h b/folly/futures/Promise.h index 9d6be3c3..eb673754 100644 --- a/folly/futures/Promise.h +++ b/folly/futures/Promise.h @@ -16,7 +16,7 @@ #pragma once -#include +#include #include #include @@ -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 diff --git a/folly/futures/SharedPromise.h b/folly/futures/SharedPromise.h index 5fecffca..dc37e004 100644 --- a/folly/futures/SharedPromise.h +++ b/folly/futures/SharedPromise.h @@ -17,6 +17,7 @@ #pragma once #include +#include 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 diff --git a/folly/futures/Try.h b/folly/futures/Try.h index 79c22163..e5e38afb 100644 --- a/folly/futures/Try.h +++ b/folly/futures/Try.h @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include @@ -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 { * * @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) { diff --git a/folly/futures/helpers.h b/folly/futures/helpers.h index ea1dc70d..30e657c7 100644 --- a/folly/futures/helpers.h +++ b/folly/futures/helpers.h @@ -16,6 +16,7 @@ #pragma once #include +#include namespace folly { @@ -85,7 +86,8 @@ auto makeFutureWith(F&& func) /// /// auto f = makeFuture(std::current_exception()); template -DEPRECATED Future makeFuture(std::exception_ptr const& e); +FOLLY_DEPRECATED("use makeFuture(exception_wrapper)") +Future makeFuture(std::exception_ptr const& e); /// Make a failed Future from an exception_wrapper. template