X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;ds=sidebyside;f=folly%2FExceptionWrapper.h;h=82dfde723ee71cf8d66e3cae3907a5d0650b2f53;hb=1e6a1dce8fa0c0132661a4858b422be14c425dad;hp=0a232728b1be0174ef376127a2db44b28e26540a;hpb=460653084492f23388742905ebb884fc673eaabc;p=folly.git diff --git a/folly/ExceptionWrapper.h b/folly/ExceptionWrapper.h index 0a232728..82dfde72 100644 --- a/folly/ExceptionWrapper.h +++ b/folly/ExceptionWrapper.h @@ -1,5 +1,5 @@ /* - * Copyright 2014 Facebook, Inc. + * Copyright 2017-present Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -13,53 +13,677 @@ * See the License for the specific language governing permissions and * limitations under the License. */ +/* + * Author: Eric Niebler + */ -#ifndef FOLLY_EXCEPTIONWRAPPER_H -#define FOLLY_EXCEPTIONWRAPPER_H +#pragma once #include +#include #include +#include #include -#include "folly/detail/ExceptionWrapper.h" +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#ifdef __GNUC__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpragmas" +#pragma GCC diagnostic ignored "-Wpotentially-evaluated-expression" +// GCC gets confused about lambda scopes and issues shadow-local warnings for +// parameters in totally different functions. +#pragma GCC diagnostic ignored "-Wshadow-local" +#pragma GCC diagnostic ignored "-Wshadow-compatible-local" +#endif + +#define FOLLY_EXCEPTION_WRAPPER_H_INCLUDED namespace folly { -class exception_wrapper { - public: - exception_wrapper() : throwfn_(nullptr) { } +#define FOLLY_REQUIRES_DEF(...) \ + _t(__VA_ARGS__), long>> - void throwException() { - if (throwfn_) { - throwfn_(item_.get()); - } - } +#define FOLLY_REQUIRES(...) FOLLY_REQUIRES_DEF(__VA_ARGS__) = __LINE__ + +namespace exception_wrapper_detail { - std::exception* get() { return item_.get(); } - const std::exception* get() const { return item_.get(); } +template