pstore2
assert.hpp
Go to the documentation of this file.
1 //===- include/pstore/support/assert.hpp ------------------*- mode: C++ -*-===//
2 //* _ *
3 //* __ _ ___ ___ ___ _ __| |_ *
4 //* / _` / __/ __|/ _ \ '__| __| *
5 //* | (_| \__ \__ \ __/ | | |_ *
6 //* \__,_|___/___/\___|_| \__| *
7 //* *
8 //===----------------------------------------------------------------------===//
9 //
10 // Part of the pstore project, under the Apache License v2.0 with LLVM Exceptions.
11 // See https://github.com/SNSystems/pstore/blob/master/LICENSE.txt for license
12 // information.
13 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
14 //
15 //===----------------------------------------------------------------------===//
19 
20 #ifndef PSTORE_SUPPORT_ASSERT_HPP
21 #define PSTORE_SUPPORT_ASSERT_HPP
22 
23 #include "pstore/support/portab.hpp"
24 
25 namespace pstore {
26 
27 #ifndef NDEBUG
28  PSTORE_NO_RETURN
29  void assert_failed (char const * str, char const * file, int line);
30 #endif // NDEBUG
31 
32 } // end namespace pstore
33 
34 #ifndef NDEBUG
35 # define PSTORE_ASSERT(expr) \
36  ((expr) ? static_cast<void> (0) : ::pstore::assert_failed (#expr, __FILE__, __LINE__))
37 #else
38 # define PSTORE_ASSERT(x)
39 #endif // NDEBUG
40 
41 #endif // PSTORE_SUPPORT_ASSERT_HPP
Definition: nonpod2.cpp:40