repr 0.1
Reconstructable string representations and more
Loading...
Searching...
No Matches
assert.h File Reference
#include <librepr/feature.h>
#include "platform.h"
#include "default.h"
#include "format.h"
#include <assert.h>
Include dependency graph for assert.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  librepr
 
namespace  librepr::detail
 

Macros

#define REPR_FORMAT(...)   ::REPR_FORMAT_RNS::format(__VA_ARGS__)
 
#define LIBREPR_DEBUG   1
 
#define LIBREPR_UND_ASSERT_(...)    __assert_fail((__VA_ARGS__), __FILE__, __LINE__, __PRETTY_FUNCTION__)
 
#define LIBREPR_EXASSERT(...)    LIBREPR_UND_ASSERT_((REPR_FORMAT(__VA_ARGS__)).c_str())
 
#define LIBREPR_ASSERT(cond, ...)    do { if(!(cond)) [[unlikely]] { LIBREPR_EXASSERT(__VA_ARGS__); } } while(0)
 
#define LIBREPR_SOFT_ASSERT(...)   (void)(0)
 
#define LIBREPR_UNREACHABLE()   __builtin_unreachable()
 

Functions

void librepr::detail::unreachable ()
 

Macro Definition Documentation

◆ LIBREPR_ASSERT

#define LIBREPR_ASSERT (   cond,
  ... 
)     do { if(!(cond)) [[unlikely]] { LIBREPR_EXASSERT(__VA_ARGS__); } } while(0)

Checked assertion, for constraint enforcement.

◆ LIBREPR_DEBUG

#define LIBREPR_DEBUG   1

◆ LIBREPR_EXASSERT

#define LIBREPR_EXASSERT (   ...)     LIBREPR_UND_ASSERT_((REPR_FORMAT(__VA_ARGS__)).c_str())

Explicit assertion, no condition checks. For fatal errors.

◆ LIBREPR_SOFT_ASSERT

#define LIBREPR_SOFT_ASSERT (   ...)    (void)(0)

Only checks assertion when REPR_HARD_CHECKS is ON.

◆ LIBREPR_UND_ASSERT_

#define LIBREPR_UND_ASSERT_ (   ...)     __assert_fail((__VA_ARGS__), __FILE__, __LINE__, __PRETTY_FUNCTION__)

◆ LIBREPR_UNREACHABLE

#define LIBREPR_UNREACHABLE ( )    __builtin_unreachable()

◆ REPR_FORMAT

#define REPR_FORMAT (   ...)    ::REPR_FORMAT_RNS::format(__VA_ARGS__)