proxygen
SafeAssert.h
Go to the documentation of this file.
1 /*
2  * Copyright 2013-present Facebook, Inc.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #pragma once
18 
19 #include <folly/Portability.h>
20 #include <folly/Preprocessor.h>
21 
27 #define FOLLY_SAFE_CHECK_IMPL(expr, expr_s, msg) \
28  ((expr) ? static_cast<void>(0) \
29  : ::folly::detail::assertionFailure( \
30  FB_STRINGIZE(expr_s), \
31  (msg), \
32  __FILE__, \
33  __LINE__, \
34  __PRETTY_FUNCTION__))
35 #define FOLLY_SAFE_CHECK(expr, msg) FOLLY_SAFE_CHECK_IMPL((expr), (expr), (msg))
36 
42 #define FOLLY_SAFE_DCHECK(expr, msg) \
43  FOLLY_SAFE_CHECK_IMPL(!folly::kIsDebug || (expr), (expr), (msg))
44 
45 namespace folly {
46 namespace detail {
47 
48 [[noreturn]] void assertionFailure(
49  const char* expr,
50  const char* msg,
51  const char* file,
52  unsigned int line,
53  const char* function);
54 } // namespace detail
55 } // namespace folly
void assertionFailure(const char *expr, const char *msg, const char *file, unsigned int line, const char *function)
Definition: SafeAssert.cpp:34
—— Concurrent Priority Queue Implementation ——
Definition: AtomicBitSet.h:29