Skip to content
Snippets Groups Projects
Commit 7721fbc7 authored by Simon Praetorius's avatar Simon Praetorius
Browse files

Deprecate the DUNE_ASSERT_AND_RETURN macro

parent 4eee0b3a
No related branches found
No related tags found
1 merge request!1236Deprecate the DUNE_ASSERT_AND_RETURN macro
Pipeline #60659 passed
Pipeline: Dune Nightly Test

#60661

    ......@@ -70,7 +70,8 @@ In order to build the DUNE core modules you need at least the following software
    - Deprecated `conjunction`, `disjunction`, and `negation` have been removed. Instead,
    use the structs from `<type_traits>` introduced with C++17.
    - Remove deprecated `dune/common/std/apply.hh`, use `std::apply` instead.
    - Deprecated the file `dune/common/assertandreturn.hh` and the contained utility
    `DUNE_ASSERT_AND_RETURN`. Use `assert()` macro directly in `constexpr` functions.
    # Release 2.9
    ......
    ......@@ -5,6 +5,10 @@
    #ifndef DUNE_COMMON_ASSERTANDRETURN_HH
    #define DUNE_COMMON_ASSERTANDRETURN_HH
    #warning "The file assertandreturn.hh is deprecated. Since c++14 constexpr functions allow more \
    than a single return statement and thus this utility is useless. Will be removed after \
    Dune 2.10 release."
    #include <cassert>
    //! Asserts a condition and return on success in constexpr context.
    ......@@ -15,6 +19,7 @@
    * and then returns the value of the second argument.
    *
    * \ingroup CxxUtilities
    * \deprecated Will be removed after Dune 2.10 release
    */
    #ifdef NDEBUG
    #define DUNE_ASSERT_AND_RETURN(C,X) X
    ......
    ......@@ -149,14 +149,11 @@ namespace Impl {
    return Dune::StaticIntegralRange<std::size_t, End::value, Begin::value>();
    }
    // This should be constexpr but gcc-4.9 does not support
    // the relaxed constexpr requirements. Hence for being
    // constexpr the function body can only contain a return
    // statement and no assertion before this.
    template<class Begin, class End>
    constexpr auto integralRange(const Begin& begin, const End& end, const PriorityTag<0>&)
    {
    return DUNE_ASSERT_AND_RETURN(begin<=end, Dune::IntegralRange<End>(begin, end));
    assert(begin<=end && "You cannot create an integralRange where end<begin");
    return Dune::IntegralRange<End>(begin, end);
    }
    } // namespace Impl
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment