brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.5 KiB · 3f57351 Raw
50 lines · plain
1//  (C) Copyright Matt Borland 2021.2//  Use, modification and distribution are subject to the3//  Boost Software License, Version 1.0. (See accompanying file4//  LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)5//6// We deliberately use assert in here:7//8// boost-no-inspect9 10#ifndef BOOST_MATH_TOOLS_ASSERT_HPP11#define BOOST_MATH_TOOLS_ASSERT_HPP12 13#include <boost/math/tools/config.hpp>14 15#ifdef BOOST_MATH_HAS_GPU_SUPPORT16 17// Run time asserts are generally unsupported18 19#define BOOST_MATH_ASSERT(expr)20#define BOOST_MATH_ASSERT_MSG(expr, msg)21#define BOOST_MATH_STATIC_ASSERT(expr) static_assert(expr, #expr " failed")22#define BOOST_MATH_STATIC_ASSERT_MSG(expr, msg) static_assert(expr, msg)23 24#else25 26#include <boost/math/tools/is_standalone.hpp>27 28#ifndef BOOST_MATH_STANDALONE29 30#include <boost/assert.hpp>31#include <boost/static_assert.hpp>32#define BOOST_MATH_ASSERT(expr) BOOST_ASSERT(expr)33#define BOOST_MATH_ASSERT_MSG(expr, msg) BOOST_ASSERT_MSG(expr, msg)34#define BOOST_MATH_STATIC_ASSERT(expr) BOOST_STATIC_ASSERT(expr)35#define BOOST_MATH_STATIC_ASSERT_MSG(expr, msg) BOOST_STATIC_ASSERT_MSG(expr, msg)36 37#else // Standalone mode - use cassert38 39#include <cassert>40#define BOOST_MATH_ASSERT(expr) assert(expr)41#define BOOST_MATH_ASSERT_MSG(expr, msg) assert((expr)&&(msg))42#define BOOST_MATH_STATIC_ASSERT(expr) static_assert(expr, #expr " failed")43#define BOOST_MATH_STATIC_ASSERT_MSG(expr, msg) static_assert(expr, msg)44 45#endif // Is standalone46 47#endif // BOOST_MATH_HAS_GPU_SUPPORT48 49#endif // BOOST_MATH_TOOLS_ASSERT_HPP50