DUNE PDELab (git)

assertandreturn.hh
1// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2// vi: set et ts=4 sw=2 sts=2:
3// SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
4// SPDX-License-Identifier: LicenseRef-GPL-2.0-only-with-DUNE-exception
5#ifndef DUNE_COMMON_ASSERTANDRETURN_HH
6#define DUNE_COMMON_ASSERTANDRETURN_HH
7
8#ifndef DUNE_DISABLE_DEPRECATION_WARNING_ASSERT_AND_RETURN
9#warning "The file assertandreturn.hh is deprecated. Since c++14 constexpr functions allow more \
10than a single return statement and thus this utility is useless. Will be removed after \
11Dune 2.10 release."
12#endif // DUNE_DISABLE_DEPRECATION_WARNING_ASSERT_AND_RETURN
13
14#include <cassert>
15
17
26#ifdef NDEBUG
27 #define DUNE_ASSERT_AND_RETURN(C,X) X
28#else
29 #define DUNE_ASSERT_AND_RETURN(C,X) (!(C) ? throw [&](){assert(!#C);return 0;}() : 0), X
30#endif
31
32
33
34#endif // DUNE_COMMON_ASSERTANDRETURN_HH
Creative Commons License   |  Legal Statements / Impressum  |  Hosted by TU Dresden  |  generated with Hugo v0.111.3 (Jul 15, 22:36, 2024)