X-Git-Url: http://plrg.eecs.uci.edu/git/?a=blobdiff_plain;f=folly%2FException.h;h=85bbeda47164dba61174a6cecf005b49a99d8bcb;hb=218a45f5830c9245b8ccfab3c389b56bf74db730;hp=b4f6da1496de77db4c7a0017a0687296ffbaa461;hpb=2fcb96be06a8c657e2b17760fbe55d8800a98e01;p=folly.git diff --git a/folly/Exception.h b/folly/Exception.h index b4f6da14..85bbeda4 100644 --- a/folly/Exception.h +++ b/folly/Exception.h @@ -1,5 +1,5 @@ /* - * Copyright 2014 Facebook, Inc. + * Copyright 2016 Facebook, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -14,8 +14,7 @@ * limitations under the License. */ -#ifndef FOLLY_EXCEPTION_H_ -#define FOLLY_EXCEPTION_H_ +#pragma once #include @@ -37,24 +36,19 @@ namespace folly { // The *Explicit functions take an explicit value for errno. // Helper to throw std::system_error -FOLLY_NORETURN void throwSystemErrorExplicit(int err, const char*); -inline void throwSystemErrorExplicit(int err, const char* msg) { +[[noreturn]] inline void throwSystemErrorExplicit(int err, const char* msg) { throw std::system_error(err, std::system_category(), msg); } template -FOLLY_NORETURN void throwSystemErrorExplicit(int, Args&&... args); -template -void throwSystemErrorExplicit(int err, Args&&... args) { +[[noreturn]] void throwSystemErrorExplicit(int err, Args&&... args) { throwSystemErrorExplicit( err, to(std::forward(args)...).c_str()); } // Helper to throw std::system_error from errno and components of a string template -FOLLY_NORETURN void throwSystemError(Args&&... args); -template -void throwSystemError(Args&&... args) { +[[noreturn]] void throwSystemError(Args&&... args) { throwSystemErrorExplicit(errno, std::forward(args)...); } @@ -124,6 +118,3 @@ void throwOnFail(V&& value, Args&&... args) { ::folly::throwOnFail((cond), "Check failed: " #cond) } // namespace folly - -#endif /* FOLLY_EXCEPTION_H_ */ -